From ccc014442a6731846c6e852a8ebbdc889d5c113b Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Wed, 20 Aug 2003 04:04:47 +0000 Subject: [PATCH] cpppch.c (cpp_valid_state): Re-add warning about PCH not used because some macro is defined. 2003-08-19 Geoffrey Keating * 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 * 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 | 3 +++ gcc/cpppch.c | 8 +++++++- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/pch/warn-1.c | 10 ++++++++++ gcc/testsuite/gcc.dg/pch/warn-1.hs | 5 +++++ gcc/testsuite/lib/dg-pch.exp | 2 +- 6 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pch/warn-1.c create mode 100644 gcc/testsuite/gcc.dg/pch/warn-1.hs diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7fbdfdb1f27..ee82ca1e5e5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2003-08-19 Geoffrey Keating + * 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. diff --git a/gcc/cpppch.c b/gcc/cpppch.c index bdb7d16cfa0..e1dc1d710ec 100644 --- a/gcc/cpppch.c +++ b/gcc/cpppch.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d6e045e58d3..5554668228b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2003-08-19 Geoffrey Keating + + * 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 * 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 index 00000000000..779577dd8ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/pch/warn-1.c @@ -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 index 00000000000..460963f56c1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pch/warn-1.hs @@ -0,0 +1,5 @@ +enum { + DEFINED_VALUE +}; + + diff --git a/gcc/testsuite/lib/dg-pch.exp b/gcc/testsuite/lib/dg-pch.exp index 9bf39936593..5ab34ec7bef 100644 --- a/gcc/testsuite/lib/dg-pch.exp +++ b/gcc/testsuite/lib/dg-pch.exp @@ -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]]" -- 2.30.2