This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [warnings] attribs.c


On Wed, 4 May 2005, DJ Delorie wrote:

> For this file, there are three warnings which weren't previously
> controllable at all.  I've lumped them all into a single new
> default-enabled warning for now.

Where a new option is added there should be a testcase added as well.  In 
this case, it should be that -Wno-attributes disables the warning for a 
case where we already test that the warning is on by default (or a pair of 
tests, one making sure it is on by default and another making sure the 
option disables it for the same code - but all the warnings covered in 
this patch are exercised by at least one existing test, so you could 
choose the same attributes for the new test).  I.e., the testsuite should 
demonstrate that the option -Wno-attributes has some effect.  Where an 
existing option is split into two (or more), the tests should demonstrate 
the each subset option enables its subset of the warnings and not the 
other subset (i.e., that the options have an effect, that it is the 
desired effect and that their effects are distinct).

If all that is changed in a particular case is that control of a warning 
is moved from an "if" condition to an argument to "warning", and there is 
already a test for that warning option, then new tests shouldn't be 
needed.  If the control is changed for a warning option with no tests at 
all then I think a testcase should be added (which passes before and after 
the patch, to demonstrate the patch hasn't broken that option).

> @item -Wno-attributes
> @opindex Wno-attributes
> @opindex Wattributes
> Do not warn if an unexpected @code{__attribute__} is used, such as
> unrecognized attributes, function attributes applied to variables,
> etc.  This will not stop errors for incorrect use of supported
> attributes.

It will not stop errors for incorrect use of supported attributes, but 
will stop warnings for such use?  (Since function attributes applied to 
variables is an example of incorrect use of existing attributes.)  Not 
that we are at all consistent between errors and warnings in this regard.

My view is that all diagnostics for attributes should have their control 
changed together (including all target attribute handlers and all C and 
C++ front end attributes).  This would make this patch big enough to be 
considered on its own.  Given the pre-existing limited extent of testcases 
for diagnostics for bad uses of attributes, I don't think tests are needed 
for each warning as part of this patch, just spot tests that 
-Wno-attributes disables warnings in some particular cases.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


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