Page 2 of 3

Re: Harbour warnings

PostPosted: Fri Jun 24, 2022 9:22 pm
by Enrico Maria Giordano
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

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 5:22 am
by cnavarro
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

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 6:49 am
by Antonio Linares
Dear Enrico,

Weren't you a xHarbour user ?

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

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 7:29 am
by Enrico Maria Giordano
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

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 7:32 am
by Enrico Maria Giordano
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

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 7:49 am
by Antonio Linares
very good :-)

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 8:05 am
by Enrico Maria Giordano
But I would like to solve the warning problem...

EMG

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 9:05 am
by Antonio Linares
Dear Enrico,

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

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 12:56 pm
by Enrico Maria Giordano
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
  ACTIVATE DIALOG oDlg;
           ON INIT MSGINFO();
           CENTER


EMG

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 1:05 pm
by Antonio Linares
Dear Enrico,

Have you tried it this way ?

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


or following Harbour rules:

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

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 2:28 pm
by Enrico Maria Giordano
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

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 2:57 pm
by Antonio Linares
Dear Enrico,

What solution do you expect ?

How would that solution should be ?

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 3:19 pm
by nageswaragunupudi
Once we find a solution, we need to implement it in fivewin.ch commands.

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 3:31 pm
by Enrico Maria Giordano
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

Re: Harbour warnings

PostPosted: Sat Jun 25, 2022 3:35 pm
by rhlawek
What Antonio suggests here actually works:

Code: Select all  Expand view

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

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

#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>}] )