* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129822
138bc75d-0d04-0410-961f-
82ee72b054a4
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>
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)
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;
}
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;
}
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))
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;
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");
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))
{
}
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;
+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
/* 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 } */
/* { 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;
}
return 1;
}
-inline int func1 (void)
-{ /* { dg-error "redefinition" } */
+inline int func1 (void) /* { dg-error "redefinition" } */
+{
return 1;
}
return 2;
}
-inline int func2 (void)
-{ /* { dg-error "redefinition" } */
+inline int func2 (void) /* { dg-error "redefinition" } */
+{
return 2;
}
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;
{
}
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;
{
}
/* 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. */
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. */
/* { 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; }