From 4822e563a0bb9ba66af37440964d8d1ad403710f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 9 May 2008 22:17:00 +0000 Subject: [PATCH] re PR preprocessor/22231 (-MG ignores missing headers even with -c) gcc PR preprocessor/22231: * c-opts.c (sanitize_cpp_opts): Disallow -MG if compilation is proceeding. gcc/testsuite PR preprocessor/22231: * gcc.dg/pr22231.c: New file. From-SVN: r135128 --- gcc/ChangeLog | 6 ++++++ gcc/c-opts.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr22231.c | 7 +++++++ 4 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr22231.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 12105febf46..3d1e78add32 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-05-09 Tom Tromey + + PR preprocessor/22231: + * c-opts.c (sanitize_cpp_opts): Disallow -MG if compilation is + proceeding. + 2008-05-09 Uros Bizjak PR tree-optimization/36129 diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 1413b7f8036..eda0f48f949 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -1427,6 +1427,8 @@ sanitize_cpp_opts (void) flag_dump_includes = 0; flag_no_line_commands = 1; } + else if (cpp_opts->deps.missing_files) + error ("-MG may only be used with -M or -MM"); cpp_opts->unsigned_char = !flag_signed_char; cpp_opts->stdc_0_in_system_headers = STDC_0_IN_SYSTEM_HEADERS; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 531df9fe646..0195eab05b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-09 Tom Tromey + + PR preprocessor/22231: + * gcc.dg/pr22231.c: New file. + 2008-05-09 Richard Guenther PR tree-optimization/36187 diff --git a/gcc/testsuite/gcc.dg/pr22231.c b/gcc/testsuite/gcc.dg/pr22231.c new file mode 100644 index 00000000000..cca27c66f5b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr22231.c @@ -0,0 +1,7 @@ +/* Test case for PR 22231. -c and -MG are invalid together. */ + +/* { dg-do compile } */ +/* { dg-options "-MG -MD -c" } */ +/* { dg-error "may only be used with -M" "" 0 */ + +int anything; -- 2.30.2