diff options
author | Tom Tromey <tromey@redhat.com> | 2007-11-01 15:31:12 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-11-01 15:31:12 +0000 |
commit | 5af28c745214bb36de18d625705d6328373164cb (patch) | |
tree | 3a0a70e9966b269f5ebf022b1b4791ced82f6bd8 /gcc | |
parent | 18aa09d19539fd8d1ca5337d1410e3e21d24a971 (diff) | |
download | gcc-5af28c745214bb36de18d625705d6328373164cb.zip gcc-5af28c745214bb36de18d625705d6328373164cb.tar.gz gcc-5af28c745214bb36de18d625705d6328373164cb.tar.bz2 |
c-decl.c (grokdeclarator): Set decl source locations.
gcc
* c-decl.c (grokdeclarator): Set decl source locations.
* c-parser.c (c_parser_enum_specifier): Set location.
(c_parser_struct_or_union_specifier): Likewise.
gcc/testsuite
* gcc.dg/redecl-1.c: Update.
* gcc.dg/pr20368-3.c: Update.
* gcc.dg/inline-14.c: Update.
* gcc.dg/builtins-30.c: Update.
* gcc.dg/dremf-type-compat-4.c: Update.
* gcc.dg/pr20368-2.c: Update.
From-SVN: r129822
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-decl.c | 4 | ||||
-rw-r--r-- | gcc/c-parser.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-30.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dremf-type-compat-4.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/inline-14.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr20368-2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr20368-3.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/redecl-1.c | 12 |
10 files changed, 50 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 68ec0ed..7363e52 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2007-11-01 Tom Tromey <tromey@redhat.com> + * c-decl.c (grokdeclarator): Set decl source locations. + * c-parser.c (c_parser_enum_specifier): Set location. + (c_parser_struct_or_union_specifier): Likewise. + +2007-11-01 Tom Tromey <tromey@redhat.com> + * print-tree.c (print_node): Print column number. 2007-11-01 Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 1152253..5ddbcc0 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4645,6 +4645,7 @@ grokdeclarator (const struct c_declarator *declarator, if (type_quals) type = c_build_qualified_type (type, type_quals); decl = build_decl (TYPE_DECL, declarator->u.id, type); + DECL_SOURCE_LOCATION (decl) = declarator->id_loc; if (declspecs->explicit_signed_p) C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1; if (declspecs->inline_p) @@ -4740,6 +4741,7 @@ grokdeclarator (const struct c_declarator *declarator, type_as_written = type; decl = build_decl (PARM_DECL, declarator->u.id, type); + DECL_SOURCE_LOCATION (decl) = declarator->id_loc; if (size_varies) C_DECL_VARIABLE_SIZE (decl) = 1; @@ -4779,6 +4781,7 @@ grokdeclarator (const struct c_declarator *declarator, } type = c_build_qualified_type (type, type_quals); decl = build_decl (FIELD_DECL, declarator->u.id, type); + DECL_SOURCE_LOCATION (decl) = declarator->id_loc; DECL_NONADDRESSABLE_P (decl) = bitfield; if (bitfield && !declarator->u.id) TREE_NO_WARNING (decl) = 1; @@ -4815,6 +4818,7 @@ grokdeclarator (const struct c_declarator *declarator, } decl = build_decl (FUNCTION_DECL, declarator->u.id, type); + DECL_SOURCE_LOCATION (decl) = declarator->id_loc; decl = build_decl_attribute_variant (decl, decl_attr); if (pedantic && type_quals && !DECL_IN_SYSTEM_HEADER (decl)) diff --git a/gcc/c-parser.c b/gcc/c-parser.c index bdf96ca..2914826 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -1707,6 +1707,8 @@ c_parser_enum_specifier (c_parser *parser) gcc_assert (c_parser_next_token_is_keyword (parser, RID_ENUM)); c_parser_consume_token (parser); attrs = c_parser_attributes (parser); + /* Set the location in case we create a decl now. */ + c_parser_set_source_position_from_token (c_parser_peek_token (parser)); if (c_parser_next_token_is (parser, CPP_NAME)) { ident = c_parser_peek_token (parser)->value; @@ -1728,6 +1730,7 @@ c_parser_enum_specifier (c_parser *parser) tree enum_value; tree enum_decl; bool seen_comma; + c_token *token; if (c_parser_next_token_is_not (parser, CPP_NAME)) { c_parser_error (parser, "expected identifier"); @@ -1735,7 +1738,10 @@ c_parser_enum_specifier (c_parser *parser) values = error_mark_node; break; } - enum_id = c_parser_peek_token (parser)->value; + token = c_parser_peek_token (parser); + enum_id = token->value; + /* Set the location in case we create a decl now. */ + c_parser_set_source_position_from_token (token); c_parser_consume_token (parser); if (c_parser_next_token_is (parser, CPP_EQ)) { @@ -1848,6 +1854,8 @@ c_parser_struct_or_union_specifier (c_parser *parser) } c_parser_consume_token (parser); attrs = c_parser_attributes (parser); + /* Set the location in case we create a decl now. */ + c_parser_set_source_position_from_token (c_parser_peek_token (parser)); if (c_parser_next_token_is (parser, CPP_NAME)) { ident = c_parser_peek_token (parser)->value; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd1f046..e42f1ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2007-11-01 Tom Tromey <tromey@redhat.com> + + * gcc.dg/redecl-1.c: Update. + * gcc.dg/pr20368-3.c: Update. + * gcc.dg/inline-14.c: Update. + * gcc.dg/builtins-30.c: Update. + * gcc.dg/dremf-type-compat-4.c: Update. + * gcc.dg/pr20368-2.c: Update. + 2007-11-01 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/33673 diff --git a/gcc/testsuite/gcc.dg/builtins-30.c b/gcc/testsuite/gcc.dg/builtins-30.c index f4e9859..65a78fe 100644 --- a/gcc/testsuite/gcc.dg/builtins-30.c +++ b/gcc/testsuite/gcc.dg/builtins-30.c @@ -6,22 +6,22 @@ extern double strtod (const char *, char **); /* A built-in function may be overridden by an old-style definition specifying too few arguments... */ -double cos () -{ /* { dg-warning "shadows a built-in" } */ +double cos () /* { dg-warning "shadows a built-in" } */ +{ /* { dg-warning "number of arguments doesn't match built-in prototype" "built-in" { target *-*-* } 10 } */ return strtod ("nan", 0); } /* the right number, but the wrong type, arguments... */ -double sin (foo) - int foo UNUSED; /* { dg-warning "shadows a built-in" } */ +double sin (foo) /* { dg-warning "shadows a built-in" } */ + int foo UNUSED; { /* { dg-warning "argument 'foo' doesn't match built-in prototype" } */ return strtod ("nan", 0); } /* or too many arguments. */ -long double cosl (foo, bar) - const char *foo UNUSED; /* { dg-warning "shadows a built-in" } */ +long double cosl (foo, bar) /* { dg-warning "shadows a built-in" } */ + const char *foo UNUSED; int bar UNUSED; { /* { dg-warning "number of arguments doesn't match built-in prototype" } */ /* { dg-warning "argument 'foo' doesn't match built-in prototype" "foo" { target *-*-* } 26 } */ diff --git a/gcc/testsuite/gcc.dg/dremf-type-compat-4.c b/gcc/testsuite/gcc.dg/dremf-type-compat-4.c index f815994..b3a2c5a 100644 --- a/gcc/testsuite/gcc.dg/dremf-type-compat-4.c +++ b/gcc/testsuite/gcc.dg/dremf-type-compat-4.c @@ -6,8 +6,8 @@ /* { dg-options "" } */ float -dremf(x, y) - float x, y; /* { dg-warning "conflicting types for built-in function 'dremf'" } */ +dremf(x, y) /* { dg-warning "conflicting types for built-in function 'dremf'" } */ + float x, y; { return x + y; } diff --git a/gcc/testsuite/gcc.dg/inline-14.c b/gcc/testsuite/gcc.dg/inline-14.c index 0987c7c..cef6277 100644 --- a/gcc/testsuite/gcc.dg/inline-14.c +++ b/gcc/testsuite/gcc.dg/inline-14.c @@ -7,8 +7,8 @@ extern inline int func1 (void) return 1; } -inline int func1 (void) -{ /* { dg-error "redefinition" } */ +inline int func1 (void) /* { dg-error "redefinition" } */ +{ return 1; } @@ -17,7 +17,7 @@ inline int func2 (void) return 2; } -inline int func2 (void) -{ /* { dg-error "redefinition" } */ +inline int func2 (void) /* { dg-error "redefinition" } */ +{ return 2; } diff --git a/gcc/testsuite/gcc.dg/pr20368-2.c b/gcc/testsuite/gcc.dg/pr20368-2.c index ca4a3e0..7faded6 100644 --- a/gcc/testsuite/gcc.dg/pr20368-2.c +++ b/gcc/testsuite/gcc.dg/pr20368-2.c @@ -6,7 +6,7 @@ extern __typeof (f) g; /* { dg-error "'f' undeclared here \\(not in a function\\)" } */ int -f (x) - float x; /* { dg-warning "no previous prototype for 'f'" } */ +f (x) /* { dg-warning "no previous prototype for 'f'" } */ + float x; { } diff --git a/gcc/testsuite/gcc.dg/pr20368-3.c b/gcc/testsuite/gcc.dg/pr20368-3.c index 9302077..0d0ea6d 100644 --- a/gcc/testsuite/gcc.dg/pr20368-3.c +++ b/gcc/testsuite/gcc.dg/pr20368-3.c @@ -6,7 +6,7 @@ extern __typeof (f) g; /* { dg-error "'f' undeclared here \\(not in a function\\)" } */ int -f (x) - float x; /* { dg-warning "no previous declaration for 'f'" } */ +f (x) /* { dg-warning "no previous declaration for 'f'" } */ + float x; { } diff --git a/gcc/testsuite/gcc.dg/redecl-1.c b/gcc/testsuite/gcc.dg/redecl-1.c index cfabc8d..61d6e5b 100644 --- a/gcc/testsuite/gcc.dg/redecl-1.c +++ b/gcc/testsuite/gcc.dg/redecl-1.c @@ -76,8 +76,8 @@ void test5(void) /* Extern then static, both at file scope. */ extern int test6(int); /* { dg-error "previous" "" } */ -static int test6(int x) -{ return x; } /* { dg-error "follows non-static" } */ +static int test6(int x) /* { dg-error "follows non-static" } */ +{ return x; } /* Extern then static, extern at previous function scope. */ @@ -87,8 +87,8 @@ void prime7(void) extern int test7(int); /* { dg-error "previous" "" } */ } -static int test7(int x) -{ return x; } /* { dg-error "follows non-static" } */ +static int test7(int x) /* { dg-error "follows non-static" } */ +{ return x; } /* Implicit decl then static. */ @@ -98,5 +98,5 @@ void prime8(void) /* { dg-warning "implicit" "implicit" { target *-*-* } 97 } */ } -static int test8(int x) -{ return x; } /* { dg-error "follows non-static" } */ +static int test8(int x) /* { dg-error "follows non-static" } */ +{ return x; } |