gcc
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 May 2008 22:17:00 +0000 (22:17 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 May 2008 22:17:00 +0000 (22:17 +0000)
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.

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

gcc/ChangeLog
gcc/c-opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr22231.c [new file with mode: 0644]

index 12105fe..3d1e78a 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-09  Tom Tromey  <tromey@redhat.com>
+
+       PR preprocessor/22231:
+       * c-opts.c (sanitize_cpp_opts): Disallow -MG if compilation is
+       proceeding.
+
 2008-05-09  Uros Bizjak  <ubizjak@gmail.com>
 
        PR tree-optimization/36129
index 1413b7f..eda0f48 100644 (file)
@@ -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;
index 531df9f..0195eab 100644 (file)
@@ -1,3 +1,8 @@
+2008-05-09  Tom Tromey  <tromey@redhat.com>
+
+       PR preprocessor/22231:
+       * gcc.dg/pr22231.c: New file.
+
 2008-05-09  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/36187
diff --git a/gcc/testsuite/gcc.dg/pr22231.c b/gcc/testsuite/gcc.dg/pr22231.c
new file mode 100644 (file)
index 0000000..cca27c6
--- /dev/null
@@ -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;