c-decl.c (duplicate_decls): Break apart into...

* c-decl.c (duplicate_decls): Break apart into...
	(diagnose_arglist_conflict, validate_proto_after_old_defn)
	(locate_old_defn, diagnose_mismatched_decls, merge_decls):
	... these new functions.  Restructure for comprehensibility.
	Remove various archaic special cases.  Always report the
	location of the previous declaration when a diagnostic is issued.
	(redeclaration_error_message): Fold into diagnose_mismatched_decls.
	(match_builtin_function_types): Delete unnecessary forward declaration.
testsuite:
	* gcc.dg/Wshadow-1.c, gcc.dg/attr-noinline.c, gcc.dg/decl3.c
	* gcc.dg/redecl-1.c, gcc.dg/visibility-7.c, gcc.dg/wtr-static-1.c
	* gcc.dg/noncompile/20020220-1.c, objc.dg/method-1.m:
	Update dg-error regexps.

From-SVN: r75667
This commit is contained in:
Zack Weinberg 2004-01-11 01:18:58 +00:00 committed by Zack Weinberg
parent 1e8dcb41f4
commit 3c6e6fbf11
12 changed files with 591 additions and 619 deletions

View File

@ -1,3 +1,14 @@
2004-01-10 Zack Weinberg <zack@codesourcery.com>
* c-decl.c (duplicate_decls): Break apart into...
(diagnose_arglist_conflict, validate_proto_after_old_defn)
(locate_old_defn, diagnose_mismatched_decls, merge_decls):
... these new functions. Restructure for comprehensibility.
Remove various archaic special cases. Always report the
location of the previous declaration when a diagnostic is issued.
(redeclaration_error_message): Fold into diagnose_mismatched_decls.
(match_builtin_function_types): Delete unnecessary forward declaration.
2004-01-10 Zack Weinberg <zack@codesourcery.com>
* genautomata.c (make_automaton, NDFA_to_DFA):

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,10 @@
2004-01-10 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/Wshadow-1.c, gcc.dg/attr-noinline.c, gcc.dg/decl3.c
* gcc.dg/redecl-1.c, gcc.dg/visibility-7.c, gcc.dg/wtr-static-1.c
* gcc.dg/noncompile/20020220-1.c, objc.dg/method-1.m:
Update dg-error regexps.
2004-01-10 Zack Weinberg <zack@codesourcery.com>
* gcc.c-torture/compile/20021123-2.c: Delete; dup of 20021120-1.c.

View File

@ -10,7 +10,7 @@ void foo (double decl1) /* { dg-warning "shadows a global decl" } */
{
}
void foo1 (int d) /* { dg-warning "previous declaration" } */
void foo1 (int d) /* { dg-warning "previous definition" } */
{
double d; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "redeclared as different" "" { target *-*-* } 15 } */

View File

@ -13,33 +13,33 @@ static inline void __attribute__((__noinline__)) function_declaration_both_after
static void function_declaration_both_after(void) {}
static void function_declaration_noinline_before(void) __attribute__((__noinline__)); /* { dg-warning "previous declaration \[^\n\]* with attribute noinline" "" } */
static void function_declaration_noinline_before(void) __attribute__((__noinline__)); /* { dg-warning "previous declaration" "" } */
static inline void function_declaration_noinline_before(void) {} /* { dg-warning "function \[^\n\]* redeclared as inline" "" } */
static inline void function_declaration_noinline_before(void) {} /* { dg-warning "follows declaration with attribute noinline" "" } */
static inline void function_declaration_noinline_after(void) {} /* { dg-warning "previous declaration \[^\n\]* was inline" "" } */
static inline void function_declaration_noinline_after(void) {} /* { dg-warning "previous definition" "" } */
static void function_declaration_noinline_after(void) __attribute__((__noinline__)); /* { dg-warning "function \[^\n\]* redeclared with attribute noinline" "" } */
static void function_declaration_noinline_after(void) __attribute__((__noinline__)); /* { dg-warning "follows inline declaration" "" } */
static inline void function_declaration_inline_before(void); /* { dg-warning "previous declaration \[^\n\]* was inline" "" } */
static inline void function_declaration_inline_before(void); /* { dg-warning "previous declaration" "" } */
static void __attribute__((__noinline__)) function_declaration_inline_before(void) {} /* { dg-warning "function \[^\n\]* redeclared with attribute noinline" "" } */
static void __attribute__((__noinline__)) function_declaration_inline_before(void) {} /* { dg-warning "follows inline declaration" "" } */
static inline void function_declaration_inline_noinline_before(void); /* { dg-warning "previous declaration \[^\n\]* was inline" "" } */
static inline void function_declaration_inline_noinline_before(void); /* { dg-warning "previous declaration" "" } */
static void function_declaration_inline_noinline_before(void) __attribute__((__noinline__)); /* { dg-warning "function \[^\n\]* redeclared with attribute noinline" "" } */
static void function_declaration_inline_noinline_before(void) __attribute__((__noinline__)); /* { dg-warning "follows inline declaration" "" } */
static void function_declaration_inline_noinline_before(void) {}
static inline void function_declaration_inline_noinline_after(void);
static void function_declaration_inline_noinline_after(void) {} /* { dg-warning "previous declaration \[^\n\]* was inline" "" } */
static void function_declaration_inline_noinline_after(void) {} /* { dg-warning "previous definition" "" } */
static void function_declaration_inline_noinline_after(void) __attribute__((__noinline__)); /* { dg-warning "function \[^\n\]* redeclared with attribute noinline" "" } */
static void function_declaration_inline_noinline_after(void) __attribute__((__noinline__)); /* { dg-warning "follows inline declaration" "" } */
static void function_declaration_noinline_inline_before(void) __attribute__((__noinline__)); /* { dg-warning "previous declaration\[^\n\]* with attribute noinline" "" } */
static void function_declaration_noinline_inline_before(void) __attribute__((__noinline__)); /* { dg-warning "previous declaration" "" } */
static inline void function_declaration_noinline_inline_before(void); /* { dg-warning "function \[^\n\]* redeclared as inline" "" } */
static inline void function_declaration_noinline_inline_before(void); /* { dg-warning "follows declaration with attribute noinline" "" } */
static void function_declaration_noinline_inline_before(void) {}

View File

@ -1,5 +1,5 @@
/* PR c/9928 */
/* { dg-do compile } */
enum { CODES }; /* { dg-error "previous declaration" } */
enum { CODES }; /* { dg-error "previous definition" } */
enum { CODES }; /* { dg-error "conflicting types" } */

View File

@ -24,7 +24,6 @@ int main ()
return 0;
}
/* { dg-warning "passing arg 2 of" "2nd incompatible" { target *-*-* } 15 } */
/* { dg-warning "passing arg 1 of" "1st incompatible" { target *-*-* } 16 } */
/* { dg-warning "passing arg 2 of" "2nd incompatible" { target *-*-* } 16 } */
/* { dg-warning "passing arg 1 of" "1st incompatible" { target *-*-* } 18 } */

View File

@ -6,7 +6,7 @@ int foo (const char*, const char*);
void bar (void)
{
const char *s = "bar";
int i; /* { dg-error "previously declared here" } */
int i; /* { dg-error "previous declaration" } */
int size = 2;
int i = foo (s, s + size); /* { dg-error "redeclaration of" } */
}

View File

@ -74,7 +74,7 @@ void test5(void)
/* Extern then static, both at file scope. */
extern int test6(int); /* { dg-warning "previous" "" { xfail *-*-* } } */
extern int test6(int); /* { dg-warning "previous" "" } */
static int test6(int x)
{ return x; } /* { dg-warning "follows non-static" } */
@ -83,7 +83,7 @@ static int test6(int x)
void prime7(void)
{
extern int test7(int); /* { dg-warning "previous" "" { xfail *-*-* } } */
extern int test7(int); /* { dg-warning "previous" "" } */
}
static int test7(int x)
@ -93,7 +93,7 @@ static int test7(int x)
void prime8(void)
{
test8(); /* { dg-warning "previous" "" { xfail *-*-* } } */
test8(); /* { dg-warning "previous" "" } */
/* { dg-warning "implicit" "" { target *-*-* } 96 } */
}

View File

@ -5,8 +5,8 @@
extern int
__attribute__((visibility ("hidden")))
xyzzy; /* { dg-warning "previous declaration here" "" } */
xyzzy; /* { dg-warning "previous declaration" "" } */
int
__attribute__((visibility ("protected")))
xyzzy = 5; /* { dg-warning "visibility attribute ignored" "" } */
xyzzy = 5; /* { dg-warning "different visibility" "" } */

View File

@ -4,7 +4,7 @@
/* { dg-do compile } */
/* { dg-options "-Wtraditional" } */
static void testfunc1(void);
static void testfunc1(void); /* { dg-warning "previous declaration" } */
void testfunc1() {} /* { dg-warning "non-static.*follows static" "non-static follows static" } */
# 11 "sys-header.h" 3

View File

@ -16,9 +16,8 @@
@end
@implementation class3
- (int) meth1 { return 0; }
- (int) meth1 { return 0; } /* { dg-error "previous definition" } */
- (int) meth1 { return 0; } /* { dg-error "redefinition of" } */
/* { dg-error "previously defined here" "" { target *-*-* } 19 } */
@end
@interface class4
@ -26,7 +25,6 @@
@end
@implementation class4
+ (void) meth1 {}
+ (void) meth1 {} /* { dg-error "previous definition" } */
+ (void) meth1 {} /* { dg-error "redefinition of" } */
/* { dg-error "previously defined here" "" { target *-*-* } 29 } */
@end