aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/predefined-function.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-16 17:45:42 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-16 17:45:42 +0000
commitcda9c674998aedeb9319e95a0284f4d266dcef32 (patch)
tree6d0dd6d6b0ed35c63e128a7525e399671d283610 /test/Sema/predefined-function.c
parentf06e9c54cb0ab54a4bbf5d92a29fac57b70cdfb9 (diff)
Adopt a more principled approach to invalid declarations:
- If a declaration is an invalid redeclaration of an existing name, complain about the invalid redeclaration then avoid adding it to the AST (we can still parse the definition or initializer, if any). - If the declaration is invalid but there is no prior declaration with that name, introduce the invalid declaration into the AST (for later error recovery). - If the declaration is an invalid redeclaration of a builtin that starts with __builtin_, we produce an error and drop the redeclaration. If it is an invalid redeclaration of a library builtin (e.g., malloc, printf), warn (don't error!) and drop the redeclaration. If a user attempts to define a builtin, produce an error and (if it's a library builtin like malloc) suggest -ffreestanding. This addresses <rdar://problem/6097585> and PR2892. However, PR3588 is still going to cause some problems when builtins are redeclared without a prototype. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64639 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/predefined-function.c')
-rw-r--r--test/Sema/predefined-function.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/test/Sema/predefined-function.c b/test/Sema/predefined-function.c
index 2a254cceb7..bce63550cc 100644
--- a/test/Sema/predefined-function.c
+++ b/test/Sema/predefined-function.c
@@ -11,7 +11,7 @@ int foo();
int foo()
{
int eli(int (int)); // expected-error {{conflicting types for 'eli'}}
- eli(b);
+ eli(b); // expected-error{{incompatible type passing}}
return 0;
}
@@ -25,13 +25,11 @@ int bar() // expected-error {{redefinition of 'bar'}}
return 0;
}
-#if 0
int foobar(int); // note {{previous declaration is here}}
int foobar() // error {{conflicting types for 'foobar'}}
{
return 0;
}
-#endif
int wibble(); // expected-note {{previous declaration is here}}
float wibble() // expected-error {{conflicting types for 'wibble'}}