Harbour warning

Harbour warning

Postby Enrico Maria Giordano » Sat Mar 30, 2013 5:38 pm

Dear friends, how do you compile the following sample using Harbour?

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


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    ACTIVATE DIALOG oDlg;
             ON INIT MSGINFO( "Hello" );
             CENTER

    RETURN NIL


I get:

Code: Select all  Expand view  RUN
test.prg(12) Warning W0004  Codeblock parameter 'SELF' declared but not used
in function 'MAIN'


and I cannot found a way to disable that warning (with xHarbour you can use /wb-).

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

Re: Harbour warning

Postby James Bott » Sat Mar 30, 2013 6:23 pm

Enrico,

In Windows.ch you will see:

<oWnd>:bInit [ := \{ | Self | <uInit> \} ],;

But in Dialog.ch INIT is processed like this:

[ ! <.NonModal.> ], [{|Self|<uInit>}],;

I understand that dialogs can be nonmodal and windows can't so there has to be a difference, but perhaps there is a syntax error in the preprosser code.

I have never tried a dialog with an INIT clause, and I don't use Harbour so I can't test it.

Have you tried instead:

oDlg:bInit:= {|| MSGINFO( "Hello" )}

Or:

oDlg:bInit:= { | oDlg | msgInfo("Hello")}


Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Harbour warning

Postby Enrico Maria Giordano » Sat Mar 30, 2013 7:20 pm

James, this is only a sample. There are tons of other similar warnings when I compile my code using Harbour. The problem would be solved in my code if I used Self in the ON INIT clause but I don't always need Self and I don't want to be forced to use all the codeblock parameters.

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

Re: Harbour warning

Postby ADutheil » Sat Mar 30, 2013 8:06 pm

I got rid of theses warnings by using bInit codeblock

Code: Select all  Expand view  RUN

DEFINE DIALOG oDlg
oDlg:binit := { || whatever_you_need }
ACTIVATE DIALOG oDlg
 
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Harbour warning

Postby James Bott » Sat Mar 30, 2013 10:05 pm

Enrico Maria Giordano wrote:The problem would be solved in my code if I used Self in the ON INIT clause but I don't always need Self and I don't want to be forced to use all the codeblock parameters.
EMG


Then, I would suggest trying to find a fix by modifying the dialog.ch file using the windows.ch file as a reference.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Harbour warning

Postby Antonio Linares » Sat Mar 30, 2013 10:56 pm

Enrico,

I have asked it in the Harbour devel list, so lets wait for an answer :-)

https://groups.google.com/forum/?fromgroups=#!topic/harbour-devel/_07abkqyoa8
regards, saludos

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

Re: Harbour warning

Postby Enrico Maria Giordano » Sat Mar 30, 2013 11:49 pm

Thank you, Master! :-)

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

Re: Harbour warning

Postby Antonio Linares » Sun Mar 31, 2013 4:49 am

Enrico,

See what Viktor says:

"No, the closest is -w2."
regards, saludos

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

Re: Harbour warning

Postby nageswaragunupudi » Sun Mar 31, 2013 5:50 am

In both Harbour and xHarbour setting warning level to 2 ( -w2 ) generates warnings for variables declared but not used.

Again both in Harbour and xHarbour setting warning level to 1 ( -w1 ) does not generate these warnings.

So, normally I use -w1 and use -w2 occasionally for the purpose of removing unwanted declarations in the code.

I find both Harbour and xHarbour behaving the same way. Am I missing something?
Regards

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

Re: Harbour warning

Postby Enrico Maria Giordano » Sun Mar 31, 2013 10:24 am

Antonio Linares wrote:Enrico,

See what Viktor says:

"No, the closest is -w2."


With -w2 I still get the unused parameter warnings. Only using -w (or the equivalent -w1) I don't the the warnings. :-(

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

Re: Harbour warning

Postby Enrico Maria Giordano » Sun Mar 31, 2013 10:24 am

nageswaragunupudi wrote:In both Harbour and xHarbour setting warning level to 2 ( -w2 ) generates warnings for variables declared but not used.

Again both in Harbour and xHarbour setting warning level to 1 ( -w1 ) does not generate these warnings.

So, normally I use -w1 and use -w2 occasionally for the purpose of removing unwanted declarations in the code.

I find both Harbour and xHarbour behaving the same way. Am I missing something?


xHarbour offers -wb- to disable unused codeblock parameters warning.

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

Re: Harbour warning

Postby Enrico Maria Giordano » Sun Mar 31, 2013 10:26 am

As I'm not willing to reduce my level of warnings, I simply can't use Harbour. :-(

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

Re: Harbour warning

Postby Antonio Linares » Sun Mar 31, 2013 3:57 pm

Enrico,

You could compile first with xHarbour and then recompile with Harbour. A weird solution but it is a solution :-)
regards, saludos

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

Re: Harbour warning

Postby Enrico Maria Giordano » Sun Mar 31, 2013 5:07 pm

Antonio Linares wrote:Enrico,

You could compile first with xHarbour and then recompile with Harbour. A weird solution but it is a solution :-)


Thank you Master! For a while, it can be an acceptable solution, in order to try Harbour. :-)

But please, can you insist with the Harbour developers if they could add something like xHarbour's /wb-? :-)

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 37 guests