]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cpppch.c (cpp_valid_state): Re-add warning about PCH not used because some macro...
authorGeoffrey Keating <geoffk@apple.com>
Wed, 20 Aug 2003 04:04:47 +0000 (04:04 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Wed, 20 Aug 2003 04:04:47 +0000 (04:04 +0000)
2003-08-19  Geoffrey Keating  <geoffk@apple.com>

* cpppch.c (cpp_valid_state): Re-add warning about PCH not used
because some macro is defined.

Index: testsuite/ChangeLog
2003-08-19  Geoffrey Keating  <geoffk@apple.com>

* gcc.dg/pch/warn-1.c: New.
* gcc.dg/pch/warn-1.hs: New.

* lib/dg-pch.exp (dg-pch): Use 'return' not 'continue' to skip
not-tested file.

From-SVN: r70592

gcc/ChangeLog
gcc/cpppch.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pch/warn-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pch/warn-1.hs [new file with mode: 0644]
gcc/testsuite/lib/dg-pch.exp

index 7fbdfdb1f27572ee6eaabc65ab70cf84b3d70b0b..ee82ca1e5e5ec58eef88f4fef2ea3d6f4e11a8f3 100644 (file)
@@ -1,5 +1,8 @@
 2003-08-19  Geoffrey Keating  <geoffk@apple.com>
 
+       * cpppch.c (cpp_valid_state): Re-add warning about PCH not used
+       because some macro is defined.
+
        * config/darwin.h (LINK_COMMAND_SPEC): Add -arch and -arch_only
        options.
        * config/i386/darwin.h (ASM_SPEC): New.
index bdb7d16cfa0a125f114d79126183a181924011ab..e1dc1d710ec35464b0a6615c151dedaa0a4c04aa 100644 (file)
@@ -509,7 +509,13 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
       else if (cmp > 0)
        ++i;
       else
-       goto fail;
+       {
+         if (CPP_OPTION (r, warn_invalid_pch))
+           cpp_error (r, DL_WARNING_SYSHDR, 
+                      "%s: not used because `%s' is defined",
+                      name, first);
+         goto fail;
+       }
     }
    
   free(nl.defs);
index d6e045e58d36ee1535465ad8d2e8769b42c190ea..5554668228b7654be897e0f87a7826eb54f28d87 100644 (file)
@@ -1,3 +1,11 @@
+2003-08-19  Geoffrey Keating  <geoffk@apple.com>
+
+       * gcc.dg/pch/warn-1.c: New.
+       * gcc.dg/pch/warn-1.hs: New.
+
+       * lib/dg-pch.exp (dg-pch): Use 'return' not 'continue' to skip
+       not-tested file.
+
 2003-08-19  Andrew Pinski  <pinskia@physics.uc.edu>
 
        * gcc.dg/uninit-E.c: Add forgotten dg-warning marker.
diff --git a/gcc/testsuite/gcc.dg/pch/warn-1.c b/gcc/testsuite/gcc.dg/pch/warn-1.c
new file mode 100644 (file)
index 0000000..779577d
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-options "-I. -Winvalid-pch" } */
+
+#define DEFINED_VALUE 3
+
+#include "warn-1.h"/* { dg-error "not used because `DEFINED_VALUE' is defined|No such file" } */
+
+int main(void) 
+{
+  return DEFINED_VALUE;
+}
diff --git a/gcc/testsuite/gcc.dg/pch/warn-1.hs b/gcc/testsuite/gcc.dg/pch/warn-1.hs
new file mode 100644 (file)
index 0000000..460963f
--- /dev/null
@@ -0,0 +1,5 @@
+enum {
+  DEFINED_VALUE
+};
+
+
index 9bf39936593a9a82696d5dcbd456e795e299aa00..5ab34ec7bef7c9a788f53c4e629053be58ead63d 100644 (file)
@@ -21,7 +21,7 @@ proc dg-pch { subdir test options suffix } {
 
     # If we're only testing specific files and this isn't one of them, skip it.
     if ![runtest_file_p $runtests $test] {
-       continue
+       return
     }
     set nshort "$subdir/[file tail $test]"
     set bname "[file rootname [file tail $nshort]]"