]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-tree.h (grokfield): New argument.
authorAldy Hernandez <aldyh@gcc.gnu.org>
Thu, 21 Aug 2008 17:50:01 +0000 (17:50 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Thu, 21 Aug 2008 17:50:01 +0000 (17:50 +0000)
        * c-tree.h (grokfield): New argument.
        * c-decl.c (grokfield): Handle new location argument.
        * c-parser.c (c_parser_struct_declaration): Pass location to
        grokfield.
testsuite/
        * gcc.dg/20011008-1.c: Test column.
        * gcc.dg/20080820.c: New.
        * gcc.dg/fltconst-1.c: Test column.
        * gcc.dg/cpp/cpp.exp: Add -fno-show-column.
        * gcc.dg/cpp/trad/trad.exp: Same.
        * lib/gcc.exp (gcc_target_compile): Remove -fno-show-column.
        * lib/gcc-dg.exp (process-message): Handle columns.

From-SVN: r139403

12 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/c-parser.c
gcc/c-tree.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20011008-1.c
gcc/testsuite/gcc.dg/20080820.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/cpp.exp
gcc/testsuite/gcc.dg/cpp/trad/trad.exp
gcc/testsuite/gcc.dg/fltconst-1.c
gcc/testsuite/lib/gcc-dg.exp
gcc/testsuite/lib/gcc.exp

index d29b385e39a42f3e66c851c0221a4b0f8fd6ef27..23783fd2dabf685f4bafd18f194eab59758f8ebe 100644 (file)
@@ -1,3 +1,10 @@
+2008-08-21  Aldy Hernandez  <aldyh@redhat.com>
+
+       * c-tree.h (grokfield): New argument.
+       * c-decl.c (grokfield): Handle new location argument.
+       * c-parser.c (c_parser_struct_declaration): Pass location to
+       grokfield.
+
 2008-08-21  Richard Guenther  <rguenther@suse.de>
 
        * tree-ssa-ccp.c (ccp_fold): Fold VIEW_CONVERT_EXPRs of constants.
        (compute_branch_probabilities): Refactored. Invokes mcf_smooth_cfg if
        flag_profile_correction is set.
 
+>>>>>>> .r139386
 2008-08-18  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * rtlanal.c (subreg_offset_representable_p): Check HARD_REGNO_MODE_OK.
index 857e3f25d9e4d5938ce64508c925849fd5e6b59b..056cb3860584aeb5ca11f3960f134ec392e63cb6 100644 (file)
@@ -5363,12 +5363,15 @@ start_struct (enum tree_code code, tree name)
    WIDTH is non-NULL for bit-fields only, and is an INTEGER_CST node.
    DECL_ATTRS is as for grokdeclarator.
 
+   LOC is the location of the structure component.
+
    This is done during the parsing of the struct declaration.
    The FIELD_DECL nodes are chained together and the lot of them
    are ultimately passed to `build_struct' to make the RECORD_TYPE node.  */
 
 tree
-grokfield (struct c_declarator *declarator, struct c_declspecs *declspecs,
+grokfield (location_t loc,
+          struct c_declarator *declarator, struct c_declspecs *declspecs,
           tree width, tree *decl_attrs)
 {
   tree value;
@@ -5414,10 +5417,10 @@ grokfield (struct c_declarator *declarator, struct c_declspecs *declspecs,
        }
       if (!ok)
        {
-         pedwarn (input_location, 0, "declaration does not declare anything");
+         pedwarn (loc, 0, "declaration does not declare anything");
          return NULL_TREE;
        }
-      pedwarn (input_location, OPT_pedantic, "ISO C doesn%'t support unnamed structs/unions");
+      pedwarn (loc, OPT_pedantic, "ISO C doesn%'t support unnamed structs/unions");
     }
 
   value = grokdeclarator (declarator, declspecs, FIELD, false,
index 7b7d86933320e22d35dd02ec6923f5b0aa37576b..e69b0a738694e4b4f5f32fcb338d6ea4ea039525 100644 (file)
@@ -1960,7 +1960,9 @@ c_parser_struct_declaration (c_parser *parser)
             structs or unions (which is [a] useful and [b] supports
             MS P-SDK).  */
          tree attrs = NULL;
-         ret = grokfield (build_id_declarator (NULL_TREE), specs,
+
+         ret = grokfield (c_parser_peek_token (parser)->location,
+                          build_id_declarator (NULL_TREE), specs,
                           NULL_TREE, &attrs);
          if (ret)
            decl_attributes (&ret, attrs, 0);
@@ -2003,7 +2005,8 @@ c_parser_struct_declaration (c_parser *parser)
            }
          if (c_parser_next_token_is_keyword (parser, RID_ATTRIBUTE))
            postfix_attrs = c_parser_attributes (parser);
-         d = grokfield (declarator, specs, width, &all_prefix_attrs);
+         d = grokfield (c_parser_peek_token (parser)->location,
+                        declarator, specs, width, &all_prefix_attrs);
          decl_attributes (&d, chainon (postfix_attrs,
                                        all_prefix_attrs), 0);
          TREE_CHAIN (d) = decls;
index 1fe324544f33180c88f33a7a1816c3d6f3a68a00..539254ec8f98a86a65ee3953b9005fe6fc056b8b 100644 (file)
@@ -475,8 +475,8 @@ extern tree finish_enum (tree, tree, tree);
 extern void finish_function (void);
 extern tree finish_struct (tree, tree, tree);
 extern struct c_arg_info *get_parm_info (bool);
-extern tree grokfield (struct c_declarator *, struct c_declspecs *,
-                      tree, tree *);
+extern tree grokfield (location_t, struct c_declarator *,
+                      struct c_declspecs *, tree, tree *);
 extern tree groktypename (struct c_type_name *);
 extern tree grokparm (const struct c_parm *);
 extern tree implicitly_declare (tree);
index 36ad31cb905b66ae5fbb6fd30ec4fb158ea67d24..0aa749ee35f1316a8d90575798578ac159401564 100644 (file)
@@ -1,3 +1,13 @@
+2008-08-21  Aldy Hernandez  <aldyh@redhat.com>
+
+       * gcc.dg/20011008-1.c: Test column.
+       * gcc.dg/20080820.c: New.
+       * gcc.dg/fltconst-1.c: Test column.
+       * gcc.dg/cpp/cpp.exp: Add -fno-show-column.
+       * gcc.dg/cpp/trad/trad.exp: Same.
+       * lib/gcc.exp (gcc_target_compile): Remove -fno-show-column.
+       * lib/gcc-dg.exp (process-message): Handle columns.
+
 2008-08-21  Joseph Myers  <joseph@codesourcery.com>
 
        * g++.dg/opt/anchor1.C (foo): Return the return value of
index e5c9e2cf0ee039a5c0cd8ceead4dac400978c293..e3991471a9f5dca9262b599ee8cc0ec401fe404d 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
-/* { dg-options "-O0" } */
+/* { dg-options "-O0 -fshow-column" } */
 
-struct { int; int q; } a; /* { dg-warning "does not declare anything" } */
+struct { int; int q; } a; /* { dg-warning "13:does not declare anything" } */
 struct { union {int x;}; int q; } b;
 struct { struct {int x;}; int q; } c;
 union { union {int x;}; int q; } d;
diff --git a/gcc/testsuite/gcc.dg/20080820.c b/gcc/testsuite/gcc.dg/20080820.c
new file mode 100644 (file)
index 0000000..b9dd8a7
--- /dev/null
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-fshow-column -fms-extensions -pedantic" } */
+
+struct { struct a { int x; }; int bar; } hot; /* { dg-warning "29:ISO C doesn't support unnamed" } */
index acf0898407b57b9289cf711ed69bdc6d85f0db06..1dc504e30ba8cc0d1fe1bdd128382d36f7ae6e0f 100644 (file)
@@ -37,7 +37,7 @@ dg-init
 
 # Main loop.
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,S} ]] \
-       "" $DEFAULT_CFLAGS
+       "-fno-show-column" $DEFAULT_CFLAGS
 
 # All done.
 dg-finish
index 190cfcfdee65f418903dfa56e6b69c5785e7f7df..22225e51915056ba69aa16b9efd7baf4a7ffd954 100644 (file)
@@ -37,7 +37,7 @@ dg-init
 
 # Main loop.
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
-       "" $DEFAULT_TRADCPPFLAGS
+       "-fno-show-column" $DEFAULT_TRADCPPFLAGS
 
 # All done.
 dg-finish
index bf92227064444ae60cdde66594226f5a0a22fb0a..85e1d34a583488663cfcd932c096be9c82e36b03 100644 (file)
@@ -1,16 +1,16 @@
 /* { dg-do compile } */
 /* { dg-options "-std=gnu99" } */
 
-double a = 1.ld;       /* { dg-error "invalid suffix" } */
-double b = 1.fd;       /* { dg-error "invalid suffix" } */
-double c = 1.di;       /* { dg-error "invalid suffix" } */
-double d = 1.dj;       /* { dg-error "invalid suffix" } */
-double e = 1.id;       /* { dg-error "invalid suffix" } */
-double f = 1.jd;       /* { dg-error "invalid suffix" } */
-double g = 1.ddd;      /* { dg-error "invalid suffix" } */
-double h = 1.ldd;      /* { dg-error "invalid suffix" } */
-double i = 1.dld;      /* { dg-error "invalid suffix" } */
-double j = 1.ddl;      /* { dg-error "invalid suffix" } */
-double k = 1.fdd;      /* { dg-error "invalid suffix" } */
-double l = 1.dfd;      /* { dg-error "invalid suffix" } */
-double m = 1.ddf;      /* { dg-error "invalid suffix" } */
+double a = 1.ld;       /* { dg-error "12:invalid suffix" } */
+double b = 1.fd;       /* { dg-error "12:invalid suffix" } */
+double c = 1.di;       /* { dg-error "12:invalid suffix" } */
+double d = 1.dj;       /* { dg-error "12:invalid suffix" } */
+double e = 1.id;       /* { dg-error "12:invalid suffix" } */
+double f = 1.jd;       /* { dg-error "12:invalid suffix" } */
+double g = 1.ddd;      /* { dg-error "12:invalid suffix" } */
+double h = 1.ldd;      /* { dg-error "12:invalid suffix" } */
+double i = 1.dld;      /* { dg-error "12:invalid suffix" } */
+double j = 1.ddl;      /* { dg-error "12:invalid suffix" } */
+double k = 1.fdd;      /* { dg-error "12:invalid suffix" } */
+double l = 1.dfd;      /* { dg-error "12:invalid suffix" } */
+double m = 1.ddf;      /* { dg-error "12:invalid suffix" } */
index 8d308d4246155df8bd7ce7cac355b89f08dd266f..1497ce38ed97547fc1e653cfe9d025ea02cd1bfe 100644 (file)
@@ -636,7 +636,18 @@ proc process-message { msgproc msgprefix dgargs } {
     # it match a single line.
     set newentry [lindex ${dg-messages} end]
     set expmsg [lindex $newentry 2]
-    set expmsg "$msgprefix\[^\n]*$expmsg"
+
+    # If we have a column...
+    if [regexp "^(\[0-9\]+):" $expmsg "" column] {
+       # Remove "COLUMN:"
+       regsub "^\[0-9\]+:" $expmsg "" expmsg
+
+       # Include the column in the search expression.
+       set expmsg "$column: $msgprefix\[^\n]*$expmsg"
+    } else {
+       set expmsg "$msgprefix\[^\n]*$expmsg"
+    }
+
     set newentry [lreplace $newentry 2 2 $expmsg]
     set dg-messages [lreplace ${dg-messages} end end $newentry]
     verbose "process-message:\n${dg-messages}" 2
index 286e1259f56ea41e678249ac1ea77fa3e18e5f97..5985ce061d7b2f33c93b88d50e729c9fb4b01f57 100644 (file)
@@ -150,7 +150,6 @@ proc gcc_target_compile { source dest type options } {
     if [target_info exists gcc,timeout] {
        lappend options "timeout=[target_info gcc,timeout]"
     }
-    lappend options "additional_flags=-fno-show-column"
     lappend options "compiler=$GCC_UNDER_TEST"
     set options [dg-additional-files-options $options $source]
     return [target_compile $source $dest $type $options]