Patchwork Replace ".*" by "\[^\n\]*" in tcl regexps

login
register
mail settings
Submitter Andreas Schwab
Date Sept. 4, 2010, 8:08 p.m.
Message ID <m2lj7hp8zp.fsf@igel.home>
Download mbox | patch
Permalink /patch/63804/
State New
Headers show

Comments

Andreas Schwab - Sept. 4, 2010, 8:08 p.m.
In tcl "." matches newline, so use "\[^\n\]" instead so that the regexps
don't match multiple lines.  Tested on powerpc-linux and checked in as
obvious.

Andreas.

2010-09-04  Andreas Schwab  <schwab@linux-m68k.org>

	* g++.dg/debug/dwarf2/global-used-types-1.C: Replace ".*" by
	"\[^\n\]*".
	* g++.dg/debug/dwarf2/namespace-1.C: Likewise.
	* g++.dg/debug/dwarf2/pubnames-1.C: Likewise.
	* g++.dg/debug/dwarf2/template-func-params-4.C: Likewise.
	* g++.dg/debug/dwarf2/template-func-params-7.C: Likewise.
	* g++.dg/debug/dwarf2/template-params-4.C: Likewise.
	* g++.dg/debug/dwarf2/template-params-6.C: Likewise.
	* g++.dg/debug/dwarf2/template-params-7.C: Likewise.
	* g++.dg/debug/dwarf2/typedef1.C: Likewise.
	* gcc.dg/debug/dwarf2/global-used-types.c: Likewise.
	* gcc.dg/debug/dwarf2/inline2.c: Likewise.
	* gcc.target/i386/pr22152.c: Likewise.
	* gcc.target/i386/pr36992-1.c: Likewise.
	* gcc.target/i386/pr36992-2.c: Likewise.
	* gcc.target/sh/sh4a-memmovua.c: Likewise.
H.J. Lu - Sept. 5, 2010, 2 p.m.
On Sat, Sep 4, 2010 at 1:08 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> In tcl "." matches newline, so use "\[^\n\]" instead so that the regexps
> don't match multiple lines.  Tested on powerpc-linux and checked in as
> obvious.
>
> Andreas.
>
> 2010-09-04  Andreas Schwab  <schwab@linux-m68k.org>
>
>        * g++.dg/debug/dwarf2/global-used-types-1.C: Replace ".*" by
>        "\[^\n\]*".
>        * g++.dg/debug/dwarf2/namespace-1.C: Likewise.
>        * g++.dg/debug/dwarf2/pubnames-1.C: Likewise.
>        * g++.dg/debug/dwarf2/template-func-params-4.C: Likewise.
>        * g++.dg/debug/dwarf2/template-func-params-7.C: Likewise.
>        * g++.dg/debug/dwarf2/template-params-4.C: Likewise.
>        * g++.dg/debug/dwarf2/template-params-6.C: Likewise.
>        * g++.dg/debug/dwarf2/template-params-7.C: Likewise.
>        * g++.dg/debug/dwarf2/typedef1.C: Likewise.
>        * gcc.dg/debug/dwarf2/global-used-types.c: Likewise.
>        * gcc.dg/debug/dwarf2/inline2.c: Likewise.
>        * gcc.target/i386/pr22152.c: Likewise.
>        * gcc.target/i386/pr36992-1.c: Likewise.
>        * gcc.target/i386/pr36992-2.c: Likewise.
>        * gcc.target/sh/sh4a-memmovua.c: Likewise.
>

This may have caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45543
Andreas Schwab - Sept. 5, 2010, 6:30 p.m.
"H.J. Lu" <hjl.tools@gmail.com> writes:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45543

That means that the tests previously succeeded spuriously, because the
matches were not supposed to span lines.

Andreas.

Patch

Index: gcc/testsuite/g++.dg/debug/dwarf2/global-used-types-1.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/global-used-types-1.C	(revision 163867)
+++ gcc/testsuite/g++.dg/debug/dwarf2/global-used-types-1.C	(working copy)
@@ -1,10 +1,10 @@ 
 // Contributed by Dodji Seketeli <dodji@redhat.com>
 // { dg-options "-g -dA -fno-merge-debug-strings" }
 // { dg-do compile }
-// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_enumeration_type" 1 } }
-// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_enumerator" 2 } }
-// { dg-final { scan-assembler-times "ascii \"a.0\"\[\t \]+.*?DW_AT_name" 1 } }
-// { dg-final { scan-assembler-times "ascii \"b.0\"\[\t \]+.*?DW_AT_name" 1 } }
+// { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_enumeration_type" 1 } }
+// { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_enumerator" 2 } }
+// { dg-final { scan-assembler-times "ascii \"a.0\"\[\t \]+\[^\n\]*DW_AT_name" 1 } }
+// { dg-final { scan-assembler-times "ascii \"b.0\"\[\t \]+\[^\n\]*DW_AT_name" 1 } }
 
 struct foo
 {
Index: gcc/testsuite/g++.dg/debug/dwarf2/namespace-1.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/namespace-1.C	(revision 163867)
+++ gcc/testsuite/g++.dg/debug/dwarf2/namespace-1.C	(working copy)
@@ -5,10 +5,10 @@ 
 // We want to test that there is a DW_TAG_namespace DIE DW_AT_name is set
 // to "not_emitted". That namespace die has a child DW_TAG_typedef DIE
 // which DW_AT_name is the null terminated string "T".
-// { dg-final { scan-assembler-times "DIE +\\(.*?\\) DW_TAG_namespace" 1 } }
-// { dg-final { scan-assembler-times "\"not_emitted.0\".*?DW_AT_name" 1 } }
-// { dg-final { scan-assembler-times "DIE +\\(.*?\\) DW_TAG_typedef" 1 } }
-// { dg-final { scan-assembler-times "\.ascii \"T.0\"\[\t \]+.*?DW_AT_name" 1 } }
+// { dg-final { scan-assembler-times "DIE +\\(\[^\n\]*\\) DW_TAG_namespace" 1 } }
+// { dg-final { scan-assembler-times "\"not_emitted.0\"\[^\n\]*DW_AT_name" 1 } }
+// { dg-final { scan-assembler-times "DIE +\\(\[^\n\]*\\) DW_TAG_typedef" 1 } }
+// { dg-final { scan-assembler-times "\.ascii \"T.0\"\[\t \]+\[^\n\]*DW_AT_name" 1 } }
 
 struct strukt
 {
Index: gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C	(revision 163867)
+++ gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C	(working copy)
@@ -8,13 +8,13 @@ 
 // debug_pubnames section. The assembly code of that label adds an occurence
 // of section declaration assembly. So on Darwin, we need to check for two
 // occurences of the debug_pubnames section declaration.
-// { dg-final { scan-assembler-times "\.section\[\t \].*?debug_pubnames" 1 { target { ! *-*-darwin* } } } }
-// { dg-final { scan-assembler-times "\.section\[\t \].*?debug_pubnames" 2 { target { *-*-darwin* } } } }
+// { dg-final { scan-assembler-times "\.section\[\t \]\[^\n\]*debug_pubnames" 1 { target { ! *-*-darwin* } } } }
+// { dg-final { scan-assembler-times "\.section\[\t \]\[^\n\]*debug_pubnames" 2 { target { *-*-darwin* } } } }
 //
 // Then check of the presence of the names we are interested in.
-// { dg-final { scan-assembler-times "\"main.0\".*external name" 1 } }
-// { dg-final { scan-assembler-times "\"ns::ns_x.*external name" 1 } }
-// { dg-final { scan-assembler-times "\"y::y_x.*external name" 1 } }
+// { dg-final { scan-assembler-times "\"main.0\"\[^\n\]*external name" 1 } }
+// { dg-final { scan-assembler-times "\"ns::ns_x\[^\n\]*external name" 1 } }
+// { dg-final { scan-assembler-times "\"y::y_x\[^\n\]*external name" 1 } }
 
 namespace ns { int ns_x; }
 class y { public: static int y_x; };
Index: gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-4.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-4.C	(revision 163867)
+++ gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-4.C	(working copy)
@@ -9,8 +9,8 @@ 
 // DW_TAG_GNU_template_parameter_pack DIE, but in practise, there is only one
 // DW_TAG_GNU_template_parameter_pack as there is only count<int, char, long>
 // is emitted.
-// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_GNU_template_parameter_pack" 1} }
-// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_template_type_param" 3} }
+// { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_GNU_template_parameter_pack" 1} }
+// { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_template_type_param" 3} }
 
 
 template <typename... Args> struct count;
Index: gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C	(revision 163867)
+++ gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C	(working copy)
@@ -6,23 +6,23 @@ 
 // There must be 5 subprograms generated:
 // printf(const char*), printf<int, char, int>,
 // printf<char, int>, printf<int> and foo().
-// { dg-final {scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_subprogram" 5 } }
+// { dg-final {scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_subprogram" 5 } }
 
 // That makes 6 template type parameters.
-// { dg-final {scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_template_type_param" 6 } }
-// { dg-final {scan-assembler-times "\"printf<int, char, int>.0\".*?DW_AT_name" 1 } }
-// { dg-final {scan-assembler-times "\"printf<char, int>.0\".*?DW_AT_name" 1 } }
-// { dg-final {scan-assembler-times "\"printf<int>.0\".*?DW_AT_name" 1 } }
-// { dg-final {scan-assembler-times "\"printf.0\".*?DW_AT_name" 1 } }
+// { dg-final {scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_template_type_param" 6 } }
+// { dg-final {scan-assembler-times "\"printf<int, char, int>.0\"\[^\n\]*DW_AT_name" 1 } }
+// { dg-final {scan-assembler-times "\"printf<char, int>.0\"\[^\n\]*DW_AT_name" 1 } }
+// { dg-final {scan-assembler-times "\"printf<int>.0\"\[^\n\]*DW_AT_name" 1 } }
+// { dg-final {scan-assembler-times "\"printf.0\"\[^\n\]*DW_AT_name" 1 } }
 
 // printf<int, char, int> and printf<char, int> have a pack expansion as
 // function parameters. There should then be 3
 // DW_TAG_GNU_template_parameter_pack and 3 DW_TAG_GNU_formal_parameter_pack DIEs
-// { dg-final {scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_GNU_template_parameter_pack" 3 } }
-// { dg-final {scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_GNU_formal_parameter_pack" 3 } }
+// { dg-final {scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_GNU_template_parameter_pack" 3 } }
+// { dg-final {scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_GNU_formal_parameter_pack" 3 } }
 // These 3 function template instantiations has a total of 3 template
 // parameters named T.
-// { dg_final {scan-assembler-times "\.ascii \"T.0\"\[\t \]+.*?DW_AT_name" 3 } }
+// { dg_final {scan-assembler-times "\.ascii \"T.0\"\[\t \]+\[^\n\]*DW_AT_name" 3 } }
 
 
 void
Index: gcc/testsuite/g++.dg/debug/dwarf2/template-params-4.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/template-params-4.C	(revision 163867)
+++ gcc/testsuite/g++.dg/debug/dwarf2/template-params-4.C	(working copy)
@@ -9,8 +9,8 @@ 
 // DW_TAG_GNU_template_parameter_pack DIE, but in practise, there is only one
 // DW_TAG_GNU_template_parameter_pack as there is only count<int, char, long>
 // is emitted.
-// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_GNU_template_parameter_pack" 1} }
-// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_template_type_param" 3} }
+// { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_GNU_template_parameter_pack" 1} }
+// { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_template_type_param" 3} }
 
 template <typename... Args> struct count;
 
Index: gcc/testsuite/g++.dg/debug/dwarf2/template-params-6.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/template-params-6.C	(revision 163867)
+++ gcc/testsuite/g++.dg/debug/dwarf2/template-params-6.C	(working copy)
@@ -2,8 +2,8 @@ 
 // Origin PR debug/30161
 // { dg-options "-g -dA -fno-merge-debug-strings" }
 // { dg-final { scan-assembler-times "DW_TAG_GNU_template_template_param" 2 } }
-// { dg-final { scan-assembler-times "\"vector.0\".*?DW_AT_GNU_template_name" 1 } }
-// { dg-final { scan-assembler-times ".ascii \"U.0\".*?DW_AT_name" 1 } }
+// { dg-final { scan-assembler-times "\"vector.0\"\[^\n\]*DW_AT_GNU_template_name" 1 } }
+// { dg-final { scan-assembler-times ".ascii \"U.0\"\[^\n\]*DW_AT_name" 1 } }
 
 template <class T>
 struct vector_base
Index: gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C	(revision 163867)
+++ gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C	(working copy)
@@ -5,7 +5,7 @@ 
 // The type M<> should have one DW_TAG_GNU_template_parameter_pack DIE,
 // with no DW_AT_name attribute. We don't test the fact that it has no
 // DW_AT_name though.
-// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_GNU_template_parameter_pack" 1 } }
+// { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_GNU_template_parameter_pack" 1 } }
 
 
 template <typename...>
Index: gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C	(revision 163867)
+++ gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C	(working copy)
@@ -3,12 +3,12 @@ 
 // { dg-options "-g -dA" }
 // { dg-do compile }
 // { dg-final { scan-assembler-times "DW_TAG_structure_type" 2 } }
-// { dg-final { scan-assembler-times "DW_AT_name: \"foo<1u>\"|\"foo<1u>..\".*DW_AT_name" 1 } }
+// { dg-final { scan-assembler-times "DW_AT_name: \"foo<1u>\"|\"foo<1u>..\"\[^\n\]*DW_AT_name" 1 } }
 // { dg-final { scan-assembler-times "DW_TAG_enumeration_type" 2 } }
-// { dg-final { scan-assembler-times "DW_AT_name: \"typedef foo<1u>::type type\"|\"typedef foo<1u>::type type..\".*DW_AT_name" 1 } }
-// { dg-final { scan-assembler-times "DIE (.*) DW_TAG_enumeration_type" 2 } }
-// { dg-final { scan-assembler-times "\"e0..\".*DW_AT_name" 1 } }
-// { dg-final { scan-assembler-times "\"e1..\".*DW_AT_name" 1 } }
+// { dg-final { scan-assembler-times "DW_AT_name: \"typedef foo<1u>::type type\"|\"typedef foo<1u>::type type..\"\[^\n\]*DW_AT_name" 1 } }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_enumeration_type" 2 } }
+// { dg-final { scan-assembler-times "\"e0..\"\[^\n\]*DW_AT_name" 1 } }
+// { dg-final { scan-assembler-times "\"e1..\"\[^\n\]*DW_AT_name" 1 } }
 
 template <unsigned int n>
 struct foo
Index: gcc/testsuite/gcc.dg/debug/dwarf2/global-used-types.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/global-used-types.c	(revision 163867)
+++ gcc/testsuite/gcc.dg/debug/dwarf2/global-used-types.c	(working copy)
@@ -2,10 +2,10 @@ 
  Contributed by Dodji Seketeli <dodji@redhat.com>
  { dg-options "-g -dA -fno-merge-debug-strings" }
  { dg-do compile }
- { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_enumeration_type" 1 } }
- { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_enumerator" 2 } }
- { dg-final { scan-assembler-times "ascii \"a.0\"\[\t \]+.*?DW_AT_name" 1 } }
- { dg-final { scan-assembler-times "ascii \"b.0\"\[\t \]+.*?DW_AT_name" 1 } }
+ { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_enumeration_type" 1 } }
+ { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_enumerator" 2 } }
+ { dg-final { scan-assembler-times "ascii \"a.0\"\[\t \]+\[^\n\]*DW_AT_name" 1 } }
+ { dg-final { scan-assembler-times "ascii \"b.0\"\[\t \]+\[^\n\]*DW_AT_name" 1 } }
  */
 
 enum { a, b };
Index: gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c	(revision 163867)
+++ gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c	(working copy)
@@ -21,14 +21,14 @@ 
    - One for each subroutine inlined into main, that's 3.
    - One for earch subroutine inline into the out of line instances
      of third, second and first.  */
-/* { dg-final { scan-assembler-times "\\(DIE \\(.*?\\) DW_TAG_inlined_subroutine" 6 } } */
+/* { dg-final { scan-assembler-times "\\(DIE \\(\[^\n\]*\\) DW_TAG_inlined_subroutine" 6 } } */
 
 /* Likewise we should have 6 DW_TAG_lexical_block DIEs:
    - One for each subroutine inlined into main, so that's 3.
    - One for each subroutine inlined in the out of line instances
      of third, second and first, that's 3.
 */
-/* { dg-final { scan-assembler-times "\\(DIE \\(.*?\\) DW_TAG_lexical_block" 6 } } */
+/* { dg-final { scan-assembler-times "\\(DIE \\(\[^\n\]*\\) DW_TAG_lexical_block" 6 } } */
 
 
 /* There are 3 DW_AT_inline attributes: one per abstract inline instance.
Index: gcc/testsuite/gcc.target/i386/pr22152.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr22152.c	(revision 163867)
+++ gcc/testsuite/gcc.target/i386/pr22152.c	(working copy)
@@ -15,4 +15,4 @@  unsigned_add3 (const __m64 * a, const __
   return sum;
 }
 
-/* { dg-final { scan-assembler-times "movq\[ \\t\]+.*%mm" 1 } } */
+/* { dg-final { scan-assembler-times "movq\[ \\t\]+\[^\n\]*%mm" 1 } } */
Index: gcc/testsuite/gcc.target/i386/pr36992-1.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr36992-1.c	(revision 163867)
+++ gcc/testsuite/gcc.target/i386/pr36992-1.c	(working copy)
@@ -9,4 +9,4 @@  test (__m128i b)
   return _mm_move_epi64 (b);
 }
 
-/* { dg-final { scan-assembler-times "movq\[ \\t\]+.*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "movq\[ \\t\]+\[^\n\]*%xmm" 1 } } */
Index: gcc/testsuite/gcc.target/i386/pr36992-2.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr36992-2.c	(revision 163867)
+++ gcc/testsuite/gcc.target/i386/pr36992-2.c	(working copy)
@@ -9,4 +9,4 @@  test (__m128i b)
   return _mm_move_epi64 (b);
 }
 
-/* { dg-final { scan-assembler-times "movq\[ \\t\]+.*%xmm" 1 } } */
+/* { dg-final { scan-assembler-times "movq\[ \\t\]+\[^\n\]*%xmm" 1 } } */
Index: gcc/testsuite/gcc.target/sh/sh4a-memmovua.c
===================================================================
--- gcc/testsuite/gcc.target/sh/sh4a-memmovua.c	(revision 163867)
+++ gcc/testsuite/gcc.target/sh/sh4a-memmovua.c	(working copy)
@@ -2,7 +2,7 @@ 
    32-bit-aligned addresses.  */
 /* { dg-do compile { target "sh*-*-*" } } */
 /* { dg-options "-O" } */
-/* { dg-final { scan-assembler-times "\tmovua\\.l\t(.*)+" 2 } } */
+/* { dg-final { scan-assembler-times "\tmovua\\.l\t" 2 } } */
 
 #ifdef __SH4A__
 #include <string.h>