Harbour warnings

Re: Harbour warnings

Postby Enrico Maria Giordano » Fri Jun 24, 2022 9:22 pm

rhlawek wrote:Yes, unfortunately. I know inserting this throughout any code base could be a hassle but, yes, this is exactly what I have done. If I cant' fix something just via code (always my preference) I may hide the error using an HB_SYMBOL_UNUSED() call at the end of a func/proc and only use the pragma as a last resort.

I tend to keep all my fivewin code isolated from my pure harbour code, so it actually isn't a huge problem for me, but then again I did it years ago and have maintained that practice. My practice is to fix anything/everything that I can fix for warnings thrown when using -W3, including using HB_SYMBOL_UNUSED() where it is applicable, then only use the pragma to fix what is left. I'm always looking for a better answer, but so far this is the best I've come up with.

I'll say again, I know using the pragma to change to w1 works, but a following call to set back to w3 doesn't always work. I've always assumed this is a harbour bug of some sort but I've never tried to track it down.


Can you show me how do you fix my sample without using -w, please?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Harbour warnings

Postby cnavarro » Sat Jun 25, 2022 5:22 am

Enrico, I can't reproduce what you say. I use buildh.bat from the fivewin folder, in which this line appears
%hdir%\bin\harbour %1 /n /i%fwh%\include;%hdir%\include; /w /p %2 %3 > comp.log 2> warnings.log


Image
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Harbour warnings

Postby Antonio Linares » Sat Jun 25, 2022 6:49 am

Dear Enrico,

Weren't you a xHarbour user ?

Knowing you for years, what made the miracle of changing ? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Harbour warnings

Postby Enrico Maria Giordano » Sat Jun 25, 2022 7:29 am

cnavarro wrote:Enrico, I can't reproduce what you say. I use buildh.bat from the fivewin folder, in which this line appears
%hdir%\bin\harbour %1 /n /i%fwh%\include;%hdir%\include; /w /p %2 %3 > comp.log 2> warnings.log


Please remove /w switch. I don't want to suppress all the /w3 warnings.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Harbour warnings

Postby Enrico Maria Giordano » Sat Jun 25, 2022 7:32 am

Antonio Linares wrote:Dear Enrico,

Weren't you a xHarbour user ?

Knowing you for years, what made the miracle of changing ? :-)


I have both compilers ready to use and already use Harbour for some project.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Harbour warnings

Postby Antonio Linares » Sat Jun 25, 2022 7:49 am

very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Harbour warnings

Postby Enrico Maria Giordano » Sat Jun 25, 2022 8:05 am

But I would like to solve the warning problem...

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Harbour warnings

Postby Antonio Linares » Sat Jun 25, 2022 9:05 am

Dear Enrico,

The warning is correct. What do you want to solve ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Harbour warnings

Postby Enrico Maria Giordano » Sat Jun 25, 2022 12:56 pm

Antonio Linares wrote:Dear Enrico,

The warning is correct. What do you want to solve ?


I don't want to see warnings that I cannot fixed. There is a way to fix it?

Code: Select all  Expand view  RUN
  ACTIVATE DIALOG oDlg;
           ON INIT MSGINFO();
           CENTER


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Harbour warnings

Postby Antonio Linares » Sat Jun 25, 2022 1:05 pm

Dear Enrico,

Have you tried it this way ?

Code: Select all  Expand view  RUN
 ACTIVATE DIALOG oDlg;
           ON INIT ( Self := Self, MSGINFO() ) ;
           CENTER


or following Harbour rules:

Code: Select all  Expand view  RUN
 ACTIVATE DIALOG oDlg;
           ON INIT ( HB_SYMBOL_UNUSED( self ), MSGINFO() ) ;
           CENTER
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Harbour warnings

Postby Enrico Maria Giordano » Sat Jun 25, 2022 2:28 pm

Thank you, but this is not a solution at all. Do I have to put it in each DIALOG of all my apps? This would be a huge work!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Harbour warnings

Postby Antonio Linares » Sat Jun 25, 2022 2:57 pm

Dear Enrico,

What solution do you expect ?

How would that solution should be ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Harbour warnings

Postby nageswaragunupudi » Sat Jun 25, 2022 3:19 pm

Once we find a solution, we need to implement it in fivewin.ch commands.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Harbour warnings

Postby Enrico Maria Giordano » Sat Jun 25, 2022 3:31 pm

The solution is already present in xHarbour (-wb- compiler switch). As I already wrote, I did hope that there were a similar solution for Harbour. Ok, I understood that there is not. :-(

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Harbour warnings

Postby rhlawek » Sat Jun 25, 2022 3:35 pm

What Antonio suggests here actually works:

Code: Select all  Expand view  RUN

ACTIVATE DIALOG oDlg;
           ON INIT ( Self := Self, MSGINFO() ) ;
           CENTER
 


But this does not, primarily because hb_symbol_unused() is defined in fivewin.ch after "dialog.ch" is included in fivewin.ch

Code: Select all  Expand view  RUN

ACTIVATE DIALOG oDlg;
           ON INIT ( hb_symbol_unused( Self ), MSGINFO() ) ;
           CENTER
 


This edit in dialogs.ch does work (not sure of negative fallout), but it is inadequate/incomplete because things like nRow, nCol, nFlags, etc. need to be handled in other rows as well. What I do NOT understand why Self in the row for .center. does not also throw the warning when using w3. (if you take out the ON INIT from the sample and leave CENTER there is no warning, but add in something like ON CLICK and there will be warnings on nRow, nCol, nFlags and Self, but the same assignment trick works for these as well)

Code: Select all  Expand view  RUN

#xcommand ACTIVATE DIALOG <oDlg> ;
             [ <center: CENTER, CENTERED> [ <inwnd: IN PARENT> ] ] ;
             [ <NonModal: NOWAIT, NOMODAL> ] ;
             [ WHEN <uWhen> ] ;
             [ VALID <uValid> ] ;
             [ ON [ LEFT ] CLICK <uClick> ] ;
             [ ON INIT <uInit> ] ;
             [ ON MOVE <uMoved> ] ;
             [ ON PAINT <uPaint> ] ;
             [ ON RIGHT CLICK <uRClicked> ] ;
             [ <Resize16: RESIZE16> ] ;
             [ <mdi: AS MDICHILD> [ SETUP <usetup> ] ] ;
        => ;
          <oDlg>:Activate( <oDlg>:bLClicked [ := {|nRow,nCol,nFlags,Self|<uClick>}], ;
                           <oDlg>:bMoved    [ := <{uMoved}> ], ;
                           <oDlg>:bPainted  [ := {|hDC,cPS,Self|<uPaint>}],;
                           <.center.>, [{|Self|<uValid>}],;
                           [ ! <.NonModal.> ], [{|Self|<uInit>,self:=self}],; // NOTE addition of self := self
                           <oDlg>:bRClicked [ := {|nRow,nCol,nFlags,Self|<uRClicked>}],;
                           [{|Self|<uWhen>}], [<.Resize16.>], [<.inwnd.>], ;
                           [<.mdi.>], [@<oDlg>], [{|oWnd|<usetup>}] )
 
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 59 guests