* doc/cppopts.texi: Update.
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Jul 2002 16:34:09 +0000 (16:34 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Jul 2002 16:34:09 +0000 (16:34 +0000)
testsuite:
* gcc.dg/cpp/trad/Wunused.c, gcc.dg/cpp/Wunused.c: Add test
for documented behaviour.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55779 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/doc/cppopts.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cpp/Wunused.c
gcc/testsuite/gcc.dg/cpp/trad/Wunused.c

index 2dd43e6..18e8f1c 100644 (file)
@@ -1,5 +1,9 @@
 2002-07-26  Neil Booth  <neil@daikokuya.co.uk>
 
+       * doc/cppopts.texi: Update.
+
+2002-07-26  Neil Booth  <neil@daikokuya.co.uk>
+
        * cppmacro.c (_cpp_create_definition): Don't attempt redefinition
        warnings on assertions.
 
index 24c6edd..27b11cd 100644 (file)
@@ -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.
index ea6ed39..cad29ab 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-26  Neil Booth  <neil@daikokuya.co.uk>
+
+       * gcc.dg/cpp/trad/Wunused.c, gcc.dg/cpp/Wunused.c: Add test
+       for documented behaviour.
+
 2002-07-25  Roger Sayle  <roger@eyesopen.com>
 
        * gcc.c-torture/execute/20020720-1.x: Skip this test on
index f134f55..aa099ee 100644 (file)
 #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
index fd81a27..403d617 100644 (file)
 #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