This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Selective warnings


* Geoff Keating (geoffk@cygnus.com) [20000622 04:48]:

> As an alternative, why not simply keep a table of strings or regular
> expressions, and just check each warning against the table before
> printing it?

Hmm yes, that is a viable alternative.

> pushing/popping the warning states could be done by just
> keeping track of the earlier context of the table.
> 
> I would imagine something like 
> 
> "#pragma" "gcc" "nowarn" [ "line" expression ] [ string ]
> 
> where, for instance,
> 
> #pragma gcc nowarn "`t' might be used uninitialized"  

Maybe you misunderstood me. I didn't propose to use the warning message in
the the pragma but the warning option. So your example would look like

"#pragma" "gcc" "nowarn" "uninitialized"
int main(void)
{          
  int t;
  printf ("%d\n", t);
  return 0;
}
 
> - whether the #pragma should match against only the untranslated
> message, or against both.

As I wanted to use the warning option itself, this question would become
moot.

> You would want to keep a per-line table with a hashtable (and a
> whole-program table for when the line is not specified) so that it
> doesn't become too slow to match in programs with thousands of
> #pragmas.
> 
> This flows naturally into a toplevel option like
> --nowarn "implicit declaration" .

Yes, I had something like that in mind. Thanks for your input. Now I'm going
back to the drawing board to do a complete design proposal and then I'll try
and see if it can be implemented like I thought.

Philipp

-- 
Philipp Thomas <pthomas@suse.de>
Development, SuSE GmbH, Schanzaecker Str. 10, D-90443 Nuremberg, Germany

#define NINODE  50              /* number of in core inodes */
#define NPROC   30              /* max number of processes */
 	-- Version 7 UNIX for PDP 11, /usr/include/sys/param.h

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]