From: Neil Booth Date: Fri, 26 Jul 2002 16:34:09 +0000 (+0000) Subject: cppopts.texi: Update. X-Git-Tag: releases/gcc-3.3.0~3617 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b41f25cf9230b2da678db75eb495a4bd9bd5e137;p=thirdparty%2Fgcc.git cppopts.texi: Update. * doc/cppopts.texi: Update. testsuite: * gcc.dg/cpp/trad/Wunused.c, gcc.dg/cpp/Wunused.c: Add test for documented behaviour. From-SVN: r55779 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2dd43e6fe0f2..18e8f1cdd152 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2002-07-26 Neil Booth + + * doc/cppopts.texi: Update. + 2002-07-26 Neil Booth * cppmacro.c (_cpp_create_definition): Don't attempt redefinition diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi index 24c6edd238d6..27b11cde2613 100644 --- a/gcc/doc/cppopts.texi +++ b/gcc/doc/cppopts.texi @@ -120,6 +120,17 @@ time it is redefined or undefined. Built-in macros, macros defined on the command line, and macros defined in include files are not warned about. +@strong{Note:} If a macro is actually used, but only used in skipped +conditional blocks, then CPP will report it as unused. To avoid the +warning in such a case, you might improve the scope of the macro's +definition by, for example, moving it into the first skipped block. +Alternatively, you could provide a dummy use with something like: + +@smallexample +#if defined the_macro_causing_the_warning +#endif +@end smallexample + @item -Wendif-labels @opindex Wendif-labels Warn whenever an @samp{#else} or an @samp{#endif} are followed by text. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ea6ed3934201..cad29abf7be4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-07-26 Neil Booth + + * gcc.dg/cpp/trad/Wunused.c, gcc.dg/cpp/Wunused.c: Add test + for documented behaviour. + 2002-07-25 Roger Sayle * gcc.c-torture/execute/20020720-1.x: Skip this test on diff --git a/gcc/testsuite/gcc.dg/cpp/Wunused.c b/gcc/testsuite/gcc.dg/cpp/Wunused.c index f134f55a1594..aa099ee79c8c 100644 --- a/gcc/testsuite/gcc.dg/cpp/Wunused.c +++ b/gcc/testsuite/gcc.dg/cpp/Wunused.c @@ -26,7 +26,12 @@ #endif used4 -unused7 +unused7 /* This does not count as a use. */ + +#if 0 +unused5 /* This does not count as a use. */ +#endif #undef unused5 + #define unused6 unused6 diff --git a/gcc/testsuite/gcc.dg/cpp/trad/Wunused.c b/gcc/testsuite/gcc.dg/cpp/trad/Wunused.c index fd81a27ecc7c..403d617f5d06 100644 --- a/gcc/testsuite/gcc.dg/cpp/trad/Wunused.c +++ b/gcc/testsuite/gcc.dg/cpp/trad/Wunused.c @@ -26,6 +26,12 @@ #endif used4 +unused7; /* This does not count as a use. */ + +#if 0 +unused5 /* This does not count as a use. */ +#endif + #undef unused5 #define unused6 unused6