Martin: are the changes to your test cases OK by you, or is there
a better way to rewrite them?

Thanks for looking into it!

Since the purpose of the test_sprintf_note function in the test is
to verify the location of the caret within the warnings I think we
should keep it if it's possible.  Would either removing the P macro
or moving the function to a different file that doesn't use the
-ftrack-macro-expansion=0 option work?

Martin

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c 
b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
index 5779a95..b6a6011 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
@@ -181,13 +181,13 @@ void test_sprintf_note (void)
   /* Diagnostic column numbers are 1-based.  */

   P (buffer (0),                /* { dg-message "format output 4 bytes into a 
destination of size 0" } */
-     "%c%s%i", '1', "2", 3);    /* { dg-warning "7:.%c. directive writing 1 byte 
into a region of size 0" } */
+     "%c%s%i", '1', "2", 3);    /* { dg-warning ".%c. directive writing 1 byte into 
a region of size 0" } */

   P (buffer (1),                /* { dg-message "format output 6 bytes into a 
destination of size 1" } */
-     "%c%s%i", '1', "23", 45);  /* { dg-warning "9:.%s. directive writing 2 bytes 
into a region of size 0" } */
+     "%c%s%i", '1', "23", 45);  /* { dg-warning ".%s. directive writing 2 bytes 
into a region of size 0" } */

   P (buffer (2),                /* { dg-message "format output 6 bytes into a 
destination of size 2" } */
-     "%c%s%i", '1', "2", 345);  /* { dg-warning "11:.%i. directive writing 3 bytes 
into a region of size 0" } */
+     "%c%s%i", '1', "2", 345);  /* { dg-warning ".%i. directive writing 3 bytes 
into a region of size 0" } */

   /* It would be nice if the caret in the location range for the format
      string below could be made to point at the closing quote of the format
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-4.c 
b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-4.c
index faa5806..b587d00 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-4.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-Wformat -Wformat-length=1 -fdiagnostics-show-caret 
-ftrack-macro-expansion=0" } */
+/* { dg-options "-Wformat -Wformat-length=1 -fdiagnostics-show-caret" } */

 extern int sprintf (char*, const char*, ...);



Reply via email to