Re: [fpc-devel] Howto hide Hint: Parameter "yyy" not used

2008-10-12 Thread Jonas Maebe


On 13 Oct 2008, at 08:16, Jonas Maebe wrote:


On 13 Oct 2008, at 03:37, Paul Ishenin wrote:


Jonas Maebe wrote:


Boys, can you also add similar to delphi {$WARN xxx OFF} / {$WARN  
xxx ON} to use them per unit?


Feel free to file a bug report with a feature request.


Or to submit a patch... (compiler/scandir.pas, I believe there's even  
already a skeleton for this functionality available, search for  
dir_warn or so)



Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Howto hide Hint: Parameter "yyy" not used

2008-10-12 Thread Jonas Maebe


On 13 Oct 2008, at 03:37, Paul Ishenin wrote:


Jonas Maebe wrote:



I've committed a modified version of your patch (mainly extra error  
checking). The parameters now are

-vq to show message numbers
-vm11004,1018 to mask the messages numbered 11004 and 1018
(you cannot put any other -v parameters anymore after -vm this  
way, but I think it's clearer).


Boys, can you also add similar to delphi {$WARN xxx OFF} / {$WARN  
xxx ON} to use them per unit?


Feel free to file a bug report with a feature request.


Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Howto hide Hint: Parameter "yyy" not used

2008-10-12 Thread Paul Ishenin

Jonas Maebe wrote:


Here is another attempt which respects your comments.

Cmdline option:
-vm showns msg numbers in listing
-vm11004m1018 disables showing msg numbers 11004 and 1018


I've committed a modified version of your patch (mainly extra error 
checking). The parameters now are

-vq to show message numbers
-vm11004,1018 to mask the messages numbered 11004 and 1018

(you cannot put any other -v parameters anymore after -vm this way, 
but I think it's clearer).


Boys, can you also add similar to delphi {$WARN xxx OFF} / {$WARN xxx 
ON} to use them per unit?


Best regards,
Paul Ishenin.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Howto hide Hint: Parameter "yyy" not used

2008-10-12 Thread Jonas Maebe


On 08 Oct 2008, at 13:39, [EMAIL PROTECTED] wrote:


Here is another attempt which respects your comments.

Cmdline option:
-vm showns msg numbers in listing
-vm11004m1018 disables showing msg numbers 11004 and 1018


I've committed a modified version of your patch (mainly extra error  
checking). The parameters now are

-vq to show message numbers
-vm11004,1018 to mask the messages numbered 11004 and 1018

(you cannot put any other -v parameters anymore after -vm this way,  
but I think it's clearer).


Thanks for the patch.


Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Howto hide Hint: Parameter "yyy" not used

2008-10-08 Thread petr . kristan
On Wed, Oct 01, 2008 at 08:25:54PM +0200, Jonas Maebe wrote:
> It's a good start, but this patch is not ready to be committed:
> a) it is limited to 10 suppressions
> b) people have to look up the error number in the message file first
> c) if you change the limitation in a), the code will become exponentially 
> slower do to having to go over the entire suppression array every time a 
> message has to be shown
>
> A better approach may be to add a method to TMessage (in the cmsg.pas unit) 
> to clear the verbosity level (replace all verbosity indicators with '_'). 
> And to add an option to the compiler to also show the message number when 
> printing output (so people can use this to get the numbers of the messages 
> they want to suppress).
>
>> But I'am not sure if really realized msgtxt.inc rocket science :). That is 
>> why I do not
>> change fpc help message in the patch.
>
> It is automatically generated from compiler/msg/errore.msg (a plain text 
> file) when you make the compiler. So just a patch to 
> compiler/msg/errore.msg is fine.
Hi 

Here is another attempt which respects your comments.

Cmdline option: 
-vm showns msg numbers in listing
-vm11004m1018 disables showing msg numbers 11004 and 1018

Petr

-- 
Ing. Petr Kristan
.
EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
tel: +420 466335223Czech Republic (Eastern Europe) 
fax: +420 466510709
Index: verbose.pas
===
--- verbose.pas	(revision 11839)
+++ verbose.pas	(working copy)
@@ -74,6 +74,7 @@
 
 const
   msgfilename : string = '';
+  ShowMsgNo : boolean = false;
 
 procedure SetRedirectFile(const fn:string);
 function  SetVerbosity(const s:string):boolean;
@@ -177,7 +178,34 @@
  writeln(status.reportbugfile,'FPC bug report file');
   end;
 
+procedure ClearMessagesVerbosity(const s: string; var i: integer);
+  var
+j, code : integer;
+w: longint;
 
+  begin
+inc(i);
+
+if (s[i]<'0') or (s[i]>'9') then
+begin
+  ShowMsgNo := true;
+  Exit;
+end;
+
+j := i;
+while i<=length(s) do
+begin
+  if (s[i]<'0') or (s[i]>'9') then
+Break;
+  inc(i);
+end;
+val(copy(s, j, i-j), w, code);
+if code=0 then
+  msg^.ClearVerbosity(w);
+
+dec(i);
+  end;
+
 function CheckVerbosity(v:longint):boolean;
   begin
 result:=do_checkverbosity(v);
@@ -296,6 +324,7 @@
else
  status.verbosity:=status.verbosity or V_TimeStamps;
  'V' : PrepareReport;
+ 'M' : ClearMessagesVerbosity(s, i);
  end;
 inc(i);
  end;
@@ -512,6 +541,7 @@
 idx,i,v : longint;
 dostop  : boolean;
 doqueue : boolean;
+s1: ansistring;
   begin
   {Reset}
 dostop:=false;
@@ -520,7 +550,7 @@
   {Parse options}
 idx:=pos('_',s);
 if idx=0 then
- v:=V_Normal
+ v:=V_None
 else
  if (idx >= 1) And (idx <= 5) then
   begin
@@ -598,6 +628,11 @@
 UpdateStatus;
   { Fix replacements }
 DefaultReplacements(s);
+if ShowMsgNo then 
+begin
+  Str(w, s1);
+  s := s1 + ' ' + s;
+end;
 if doqueue then
 begin
   onqueue(s,v,w);
Index: cmsgs.pas
===
--- cmsgs.pas	(revision 11839)
+++ cmsgs.pas	(working copy)
@@ -52,6 +52,7 @@
 procedure ClearIdx;
 procedure CreateIdx;
 function  GetPChar(nr:longint):pchar;
+function  ClearVerbosity(nr:longint):pchar;
 function  Get(nr:longint;const args:array of string):ansistring;
   end;
 
@@ -374,6 +375,14 @@
   GetPChar:=msgidx[nr div 1000]^[nr mod 1000];
 end;
 
+function TMessage.ClearVerbosity(nr:longint):pchar;
+var
+  hp: pchar;
+begin
+  hp := GetPChar(nr);
+  if hp<>nil then
+hp^ := '_';
+end;
 
 function TMessage.Get(nr:longint;const args:array of string):ansistring;
 var
Index: comphook.pas
===
--- comphook.pas	(revision 11839)
+++ comphook.pas	(working copy)
@@ -375,7 +375,7 @@
 function def_CheckVerbosity(v:longint):boolean;
 begin
   result:=status.use_bugreport or
-  ((status.verbosity and (v and V_LevelMask))=(v and V_LevelMask));
+  ((status.verbosity and (v and V_LevelMask))<>0);
 end;
 
 procedure def_initsymbolinfo;
Index: msg/errore.msg
===
--- msg/errore.msg	(revision 11839)
+++ msg/errore.msg	(working copy)
@@ -2754,6 +2754,7 @@
 **2*_b : Write file names messages with full path
 **2*_v : Write fpcdebug.txt with p : Write tree.log with parse tree
 **2*_lots of debugging info
+**2*_m : Don't show msg number . Without  show

Re: [fpc-devel] Howto hide Hint: Parameter "yyy" not used

2008-10-01 Thread Jonas Maebe


On 29 Sep 2008, at 16:50, [EMAIL PROTECTED] wrote:


On Mon, Sep 29, 2008 at 11:49:29AM +0200, Jonas Maebe wrote:



On 29 Sep 2008, at 11:41, Paul Ishenin wrote:


Jonas Maebe ??:
That's just a hack, and you have to regenerate the message file  
for every

new FPC release.


Ofcource, but what can we do simple fpc users ;)


Submit a patch. The message handling code really isn't rocket  
science. It's

pretty much all in compiler/verbose.pas
In the attachment is a little patch. With cmdline option - 
vm05024,05025

you can suppress messages with idx 05024 and 05025.


It's a good start, but this patch is not ready to be committed:
a) it is limited to 10 suppressions
b) people have to look up the error number in the message file first
c) if you change the limitation in a), the code will become  
exponentially slower do to having to go over the entire suppression  
array every time a message has to be shown


A better approach may be to add a method to TMessage (in the cmsg.pas  
unit) to clear the verbosity level (replace all verbosity indicators  
with '_'). And to add an option to the compiler to also show the  
message number when printing output (so people can use this to get the  
numbers of the messages they want to suppress).


But I'am not sure if really realized msgtxt.inc rocket science :).  
That is why I do not

change fpc help message in the patch.


It is automatically generated from compiler/msg/errore.msg (a plain  
text file) when you make the compiler. So just a patch to compiler/msg/ 
errore.msg is fine.


Thanks,


Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Howto hide Hint: Parameter "yyy" not used

2008-09-29 Thread petr . kristan
On Mon, Sep 29, 2008 at 11:49:29AM +0200, Jonas Maebe wrote:

>
> On 29 Sep 2008, at 11:41, Paul Ishenin wrote:
>
>> Jonas Maebe ??:
>>> That's just a hack, and you have to regenerate the message file for every 
>>> new FPC release.
>>
>> Ofcource, but what can we do simple fpc users ;)
>
> Submit a patch. The message handling code really isn't rocket science. It's 
> pretty much all in compiler/verbose.pas
In the attachment is a little patch. With cmdline option -vm05024,05025
you can suppress messages with idx 05024 and 05025.

But I'am not sure if really realized msgtxt.inc rocket science :). That is why 
I do not
change fpc help message in the patch.

Petr

-- 
Ing. Petr Kristan
.
EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice
tel: +420 466335223Czech Republic (Eastern Europe) 
fax: +420 466510709
Index: verbose.pas
===
--- verbose.pas	(revision 11839)
+++ verbose.pas	(working copy)
@@ -68,6 +68,7 @@
 var
   msg : pmessage;
   paraprintnodetree : byte;
+  suppres_messages_array : array [0..9] of longint;
 
 type
   tmsgqueueevent = procedure(s:string;v,w:longint) of object;
@@ -177,7 +178,45 @@
  writeln(status.reportbugfile,'FPC bug report file');
   end;
 
+procedure FillSuppressMessagesArray(const s: string; var i: integer);
+  var
+c : char;
+j, code, idx : integer;
+w: longint;
 
+  procedure InsertW;
+  begin
+val(copy(s, j, i-j), w, code);
+if (code=0) and (idx<=High(suppres_messages_array)) then
+begin
+  suppres_messages_array[idx] := w;
+  inc(idx);
+end;
+j := i + 1;
+  end;
+
+  begin
+inc(i);
+
+idx := 0;
+FillChar(suppres_messages_array, SizeOf(suppres_messages_array), 0);
+
+j := i;
+while i<=length(s) do
+begin
+  case s[i] of
+',': InsertW;
+'0'..'9':;
+  else
+Break;
+  end;
+  inc(i);
+end;
+InsertW;
+
+dec(i);
+  end;
+
 function CheckVerbosity(v:longint):boolean;
   begin
 result:=do_checkverbosity(v);
@@ -296,6 +335,7 @@
else
  status.verbosity:=status.verbosity or V_TimeStamps;
  'V' : PrepareReport;
+ 'M' : FillSuppressMessagesArray(s, i);
  end;
 inc(i);
  end;
@@ -512,6 +552,7 @@
 idx,i,v : longint;
 dostop  : boolean;
 doqueue : boolean;
+showcomment : boolean;
   begin
   {Reset}
 dostop:=false;
@@ -603,8 +644,17 @@
   onqueue(s,v,w);
   exit;
 end;
+  { Check messages suppresion array }
+showcomment := true;
+for i := 0 to High(suppres_messages_array) do 
+  if suppres_messages_array[i] = 0 then
+Break
+  else if suppres_messages_array[i] = w then begin
+showcomment := false;
+Break;
+  end;
   { show comment }
-if do_comment(v,s) or dostop then
+if (showcomment and do_comment(v,s)) or dostop then
   raise ECompilerAbort.Create;
 if (status.errorcount>=status.maxerrorcount) and not status.skip_error then
  begin
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel