]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libcpp: Improve location for macro names [PR66290]
authorLewis Hyatt <lhyatt@gmail.com>
Wed, 3 Aug 2022 14:46:23 +0000 (10:46 -0400)
committerLewis Hyatt <lhyatt@gmail.com>
Tue, 20 Jun 2023 20:58:12 +0000 (16:58 -0400)
When libcpp reports diagnostics whose locus is a macro name (such as for
-Wunused-macros), it uses the location in the cpp_macro object that was
stored by _cpp_new_macro. This is currently set to pfile->directive_line,
which contains the line number only and no column information. This patch
changes the stored location to the src_loc for the token defining the macro
name, which includes the location and range information.

libcpp/ChangeLog:

PR c++/66290
* macro.cc (_cpp_create_definition): Add location argument.
* internal.h (_cpp_create_definition): Adjust prototype.
* directives.cc (do_define): Pass new location argument to
_cpp_create_definition.
(do_undef): Stop passing inferior location to cpp_warning_with_line;
the default from cpp_warning is better.
(cpp_pop_definition): Pass new location argument to
_cpp_create_definition.
* pch.cc (cpp_read_state): Likewise.

gcc/testsuite/ChangeLog:

PR c++/66290
* c-c++-common/cpp/macro-ranges.c: New test.
* c-c++-common/cpp/line-2.c: Adapt to check for column information
on macro-related libcpp warnings.
* c-c++-common/cpp/line-3.c: Likewise.
* c-c++-common/cpp/macro-arg-count-1.c: Likewise.
* c-c++-common/cpp/pr58844-1.c: Likewise.
* c-c++-common/cpp/pr58844-2.c: Likewise.
* c-c++-common/cpp/warning-zero-location.c: Likewise.
* c-c++-common/pragma-diag-14.c: Likewise.
* c-c++-common/pragma-diag-15.c: Likewise.
* g++.dg/modules/macro-2_d.C: Likewise.
* g++.dg/modules/macro-4_d.C: Likewise.
* g++.dg/modules/macro-4_e.C: Likewise.
* g++.dg/spellcheck-macro-ordering.C: Likewise.
* gcc.dg/builtin-redefine.c: Likewise.
* gcc.dg/cpp/Wunused.c: Likewise.
* gcc.dg/cpp/redef2.c: Likewise.
* gcc.dg/cpp/redef3.c: Likewise.
* gcc.dg/cpp/redef4.c: Likewise.
* gcc.dg/cpp/ucnid-11-utf8.c: Likewise.
* gcc.dg/cpp/ucnid-11.c: Likewise.
* gcc.dg/cpp/undef2.c: Likewise.
* gcc.dg/cpp/warn-redefined-2.c: Likewise.
* gcc.dg/cpp/warn-redefined.c: Likewise.
* gcc.dg/cpp/warn-unused-macros-2.c: Likewise.
* gcc.dg/cpp/warn-unused-macros.c: Likewise.

29 files changed:
gcc/testsuite/c-c++-common/cpp/line-2.c
gcc/testsuite/c-c++-common/cpp/line-3.c
gcc/testsuite/c-c++-common/cpp/macro-arg-count-1.c
gcc/testsuite/c-c++-common/cpp/macro-ranges.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/cpp/pr58844-1.c
gcc/testsuite/c-c++-common/cpp/pr58844-2.c
gcc/testsuite/c-c++-common/cpp/warning-zero-location.c
gcc/testsuite/c-c++-common/pragma-diag-14.c
gcc/testsuite/c-c++-common/pragma-diag-15.c
gcc/testsuite/g++.dg/modules/macro-2_d.C
gcc/testsuite/g++.dg/modules/macro-4_d.C
gcc/testsuite/g++.dg/modules/macro-4_e.C
gcc/testsuite/g++.dg/spellcheck-macro-ordering.C
gcc/testsuite/gcc.dg/builtin-redefine.c
gcc/testsuite/gcc.dg/cpp/Wunused.c
gcc/testsuite/gcc.dg/cpp/redef2.c
gcc/testsuite/gcc.dg/cpp/redef3.c
gcc/testsuite/gcc.dg/cpp/redef4.c
gcc/testsuite/gcc.dg/cpp/ucnid-11-utf8.c
gcc/testsuite/gcc.dg/cpp/ucnid-11.c
gcc/testsuite/gcc.dg/cpp/undef2.c
gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c
gcc/testsuite/gcc.dg/cpp/warn-redefined.c
gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c
gcc/testsuite/gcc.dg/cpp/warn-unused-macros.c
libcpp/directives.cc
libcpp/internal.h
libcpp/macro.cc
libcpp/pch.cc

index 364ad0e39318871ffb282fa0612c330aa029bd79..3ce2334087100fe813b2810f4b75a9028e59b4f7 100644 (file)
@@ -8,4 +8,4 @@ int line4;
 
 // { dg-regexp {In file included from <command-line>:\n[^\n]*/line-2.h:4:2: error: #error wrong\n} }
 
-// { dg-regexp {[^\n]*/line-2.c:3:11: error: macro "bill" passed 1 arguments, but takes just 0\n[^\n]*/line-2.h:3: note: macro "bill" defined here\n} }
+// { dg-regexp {[^\n]*/line-2.c:3:11: error: macro "bill" passed 1 arguments, but takes just 0\n[^\n]*/line-2.h:3:9: note: macro "bill" defined here\n} }
index b254ae400419c1cf6d07698c95621eea2854b620..b067292375608e90119e4a0fd74cdd19413648ce 100644 (file)
@@ -15,6 +15,6 @@ int line4;
 
 // { dg-regexp {In file included from <command-line>:\n[^\n]*/line-2.h:4:2: error: #error wrong\n} }
 
-// { dg-regexp {[^\n]*/line-3.c:3:11: error: macro "bill" passed 1 arguments, but takes just 0\n[^\n]*/line-2.h:3: note: macro "bill" defined here\n} }
+// { dg-regexp {[^\n]*/line-3.c:3:11: error: macro "bill" passed 1 arguments, but takes just 0\n[^\n]*/line-2.h:3:9: note: macro "bill" defined here\n} }
 
 // { dg-options "-fpreprocessed -fdirectives-only" }
index 7773c47e76520cc4a2a60311c026cfb424fa4bfa..103e88ecd4dd72c6fe6998146b07aca8a6b0d02d 100644 (file)
@@ -9,7 +9,7 @@ void test_1 ()
    MACRO_1(42);
              ^
      { dg-end-multiline-output "" } */
-  /* { dg-message "-: macro .MACRO_1. defined here" "" { target *-*-* } def_of_MACRO_1 }
+  /* { dg-message "macro .MACRO_1. defined here" "" { target *-*-* } def_of_MACRO_1 }
   /* { dg-begin-multiline-output "" }
  #define MACRO_1(X,Y)
  
@@ -33,7 +33,7 @@ void test_2 ()
    MACRO_2(1, 2, 3);
                   ^
      { dg-end-multiline-output "" } */
-  /* { dg-message "-: macro .MACRO_2. defined here" "" { target *-*-* } def_of_MACRO_2 }
+  /* { dg-message "macro .MACRO_2. defined here" "" { target *-*-* } def_of_MACRO_2 }
   /* { dg-begin-multiline-output "" }
  #define MACRO_2(X,Y)
  
diff --git a/gcc/testsuite/c-c++-common/cpp/macro-ranges.c b/gcc/testsuite/c-c++-common/cpp/macro-ranges.c
new file mode 100644 (file)
index 0000000..72b026f
--- /dev/null
@@ -0,0 +1,52 @@
+/* { dg-do preprocess } */
+/* { dg-additional-options "-fdiagnostics-show-caret -Wunused-macros -Wbuiltin-macro-redefined" } */
+
+/* Verify that we output range information for diagnostics involving
+   macro definitions.  */
+
+#undef __TIME__ /* { dg-warning {undefining "__TIME__"} } */
+/* { dg-begin-multiline-output "" }
+ #undef __TIME__
+        ^~~~~~~~
+/* { dg-end-multiline-output "" } */
+
+#define XYZ 123 /* { dg-warning {macro "XYZ" is not used} } */
+/* { dg-begin-multiline-output "" }
+ #define XYZ 123
+         ^~~
+/* { dg-end-multiline-output "" } */
+
+#define MACRO initial_definition /* { dg-line def_line } */
+
+/* This locus is output first for the unused warning... */
+/* { dg-warning {macro "MACRO" is not used} "" { target *-*-* } def_line } */
+/* { dg-begin-multiline-output "" }
+ #define MACRO initial_definition
+         ^~~~~
+/* { dg-end-multiline-output "" } */
+
+/* ...then a second time for the redefinition warning.  */
+/* { dg-note {this is the location of the previous definition} "" { target *-*-* } def_line } */
+/* { dg-begin-multiline-output "" }
+ #define MACRO initial_definition
+         ^~~~~
+/* { dg-end-multiline-output "" } */
+
+#define MACRO /* { dg-warning {"MACRO" redefined} } */
+/* { dg-begin-multiline-output "" }
+ #define MACRO
+         ^~~~~
+{ dg-end-multiline-output "" } */
+
+#define MACRO2(x,y) x /* { dg-note {macro "MACRO2" defined here} } */
+/* { dg-begin-multiline-output "" }
+ #define MACRO2(x,y)
+         ^~~~~~
+{ dg-end-multiline-output "" } */
+
+MACRO2(MACRO, MACRO)
+MACRO2(MACRO) /* { dg-error {macro "MACRO2" requires 2 arguments, but only 1 given} } */
+/* { dg-begin-multiline-output "" }
+ MACRO2(MACRO)
+             ^
+{ dg-end-multiline-output "" } */
index 2a2e277b0fcbc6a672ea813d3923a1bb4dd83409..3abf8a768035ae4ee28333f155423918022826d6 100644 (file)
@@ -4,5 +4,5 @@
 
 #define A x######x
 int A = 1;
-#define A x######x     /* { dg-message "-:previous definition" } */
-#define A x##x         /* { dg-warning "-:redefined" } */
+#define A x######x     /* { dg-message "previous definition" } */
+#define A x##x         /* { dg-warning "redefined" } */
index 52993b314be9599fccfa8922fa6ba309e699db51..1e219152fc5d761b59508cee75a622b16d3f370d 100644 (file)
@@ -4,5 +4,5 @@
 
 #define A x######x
 int A = 1;
-#define A x######x     /* { dg-message "-:previous definition" } */
-#define A x##x         /* { dg-warning "-:redefined" } */
+#define A x######x     /* { dg-message "previous definition" } */
+#define A x##x         /* { dg-warning "redefined" } */
index 57544b6aff13b1c05d7f1a8b67fa5ae78b5b03a9..2b9c9a9521715fa9118ecb6aeebe16410612a5d6 100644 (file)
@@ -3,6 +3,6 @@
    { dg-do compile }
  */
 
-#define _GNU_SOURCE    /* { dg-warning "-:redefined" } */
+#define _GNU_SOURCE    /* { dg-warning "redefined" } */
 
 /* { dg-message "" "#define _GNU_SOURCE" {target *-*-* } 0 } */
index 618e7e1ef274efd25320614e529cdf5eff236f21..45dc4a38c5c03acc7797ae8e2fd8fd0268b2e49c 100644 (file)
@@ -5,5 +5,5 @@
    location was not tracked properly with -E or -save-temps; check that it works
    now.  */
 
-#define X /* { dg-warning "-:-Wunused-macros" } */
+#define X /* { dg-warning "-Wunused-macros" } */
 #pragma GCC diagnostic ignored "-Wunused-macros"
index 8ffff88d5e35395963f2f8e39d616e97360d70c7..5cb8c356ed6124fb502433091b3b5b4b5864910d 100644 (file)
@@ -9,5 +9,5 @@
    because the location of the macro definition is incorrectly set.  This is a
    separate issue, will resolve it in a later patch.  */
 
-#define X /* { dg-warning "-:-Wunused-macros" } */
+#define X /* { dg-warning "-Wunused-macros" } */
 #pragma GCC diagnostic ignored "-Wunused-macros"
index 04b80fb30585f3e611dbcbf1dbb5415808f9db82..e78fc7cbb0d4249dab2bb9caa74c7aedf3d50025 100644 (file)
@@ -8,7 +8,7 @@ import "macro-2_b.H";
 int FOO_OK = BAR_OK(1);
 
 int BAR_BAD;
-// { dg-regexp {[^\n]*macro-2_d.C:10:5: error: inconsistent imported macro definition 'BAR_BAD'\nIn module [^\n]*macro-2_a.H, imported at [^\n]*macro-2_d.C:5:\n[^\n]*macro-2_a.H:11: note: '#define BAR_BAD\(BAZ\) BINKY\(2\)'\nIn module [^\n]*macro-2_b.H, imported at [^\n]*macro-2_d.C:6:\n[^\n]*macro-2_b.H:21: note: '#define BAR_BAD\(BAZ\) BINKY\(3\)'\n} }
+// { dg-regexp {[^\n]*macro-2_d.C:10:5: error: inconsistent imported macro definition 'BAR_BAD'\nIn module [^\n]*macro-2_a.H, imported at [^\n]*macro-2_d.C:5:\n[^\n]*macro-2_a.H:11:9: note: '#define BAR_BAD\(BAZ\) BINKY\(2\)'\nIn module [^\n]*macro-2_b.H, imported at [^\n]*macro-2_d.C:6:\n[^\n]*macro-2_b.H:21:9: note: '#define BAR_BAD\(BAZ\) BINKY\(3\)'\n} }
 
 int FOO_BAD;
-// { dg-regexp {[^\n]*macro-2_d.C:13:5: error: inconsistent imported macro definition 'FOO_BAD'\nIn module [^\n]*macro-2_a.H, imported at [^\n]*macro-2_d.C:5:\n[^\n]*macro-2_a.H:10: note: '#define FOO_BAD foo'\nIn module [^\n]*macro-2_b.H, imported at [^\n]*macro-2_d.C:6:\n[^\n]*macro-2_b.H:20: note: '#define FOO_BAD foot'\n} }
+// { dg-regexp {[^\n]*macro-2_d.C:13:5: error: inconsistent imported macro definition 'FOO_BAD'\nIn module [^\n]*macro-2_a.H, imported at [^\n]*macro-2_d.C:5:\n[^\n]*macro-2_a.H:10:9: note: '#define FOO_BAD foo'\nIn module [^\n]*macro-2_b.H, imported at [^\n]*macro-2_d.C:6:\n[^\n]*macro-2_b.H:20:9: note: '#define FOO_BAD foot'\n} }
index bff9494281bd7bc8694dbe9093a19a5d17b852df..d9c08ce16be1de3b9639b37b4c06d366232eebff 100644 (file)
@@ -3,6 +3,6 @@
 import "macro-4_b.H";
 import "macro-4_a.H";
 
-// { dg-regexp {[^\n]*macro-4_d.C: warning: inconsistent imported macro definition 'TWO' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*: note: .#define TWO 2a.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*: note: .#define TWO 2.\n} }
+// { dg-regexp {[^\n]*macro-4_d.C: warning: inconsistent imported macro definition 'TWO' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*:[0-9]*: note: .#define TWO 2a.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*:[0-9]*: note: .#define TWO 2.\n} }
 
-// { dg-regexp {[^\n]*macro-4_d.C: warning: inconsistent imported macro definition 'THREE' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*: note: .#define THREE 3b.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*: note: .#define THREE 3.\n} }
+// { dg-regexp {[^\n]*macro-4_d.C: warning: inconsistent imported macro definition 'THREE' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*:[0-9]*: note: .#define THREE 3b.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_d.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*:[0-9]*: note: .#define THREE 3.\n} }
index 38fa6c7feebe0d9ec1c41aadd772d5bbf713e2aa..392387f3a1c9e96d72da4c5a4f32509bde08cdbe 100644 (file)
@@ -10,4 +10,4 @@ int stop;
 #error bah!
 #endif
 
-// { dg-regexp {[^\n]*macro-4_e.C: warning: inconsistent imported macro definition 'TWO' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_e.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*: note: .#define TWO 2a.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_e.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*: note: .#define TWO 2.\n} }
+// { dg-regexp {[^\n]*macro-4_e.C: warning: inconsistent imported macro definition 'TWO' \[-Winvalid-imported-macros\]\nIn module [^\n]*macro-4_b.H, imported at [^\n]*macro-4_e.C:[0-9]*:\n[^\n]*macro-4_b.H:[0-9]*:[0-9]*: note: .#define TWO 2a.\nIn module [^\n]*macro-4_a.H, imported at [^\n]*macro-4_e.C:[0-9]*:\n[^\n]*macro-4_a.H:[0-9]*:[0-9]*: note: .#define TWO 2.\n} }
index bbd41f48e09ff638b9c37b15afb7aacc8dba6d99..59e9f8a94384518401ca69935a6d7b34ed86a9e0 100644 (file)
@@ -13,4 +13,4 @@ class DocTargetDriver {
 };
 
 #define OVERRIDE override
-// { dg-message "-:it was later defined here" "" { target *-*-* } .-1 }
+// { dg-message "9:it was later defined here" "" { target *-*-* } .-1 }
index 882b2210992f488dac624336d75e4b1c12963c60..8090015f69344ca55cf9cb91cfa73e837bc56496 100644 (file)
@@ -27,8 +27,8 @@
 #define __TIME__ "X"         /* Define while undefined.  */
 #define __TIME__ "X"         /* Re-define while defined.  */ /* { dg-line time_prev } */
 
-#define __TIME__ "Y"         /* { dg-warning "-:\"__TIME__\" redefined" } */
-/* { dg-message "-:previous definition" "" { target *-*-* } time_prev } */
+#define __TIME__ "Y"         /* { dg-warning "\"__TIME__\" redefined" } */
+/* { dg-message "previous definition" "" { target *-*-* } time_prev } */
 
 #undef __TIME__              /* Undefine while defined.  */
 
@@ -38,8 +38,8 @@
 #define __DATE__ "X"         /* Define while undefined.  */
 #define __DATE__ "X"         /* Re-define while defined.  */ /* { dg-line date_prev } */
 
-#define __DATE__ "Y"         /* { dg-warning "-:\"__DATE__\" redefined" } */
-/* { dg-message "-:previous definition" "" { target *-*-* } date_prev } */
+#define __DATE__ "Y"         /* { dg-warning "\"__DATE__\" redefined" } */
+/* { dg-message "previous definition" "" { target *-*-* } date_prev } */
 
 #undef __DATE__              /* Undefine while defined.  */
 
@@ -47,8 +47,8 @@
 #define __TIMESTAMP__ "X"    /* Define while already defined.  */
 #define __TIMESTAMP__ "X"    /* Re-define while defined.  */ /* { dg-line timestamp_prev } */
 
-#define __TIMESTAMP__ "Y"    /* { dg-warning "-:\"__TIMESTAMP__\" redefined" } */
-/* { dg-message "-:previous definition" "" { target *-*-* } timestamp_prev } */
+#define __TIMESTAMP__ "Y"    /* { dg-warning "\"__TIMESTAMP__\" redefined" } */
+/* { dg-message "previous definition" "" { target *-*-* } timestamp_prev } */
 
 #undef __TIMESTAMP__         /* Undefine while defined.  */
 
@@ -71,9 +71,9 @@
 /* { dg-bogus "Expected built-in is not defined" "" { target *-*-* } .-1 } */
 #endif
 
-#define __LINE__ 0           /* { dg-warning "-:\"__LINE__\" redef" } */
-#define __INCLUDE_LEVEL__ 0  /* { dg-warning "-:\"__INCLUDE_LEVEL__\" redef" } */
-#define __COUNTER__ 0        /* { dg-warning "-:\"__COUNTER__\" redef" } */
+#define __LINE__ 0           /* { dg-warning "\"__LINE__\" redef" } */
+#define __INCLUDE_LEVEL__ 0  /* { dg-warning "\"__INCLUDE_LEVEL__\" redef" } */
+#define __COUNTER__ 0        /* { dg-warning "\"__COUNTER__\" redef" } */
 
 
 int unused;  /* Silence `ISO C forbids an empty translation unit' warning.  */
index d6f76288cd7413644011a28e7ece666c85863d2f..ac363ad04b8ecabc3ee828643a2c783808b9a224 100644 (file)
@@ -15,9 +15,9 @@
 #define used3                  /* { dg-bogus "used" } */
 #define used4 used4            /* { dg-bogus "used" } */
 
-#define unused5                        /* { dg-warning "-:used" } */
-#define unused6                        /* { dg-warning "-:used" } */
-#define unused7()              /* { dg-warning "-:used" } */
+#define unused5                        /* { dg-warning "used" } */
+#define unused6                        /* { dg-warning "used" } */
+#define unused7()              /* { dg-warning "used" } */
 
 #if defined used1
 #endif
index 439d33a705799bbe19b21162f03fe495d4fbf4a5..1dbc10033edfc8fc3e892e1921327cf7261f6a5f 100644 (file)
 #define foo(x) x
 #define foo(x)x                /* { dg-bogus "redefined" "redefined foo" } */
 
-/* { dg-warning "-:redefined" "redef mac"     { target *-*-* } 7  }
-   { dg-warning "-:redefined" "redef mac"     { target *-*-* } 8  }
-   { dg-warning "-:redefined" "redef mac"     { target *-*-* } 9  }
-   { dg-warning "-:redefined" "redef ro"      { target *-*-* } 12 }
-   { dg-warning "-:redefined" "redef va"      { target *-*-* } 15 }
+/* { dg-warning "redefined" "redef mac"     { target *-*-* } 7  }
+   { dg-warning "redefined" "redef mac"     { target *-*-* } 8  }
+   { dg-warning "redefined" "redef mac"     { target *-*-* } 9  }
+   { dg-warning "redefined" "redef ro"      { target *-*-* } 12 }
+   { dg-warning "redefined" "redef va"      { target *-*-* } 15 }
 
-   { dg-message "-:previous"  "prev def mac"  { target *-*-* } 6  }
-   { dg-message "-:previous"  "prev def mac"  { target *-*-* } 7  }
-   { dg-message "-:previous"  "prev def mac"  { target *-*-* } 8  }
-   { dg-message "-:previous"  "prev def ro"   { target *-*-* } 11 }
-   { dg-message "-:previous"  "prev def va"   { target *-*-* } 14 }
+   { dg-message "previous"  "prev def mac"  { target *-*-* } 6  }
+   { dg-message "previous"  "prev def mac"  { target *-*-* } 7  }
+   { dg-message "previous"  "prev def mac"  { target *-*-* } 8  }
+   { dg-message "previous"  "prev def ro"   { target *-*-* } 11 }
+   { dg-message "previous"  "prev def va"   { target *-*-* } 14 }
 */
index 4e4ef128b1024ff529234c9abbd9d319675d322b..1c541a45bb186d8dbd4b691067ee1c122d673f64 100644 (file)
 #define D 1 2
 #define E
 
-/* { dg-warning "-:redefined" "redef A"      { target *-*-* } 7  }
-   { dg-warning "-:redefined" "redef B"      { target *-*-* } 9  }
-   { dg-warning "-:redefined" "redef D"      { target *-*-* } 11 }
-   { dg-warning "-:redefined" "redef E"      { target *-*-* } 12 }
-   { dg-message "-:previous"  "prev def A"   { target *-*-* } 6  }
-   { dg-message "-:previous"  "prev def B"   { target *-*-* } 8  }
-   { dg-message "-:previous"  "prev def D/E" { target *-*-* } 0  }
+/* { dg-warning "redefined" "redef A"      { target *-*-* } 7  }
+   { dg-warning "redefined" "redef B"      { target *-*-* } 9  }
+   { dg-warning "redefined" "redef D"      { target *-*-* } 11 }
+   { dg-warning "redefined" "redef E"      { target *-*-* } 12 }
+   { dg-message "previous"  "prev def A"   { target *-*-* } 6  }
+   { dg-message "previous"  "prev def B"   { target *-*-* } 8  }
+   { dg-message "previous"  "prev def D/E" { target *-*-* } 0  }
 */
index aa6729b770b65af12f7e2430993e9400dfc14521..b34635b2e423bf1654014ea0f2031b748ed16a4a 100644 (file)
@@ -4,41 +4,41 @@
 /* { dg-do preprocess } */
 /* { dg-options "" } */
 
-#define str(x) #x /* { dg-message "-:previous definition" } */
-#define str(x) %: x /* { dg-warning "-:redefined" } */
+#define str(x) #x /* { dg-message "previous definition" } */
+#define str(x) %: x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) #x /* { dg-message "-:previous definition" } */
-#define str(x) # x /* { dg-warning "-:redefined" } */
+#define str(x) #x /* { dg-message "previous definition" } */
+#define str(x) # x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) #x /* { dg-message "-:previous definition" } */
-#define str(x) %: x /* { dg-warning "-:redefined" } */
+#define str(x) #x /* { dg-message "previous definition" } */
+#define str(x) %: x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) %:x /* { dg-message "-:previous definition" } */
-#define str(x) #x /* { dg-warning "-:redefined" } */
+#define str(x) %:x /* { dg-message "previous definition" } */
+#define str(x) #x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) %:x /* { dg-message "-:previous definition" } */
-#define str(x) %: x /* { dg-warning "-:redefined" } */
+#define str(x) %:x /* { dg-message "previous definition" } */
+#define str(x) %: x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) %:x /* { dg-message "-:previous definition" } */
-#define str(x) # x /* { dg-warning "-:redefined" } */
+#define str(x) %:x /* { dg-message "previous definition" } */
+#define str(x) # x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) %:x /* { dg-message "-:previous definition" } */
-#define str(x) %: x /* { dg-warning "-:redefined" } */
+#define str(x) %:x /* { dg-message "previous definition" } */
+#define str(x) %: x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) # x /* { dg-message "-:previous definition" } */
-#define str(x) #x /* { dg-warning "-:redefined" } */
+#define str(x) # x /* { dg-message "previous definition" } */
+#define str(x) #x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) # x /* { dg-message "-:previous definition" } */
-#define str(x) %: x /* { dg-warning "-:redefined" } */
+#define str(x) # x /* { dg-message "previous definition" } */
+#define str(x) %: x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) # x /* { dg-message "-:previous definition" } */
-#define str(x) %: x /* { dg-warning "-:redefined" } */
+#define str(x) # x /* { dg-message "previous definition" } */
+#define str(x) %: x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) %: x /* { dg-message "-:previous definition" } */
-#define str(x) #x /* { dg-warning "-:redefined" } */
+#define str(x) %: x /* { dg-message "previous definition" } */
+#define str(x) #x /* { dg-warning "redefined" } */
 #undef str
-#define str(x) %: x /* { dg-message "-:previous definition" } */
-#define str(x) # x /* { dg-warning "-:redefined" } */
+#define str(x) %: x /* { dg-message "previous definition" } */
+#define str(x) # x /* { dg-warning "redefined" } */
 #undef str
 
 #define str(x) #x
 #define str(x) %: x
 #undef str
 
-#define astr(x) a#x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a#x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a#x /* { dg-message "-:previous definition" } */
-#define astr(x) a# x /* { dg-warning "-:redefined" } */
+#define astr(x) a#x /* { dg-message "previous definition" } */
+#define astr(x) a# x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a#x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a#x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a#x /* { dg-message "-:previous definition" } */
-#define astr(x) a #x /* { dg-warning "-:redefined" } */
+#define astr(x) a#x /* { dg-message "previous definition" } */
+#define astr(x) a #x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a#x /* { dg-message "-:previous definition" } */
-#define astr(x) a %:x /* { dg-warning "-:redefined" } */
+#define astr(x) a#x /* { dg-message "previous definition" } */
+#define astr(x) a %:x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a#x /* { dg-message "-:previous definition" } */
-#define astr(x) a # x /* { dg-warning "-:redefined" } */
+#define astr(x) a#x /* { dg-message "previous definition" } */
+#define astr(x) a # x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a#x /* { dg-message "-:previous definition" } */
-#define astr(x) a %: x /* { dg-warning "-:redefined" } */
+#define astr(x) a#x /* { dg-message "previous definition" } */
+#define astr(x) a %: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%:x /* { dg-message "-:previous definition" } */
-#define astr(x) a#x /* { dg-warning "-:redefined" } */
+#define astr(x) a%:x /* { dg-message "previous definition" } */
+#define astr(x) a#x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%:x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a%:x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%:x /* { dg-message "-:previous definition" } */
-#define astr(x) a# x /* { dg-warning "-:redefined" } */
+#define astr(x) a%:x /* { dg-message "previous definition" } */
+#define astr(x) a# x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%:x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a%:x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%:x /* { dg-message "-:previous definition" } */
-#define astr(x) a #x /* { dg-warning "-:redefined" } */
+#define astr(x) a%:x /* { dg-message "previous definition" } */
+#define astr(x) a #x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%:x /* { dg-message "-:previous definition" } */
-#define astr(x) a %:x /* { dg-warning "-:redefined" } */
+#define astr(x) a%:x /* { dg-message "previous definition" } */
+#define astr(x) a %:x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%:x /* { dg-message "-:previous definition" } */
-#define astr(x) a # x /* { dg-warning "-:redefined" } */
+#define astr(x) a%:x /* { dg-message "previous definition" } */
+#define astr(x) a # x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%:x /* { dg-message "-:previous definition" } */
-#define astr(x) a %: x /* { dg-warning "-:redefined" } */
+#define astr(x) a%:x /* { dg-message "previous definition" } */
+#define astr(x) a %: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a# x /* { dg-message "-:previous definition" } */
-#define astr(x) a#x /* { dg-warning "-:redefined" } */
+#define astr(x) a# x /* { dg-message "previous definition" } */
+#define astr(x) a#x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a# x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a# x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a# x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a# x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a# x /* { dg-message "-:previous definition" } */
-#define astr(x) a #x /* { dg-warning "-:redefined" } */
+#define astr(x) a# x /* { dg-message "previous definition" } */
+#define astr(x) a #x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a# x /* { dg-message "-:previous definition" } */
-#define astr(x) a %:x /* { dg-warning "-:redefined" } */
+#define astr(x) a# x /* { dg-message "previous definition" } */
+#define astr(x) a %:x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a# x /* { dg-message "-:previous definition" } */
-#define astr(x) a # x /* { dg-warning "-:redefined" } */
+#define astr(x) a# x /* { dg-message "previous definition" } */
+#define astr(x) a # x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a# x /* { dg-message "-:previous definition" } */
-#define astr(x) a %: x /* { dg-warning "-:redefined" } */
+#define astr(x) a# x /* { dg-message "previous definition" } */
+#define astr(x) a %: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%: x /* { dg-message "-:previous definition" } */
-#define astr(x) a#x /* { dg-warning "-:redefined" } */
+#define astr(x) a%: x /* { dg-message "previous definition" } */
+#define astr(x) a#x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%: x /* { dg-message "-:previous definition" } */
-#define astr(x) a# x /* { dg-warning "-:redefined" } */
+#define astr(x) a%: x /* { dg-message "previous definition" } */
+#define astr(x) a# x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%: x /* { dg-message "-:previous definition" } */
-#define astr(x) a #x /* { dg-warning "-:redefined" } */
+#define astr(x) a%: x /* { dg-message "previous definition" } */
+#define astr(x) a #x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%: x /* { dg-message "-:previous definition" } */
-#define astr(x) a %:x /* { dg-warning "-:redefined" } */
+#define astr(x) a%: x /* { dg-message "previous definition" } */
+#define astr(x) a %:x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%: x /* { dg-message "-:previous definition" } */
-#define astr(x) a # x /* { dg-warning "-:redefined" } */
+#define astr(x) a%: x /* { dg-message "previous definition" } */
+#define astr(x) a # x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a%: x /* { dg-message "-:previous definition" } */
-#define astr(x) a %: x /* { dg-warning "-:redefined" } */
+#define astr(x) a%: x /* { dg-message "previous definition" } */
+#define astr(x) a %: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a #x /* { dg-message "-:previous definition" } */
-#define astr(x) a#x /* { dg-warning "-:redefined" } */
+#define astr(x) a #x /* { dg-message "previous definition" } */
+#define astr(x) a#x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a #x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a #x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a #x /* { dg-message "-:previous definition" } */
-#define astr(x) a# x /* { dg-warning "-:redefined" } */
+#define astr(x) a #x /* { dg-message "previous definition" } */
+#define astr(x) a# x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a #x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a #x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a #x /* { dg-message "-:previous definition" } */
-#define astr(x) a %:x /* { dg-warning "-:redefined" } */
+#define astr(x) a #x /* { dg-message "previous definition" } */
+#define astr(x) a %:x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a #x /* { dg-message "-:previous definition" } */
-#define astr(x) a # x /* { dg-warning "-:redefined" } */
+#define astr(x) a #x /* { dg-message "previous definition" } */
+#define astr(x) a # x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a #x /* { dg-message "-:previous definition" } */
-#define astr(x) a %: x /* { dg-warning "-:redefined" } */
+#define astr(x) a #x /* { dg-message "previous definition" } */
+#define astr(x) a %: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %:x /* { dg-message "-:previous definition" } */
-#define astr(x) a#x /* { dg-warning "-:redefined" } */
+#define astr(x) a %:x /* { dg-message "previous definition" } */
+#define astr(x) a#x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %:x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a %:x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %:x /* { dg-message "-:previous definition" } */
-#define astr(x) a# x /* { dg-warning "-:redefined" } */
+#define astr(x) a %:x /* { dg-message "previous definition" } */
+#define astr(x) a# x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %:x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a %:x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %:x /* { dg-message "-:previous definition" } */
-#define astr(x) a #x /* { dg-warning "-:redefined" } */
+#define astr(x) a %:x /* { dg-message "previous definition" } */
+#define astr(x) a #x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %:x /* { dg-message "-:previous definition" } */
-#define astr(x) a # x /* { dg-warning "-:redefined" } */
+#define astr(x) a %:x /* { dg-message "previous definition" } */
+#define astr(x) a # x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %:x /* { dg-message "-:previous definition" } */
-#define astr(x) a %: x /* { dg-warning "-:redefined" } */
+#define astr(x) a %:x /* { dg-message "previous definition" } */
+#define astr(x) a %: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a # x /* { dg-message "-:previous definition" } */
-#define astr(x) a#x /* { dg-warning "-:redefined" } */
+#define astr(x) a # x /* { dg-message "previous definition" } */
+#define astr(x) a#x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a # x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a # x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a # x /* { dg-message "-:previous definition" } */
-#define astr(x) a# x /* { dg-warning "-:redefined" } */
+#define astr(x) a # x /* { dg-message "previous definition" } */
+#define astr(x) a# x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a # x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a # x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a # x /* { dg-message "-:previous definition" } */
-#define astr(x) a #x /* { dg-warning "-:redefined" } */
+#define astr(x) a # x /* { dg-message "previous definition" } */
+#define astr(x) a #x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a # x /* { dg-message "-:previous definition" } */
-#define astr(x) a %:x /* { dg-warning "-:redefined" } */
+#define astr(x) a # x /* { dg-message "previous definition" } */
+#define astr(x) a %:x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a # x /* { dg-message "-:previous definition" } */
-#define astr(x) a %: x /* { dg-warning "-:redefined" } */
+#define astr(x) a # x /* { dg-message "previous definition" } */
+#define astr(x) a %: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %: x /* { dg-message "-:previous definition" } */
-#define astr(x) a#x /* { dg-warning "-:redefined" } */
+#define astr(x) a %: x /* { dg-message "previous definition" } */
+#define astr(x) a#x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %: x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a %: x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %: x /* { dg-message "-:previous definition" } */
-#define astr(x) a# x /* { dg-warning "-:redefined" } */
+#define astr(x) a %: x /* { dg-message "previous definition" } */
+#define astr(x) a# x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %: x /* { dg-message "-:previous definition" } */
-#define astr(x) a%: x /* { dg-warning "-:redefined" } */
+#define astr(x) a %: x /* { dg-message "previous definition" } */
+#define astr(x) a%: x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %: x /* { dg-message "-:previous definition" } */
-#define astr(x) a #x /* { dg-warning "-:redefined" } */
+#define astr(x) a %: x /* { dg-message "previous definition" } */
+#define astr(x) a #x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %: x /* { dg-message "-:previous definition" } */
-#define astr(x) a %:x /* { dg-warning "-:redefined" } */
+#define astr(x) a %: x /* { dg-message "previous definition" } */
+#define astr(x) a %:x /* { dg-warning "redefined" } */
 #undef astr
-#define astr(x) a %: x /* { dg-message "-:previous definition" } */
-#define astr(x) a # x /* { dg-warning "-:redefined" } */
+#define astr(x) a %: x /* { dg-message "previous definition" } */
+#define astr(x) a # x /* { dg-warning "redefined" } */
 #undef astr
 
 #define astr(x) a#x
 #define astr(x) a %: x
 #undef astr
 
-#define cat(x,y) x##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x##y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x##y /* { dg-message "previous definition" } */
+#define cat(x,y) x## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x##y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x##y /* { dg-message "previous definition" } */
+#define cat(x,y) x ##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x##y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x##y /* { dg-message "previous definition" } */
+#define cat(x,y) x ## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x##y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x ##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x ## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x## y /* { dg-message "previous definition" } */
+#define cat(x,y) x##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x## y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x## y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x## y /* { dg-message "previous definition" } */
+#define cat(x,y) x ##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x## y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x## y /* { dg-message "previous definition" } */
+#define cat(x,y) x ## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x## y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x ##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x ## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x%:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ##y /* { dg-message "previous definition" } */
+#define cat(x,y) x##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ##y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ##y /* { dg-message "previous definition" } */
+#define cat(x,y) x## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ##y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ##y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ##y /* { dg-message "previous definition" } */
+#define cat(x,y) x ## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ##y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ##y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x ##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x ## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%:y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ## y /* { dg-message "previous definition" } */
+#define cat(x,y) x##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ## y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ## y /* { dg-message "previous definition" } */
+#define cat(x,y) x## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ## y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ## y /* { dg-message "previous definition" } */
+#define cat(x,y) x ##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ## y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x ## y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x ## y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x## y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x%:%: y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ##y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x ##y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x %:%:y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */
 #undef cat
-#define cat(x,y) x %:%: y /* { dg-message "-:previous definition" } */
-#define cat(x,y) x ## y /* { dg-warning "-:redefined" } */
+#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */
+#define cat(x,y) x ## y /* { dg-warning "redefined" } */
 #undef cat
 
 #define cat(x,y) x##y
 #define cat(x,y) x %:%: y
 #undef cat
 
-#define cat3(x,y,z) x##y##z /* { dg-message "-:previous definition" } */
-#define cat3(x,y,z) x##y####z /* { dg-warning "-:redefined" } */
+#define cat3(x,y,z) x##y##z /* { dg-message "previous definition" } */
+#define cat3(x,y,z) x##y####z /* { dg-warning "redefined" } */
 #undef cat3
 
-#define cat3(x,y,z) x##y####z /* { dg-message "-:previous definition" } */
-#define cat3(x,y,z) x####y##z /* { dg-warning "-:redefined" } */
+#define cat3(x,y,z) x##y####z /* { dg-message "previous definition" } */
+#define cat3(x,y,z) x####y##z /* { dg-warning "redefined" } */
 #undef cat3
 
-#define cat3(x,y,z) x##y####z /* { dg-message "-:previous definition" } */
-#define cat3(x,y,z) x##y## ##z /* { dg-warning "-:redefined" } */
+#define cat3(x,y,z) x##y####z /* { dg-message "previous definition" } */
+#define cat3(x,y,z) x##y## ##z /* { dg-warning "redefined" } */
 #undef cat3
 
-#define cat3(x,y,z) x##y####z /* { dg-message "-:previous definition" } */
-#define cat3(x,y,z) x##y##%:%:z /* { dg-warning "-:redefined" } */
+#define cat3(x,y,z) x##y####z /* { dg-message "previous definition" } */
+#define cat3(x,y,z) x##y##%:%:z /* { dg-warning "redefined" } */
 #undef cat3
 
-#define cat3(x,y,z) x##y######## ####z /* { dg-message "-:previous definition" } */
-#define cat3(x,y,z) x##y############z /* { dg-warning "-:redefined" } */
+#define cat3(x,y,z) x##y######## ####z /* { dg-message "previous definition" } */
+#define cat3(x,y,z) x##y############z /* { dg-warning "redefined" } */
 #undef cat3
 
-#define cat3(x,y,z) x##y############z /* { dg-message "-:previous definition" } */
-#define cat3(x,y,z) x##y########%:%:##z /* { dg-warning "-:redefined" } */
+#define cat3(x,y,z) x##y############z /* { dg-message "previous definition" } */
+#define cat3(x,y,z) x##y########%:%:##z /* { dg-warning "redefined" } */
 #undef cat3
 
 #define cat3(x,y,z) x##y##z
index 56b88f8be6136deb292a6b339333534c444a1a2d..701765d1ecaa6c1c16c1e0b3e32c8940f1a2ae1d 100644 (file)
@@ -4,23 +4,23 @@
 /* { dg-options "-std=c99 -pedantic-errors" } */
 
 /* Different spelling of UCN in expansion.  */
-#define m1 \u00c1 /* { dg-message "-:previous definition" } */
-#define m1 Á /* { dg-error "-:redefined" } */
+#define m1 \u00c1 /* { dg-message "previous definition" } */
+#define m1 Á /* { dg-error "redefined" } */
 
 #define m1ok Á
 #define m1ok Á
 
 /* Different spelling of UCN in argument name.  */
-#define m2(\u00c1) /* { dg-message "-:previous definition" } */
-#define m2(Á) /* { dg-error "-:redefined" } */
+#define m2(\u00c1) /* { dg-message "previous definition" } */
+#define m2(Á) /* { dg-error "redefined" } */
 
 #define m2ok(Á)
 #define m2ok(Á)
 
 /* Same spelling in argument name but different spelling when used in
    expansion.  */
-#define m3(\u00c1) \u00c1 /* { dg-message "-:previous definition" } */
-#define m3(\u00c1) Á /* { dg-error "-:redefined" } */
+#define m3(\u00c1) \u00c1 /* { dg-message "previous definition" } */
+#define m3(\u00c1) Á /* { dg-error "redefined" } */
 
 #define m3ok(\u00c1) Á
 #define m3ok(\u00c1) Á
index b6956f5445436a4284b8c98b18d2134547093112..a44a3eaf4212353a1977079bac66da0b7e3a07cd 100644 (file)
@@ -4,23 +4,23 @@
 /* { dg-options "-std=c99 -pedantic-errors" } */
 
 /* Different spelling of UCN in expansion.  */
-#define m1 \u00c1 /* { dg-message "-:previous definition" } */
-#define m1 \u00C1 /* { dg-error "-:redefined" } */
+#define m1 \u00c1 /* { dg-message "previous definition" } */
+#define m1 \u00C1 /* { dg-error "redefined" } */
 
 #define m1ok \u00c1
 #define m1ok \u00c1
 
 /* Different spelling of UCN in argument name.  */
-#define m2(\u00c1) /* { dg-message "-:previous definition" } */
-#define m2(\u00C1) /* { dg-error "-:redefined" } */
+#define m2(\u00c1) /* { dg-message "previous definition" } */
+#define m2(\u00C1) /* { dg-error "redefined" } */
 
 #define m2ok(\u00c1)
 #define m2ok(\u00c1)
 
 /* Same spelling in argument name but different spelling when used in
    expansion.  */
-#define m3(\u00c1) \u00c1 /* { dg-message "-:previous definition" } */
-#define m3(\u00c1) \u00C1 /* { dg-error "-:redefined" } */
+#define m3(\u00c1) \u00c1 /* { dg-message "previous definition" } */
+#define m3(\u00c1) \u00C1 /* { dg-error "redefined" } */
 
 #define m3ok(\u00c1) \u00C1
 #define m3ok(\u00c1) \u00C1
index 189a72dd9c2d956d8f85d49caafa08e9b7daacf7..f9b047b8a258c3ba1e3889decce119b31090aeed 100644 (file)
@@ -3,9 +3,9 @@
 
 /* { dg-do preprocess } */
 
-#undef __DATE__                /* { dg-warning "-:undefining \"__DATE__\"" } */
-#undef __TIME__                /* { dg-warning "-:undefining \"__TIME__\"" } */
-#undef __FILE__                /* { dg-warning "-:undefining \"__FILE__\"" } */
+#undef __DATE__                /* { dg-warning "undefining \"__DATE__\"" } */
+#undef __TIME__                /* { dg-warning "undefining \"__TIME__\"" } */
+#undef __FILE__                /* { dg-warning "undefining \"__FILE__\"" } */
 #undef __LINE__                /* { dg-warning "undefining \"__LINE__\"" } */
 #undef __STDC__                /* { dg-warning "undefining \"__STDC__\"" } */
 
index ea5ad8170cd83ebf8cb59926ca004f4c0556b7a5..3e2e57a79bbc997f9f3a51ff6347a44c87a53438 100644 (file)
@@ -6,13 +6,13 @@
 // { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } .-1 }
 #endif
 
-#define __TIME__ "X"  // { dg-error "-:\"__TIME__\" redefined .-Werror=builtin-macro-redefined." }
+#define __TIME__ "X"  // { dg-error "\"__TIME__\" redefined .-Werror=builtin-macro-redefined." }
 
 #define __TIME__ "Y"  // { dg-bogus "-Wbuiltin-macro-redefined" }
-                      // { dg-warning "-:\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 }
-                      // { dg-message "-:previous definition" "previous-1" { target *-*-* } 9 }
+                      // { dg-warning "\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 }
+                      // { dg-message "previous definition" "previous-1" { target *-*-* } 9 }
 
 #define X "X"
 #define X "Y"         // { dg-bogus "-Wbuiltin-macro-redefined" }
-                      // { dg-warning "-:\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 }
-                      // { dg-message "-:previous definition" "previous-2" { target *-*-* } 15 }
+                      // { dg-warning "\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 }
+                      // { dg-message "previous definition" "previous-2" { target *-*-* } 15 }
index e04466897067b7da4c0deaf6e533fbf4be270784..c562d072e402cb2e9e98d00e8c08ed2c60b92702 100644 (file)
@@ -6,13 +6,13 @@
 // { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } .-1 }
 #endif
 
-#define __TIME__ "X"  // { dg-warning "-:\"__TIME__\" redefined .-Wbuiltin-macro-redefined." }
+#define __TIME__ "X"  // { dg-warning "\"__TIME__\" redefined .-Wbuiltin-macro-redefined." }
 
 #define __TIME__ "Y"  // { dg-bogus "-Wbuiltin-macro-redefined" }
-                      // { dg-warning "-:\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 }
-                      // { dg-message "-:previous definition" "previous-1" { target *-*-* } 9 }
+                      // { dg-warning "\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 }
+                      // { dg-message "previous definition" "previous-1" { target *-*-* } 9 }
 
 #define X "X"
 #define X "Y"         // { dg-bogus "-Wbuiltin-macro-redefined" }
-                      // { dg-warning "-:\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 }
-                      // { dg-message "-:previous definition" "previous-2" { target *-*-* } 15 }
+                      // { dg-warning "\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 }
+                      // { dg-message "previous definition" "previous-2" { target *-*-* } 15 }
index f82d67fe9c28f67b7e42b8514627b32ebe1ed735..7c3efe05351913a49d9cef6e7a83d03dfd5a50c6 100644 (file)
@@ -1,4 +1,4 @@
 // { dg-do preprocess }
 // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=unused-macros" }
 /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */
-#define X X  // { dg-error "-:macro \"X\" is not used .-Werror=unused-macros." }
+#define X X  // { dg-error "9:macro \"X\" is not used .-Werror=unused-macros." }
index b18f506b13b683f0c4344cb399fa212a71aa19cf..74df23971a968b508e95fe1f95132e571df24b33 100644 (file)
@@ -1,4 +1,4 @@
 // { dg-do preprocess }
 // { dg-options "-std=gnu99 -fdiagnostics-show-option -Wunused-macros" }
 
-#define X X  // { dg-warning "-:macro \"X\" is not used .-Wunused-macros." }
+#define X X  // { dg-warning "9:macro \"X\" is not used .-Wunused-macros." }
index 1fdd73edcb8696044bb78b059e140f7408d6628e..ee5419d1f40965aecf7ce641148ef9a4c700b817 100644 (file)
@@ -655,6 +655,10 @@ do_define (cpp_reader *pfile)
 
   if (node)
     {
+      /* This is a better location than pfile->directive_line to store
+        as the macro location.  */
+      const location_t name_loc = cpp_diagnostic_get_current_location (pfile);
+
       /* If we have been requested to expand comments into macros,
         then re-enable saving of comments.  */
       pfile->state.save_comments =
@@ -663,7 +667,7 @@ do_define (cpp_reader *pfile)
       if (pfile->cb.before_define)
        pfile->cb.before_define (pfile);
 
-      if (_cpp_create_definition (pfile, node))
+      if (_cpp_create_definition (pfile, node, name_loc))
        if (pfile->cb.define)
          pfile->cb.define (pfile, pfile->directive_line, node);
 
@@ -694,9 +698,8 @@ do_undef (cpp_reader *pfile)
                       "undefining \"%s\"", NODE_NAME (node));
          else if (cpp_builtin_macro_p (node)
                   && CPP_OPTION (pfile, warn_builtin_macro_redefined))
-           cpp_warning_with_line (pfile, CPP_W_BUILTIN_MACRO_REDEFINED,
-                                  pfile->directive_line, 0,
-                                  "undefining \"%s\"", NODE_NAME (node));
+           cpp_warning (pfile, CPP_W_BUILTIN_MACRO_REDEFINED,
+                        "undefining \"%s\"", NODE_NAME (node));
 
          if (node->value.macro
              && CPP_OPTION (pfile, warn_unused_macros))
@@ -2642,7 +2645,7 @@ cpp_pop_definition (cpp_reader *pfile, struct def_pragma_macro *c)
       {
        _cpp_clean_line (pfile);
        nbuf->sysp = 1;
-       if (!_cpp_create_definition (pfile, h))
+       if (!_cpp_create_definition (pfile, h, 0))
          abort ();
        _cpp_pop_buffer (pfile);
       }
index 9724676a8cd4769fd98a906fec02e656bf016052..8b74d10c1a3469c70083938a76f6491f860f8a4d 100644 (file)
@@ -686,7 +686,7 @@ inline bool _cpp_maybe_notify_macro_use (cpp_reader *pfile, cpp_hashnode *node,
 }
 extern cpp_macro *_cpp_new_macro (cpp_reader *, cpp_macro_kind, void *);
 extern void _cpp_free_definition (cpp_hashnode *);
-extern bool _cpp_create_definition (cpp_reader *, cpp_hashnode *);
+extern bool _cpp_create_definition (cpp_reader *, cpp_hashnode *, location_t);
 extern void _cpp_pop_context (cpp_reader *);
 extern void _cpp_push_text_context (cpp_reader *, cpp_hashnode *,
                                    const unsigned char *, size_t);
index d4238d4f621863d1d2febeded17ef526e632a1c9..dada8fea8350a987168b84746c1f5a1649a20a63 100644 (file)
@@ -3819,7 +3819,8 @@ _cpp_new_macro (cpp_reader *pfile, cpp_macro_kind kind, void *placement)
 
 /* Parse a macro and save its expansion.  Returns nonzero on success.  */
 bool
-_cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
+_cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node,
+                       location_t name_loc)
 {
   cpp_macro *macro;
 
@@ -3831,6 +3832,13 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
   if (!macro)
     return false;
 
+  /* _cpp_new_macro () has set macro->line to pfile->directive_line, which
+     denotes the line containing the #define with no column information.  If
+     provided, change to name_loc, which will be the token src_loc for the
+     macro name, including the location and range information.  */
+  if (name_loc)
+    macro->line = name_loc;
+
   if (cpp_macro_p (node))
     {
       if (CPP_OPTION (pfile, warn_unused_macros))
@@ -3844,7 +3852,7 @@ _cpp_create_definition (cpp_reader *pfile, cpp_hashnode *node)
 
          bool warned = 
            cpp_pedwarning_with_line (pfile, reason,
-                                     pfile->directive_line, 0,
+                                     macro->line, 0,
                                      "\"%s\" redefined", NODE_NAME (node));
 
          if (warned && cpp_user_macro_p (node))
index 595afefab74d404d33430cade47756c5e53b315c..a9f4ff19bf1e17b2160a534cc325909c2f76148a 100644 (file)
@@ -838,7 +838,7 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
              != NULL)
            {
              _cpp_clean_line (r);
-             if (!_cpp_create_definition (r, h))
+             if (!_cpp_create_definition (r, h, 0))
                abort ();
              _cpp_pop_buffer (r);
            }