A problem with warnings

A problem with warnings

Postby Enrico Maria Giordano » Mon Jun 19, 2017 3:01 pm

Compiling this sample:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cVar := SPACE( 35 )

    DEFINE DIALOG oDlg

    @ 1, 1 GET cVar

    ACTIVATE DIALOG oDlg;
             ON INIT MSGINFO();
             CENTER

    RETURN NIL


I get this warning in Harbour and xHarbour:

Code: Select all  Expand view
Harbour 3.2.0dev (r1605041350)
Copyright (c) 1999-2016, http://harbour-project.org/
test.prg(16) Warning W0004  Codeblock parameter 'SELF' declared but not used in function 'MAIN'
 


Code: Select all  Expand view
xHarbour 1.2.3 Intl. (SimpLex) (Build 20170513)
Copyright 1999-2017, http://www.xharbour.org http://www.harbour-project.org/
test.prg(16) Warning W0004  Codeblock parameter: 'SELF' declared but not used in function: 'MAIN'


The problem is /w3 compiler switch that I want to use absolutely. In xHarbour I can use /wb- to avoid that warning but Harbour doesn't support that switch.

Any ideas?

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

Re: A problem with warnings

Postby dagiayunus » Mon Jun 19, 2017 3:46 pm

Dear Encrico

With /w0
I can compile the sample without any warning

Regards
Dagia Yunus.
Rajkot, India

FWH 17.04
dagiayunus
 
Posts: 69
Joined: Wed Nov 19, 2014 1:04 pm

Re: A problem with warnings

Postby Enrico Maria Giordano » Mon Jun 19, 2017 4:59 pm

Thank you, but you missed the point: I do want to use /w3.

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

Re: A problem with warnings

Postby James Bott » Mon Jun 19, 2017 8:51 pm

Enrico,

Maybe change this line:

@ 1, 1 GET cVar

To this:

@ 1, 1 GET cVar of oDlg

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: A problem with warnings

Postby Enrico Maria Giordano » Mon Jun 19, 2017 8:58 pm

No, this is a reduced sample still showing the problem:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    ACTIVATE DIALOG oDlg;
             ON INIT MSGINFO();
             CENTER

    RETURN NIL


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

Re: A problem with warnings

Postby Enrico Maria Giordano » Mon Jun 19, 2017 9:02 pm

The warning come from the codeblock

Code: Select all  Expand view
{|Self|<uInit>}


and all the other similar codeblock where we don't use all the parameters.

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

Re: A problem with warnings

Postby James Bott » Tue Jun 20, 2017 2:41 pm

Enrico,

It seems that this is a valid warning, is it not? Or, are you just not wanting to see it regardless?

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: A problem with warnings

Postby Enrico Maria Giordano » Tue Jun 20, 2017 2:45 pm

Yes, exactly (see my first post in this thread).

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

Re: A problem with warnings

Postby aferra » Tue Jun 20, 2017 3:29 pm

I found in the warning.txt in the xhb folder.

WARNING for XHB contrib users
=============================

This contrib is deprecated and not maintained anymore.

This was originally meant as a temporary stop-gap solution to help migrating
existing code written for xHarbour to Harbour, plus a means of documenting
the differences between the these two branches of the language. The
recommended path is to gradually migrate to use native core Harbour functions
and core language elements, then finalize that process by dropping the need
for this library.

Linking this library and/or using its headers (`hbcompat.ch` and `xhb.ch` in
particular) may cause various unintended side-effects both at compilation
and runtime.

Most of this code is also never tested by this fork, and none of it is ever
used, so the chances of bugs is higher than in other parts of Harbour.

If you can't do without some parts of this code, feel free to fork it locally
or publicly and continue maintaining it there, otherwise try switching to
core Harbour functionality ASAP.

-Viktor
aferra
 
Posts: 88
Joined: Wed Apr 28, 2010 6:34 pm

Re: A problem with warnings

Postby Enrico Maria Giordano » Tue Jun 20, 2017 3:39 pm

Thank you, but I can't see how this can be of any help regarding my problem.

I repeat: I need to use /w3 warning level switch but I don't want to see all that warnings originated by codeblocks parameters (that belong to FWH and are out of my control). I use /wb- with xHarbour, how can I get the same result with Harbour?

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

Re: A problem with warnings

Postby karinha » Tue Jun 20, 2017 8:31 pm

/es[<level>] set exit severity
/w[<level>] set warning level number (0..3, default 1)


Strange, it only works this way.


Code: Select all  Expand view

   /m /n /w1 /es2
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7154
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: A problem with warnings

Postby rhlawek » Wed Jun 21, 2017 1:05 am

Enrico,

I have a couple modules where I haven't figured out what to change in the code to suppress certain warnings. I found that in harbour I can use #pragma to suppress the warning locally within the problem files.

#pragma WARNINGLEVEL = 3 // or whatever
#pragma ENABLEWARNINGS = OFF/ON

Robb
User avatar
rhlawek
 
Posts: 193
Joined: Sun Jul 22, 2012 7:01 pm

Re: A problem with warnings

Postby Enrico Maria Giordano » Wed Jun 21, 2017 7:29 am

Thank you, but I don't know how to suppress codeblock parameters warning in Harbour, even using compiler switches. In xHarbour I'm using /wb- but Harbour doesn't support it.

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

Re: A problem with warnings

Postby rhlawek » Wed Jun 21, 2017 3:44 pm

I don't know how to do it with a command line switch either, but with the pragmas I noted this will suppress the message for the specific section of effected code. Depending on code organization this can be a hassle to add, but does this not do what you want?

#pragma WARNINGLEVEL = 1

ACTIVATE DIALOG oDlg;
ON INIT MSGINFO();
CENTER

#pragma WARNINGLEVEL = 3
User avatar
rhlawek
 
Posts: 193
Joined: Sun Jul 22, 2012 7:01 pm

Re: A problem with warnings

Postby rhlawek » Wed Jun 21, 2017 4:00 pm

Using your sample, this shows exactly how I have been dealing with this in my own code.

Code: Select all  Expand view

#include "Fivewin.ch"

#translate SUPPRESS_WARNING => #pragma WARNINGLEVEL = 1
#translate RESTORE_WARNING  => #pragma WARNINGLEVEL = 3

FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cVar := SPACE( 35 )

    DEFINE DIALOG oDlg

    @ 1, 1 GET cVar

   SUPPRESS_WARNING

   ACTIVATE DIALOG oDlg;
            ON INIT MSGINFO();
            CENTER

   RESTORE_WARNING

   RETURN NIL
 
User avatar
rhlawek
 
Posts: 193
Joined: Sun Jul 22, 2012 7:01 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 17 guests