diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-17 03:23:10 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-17 03:23:10 +0000 |
commit | 9add31798f621f843233dbff8bba103fca64447b (patch) | |
tree | 231b324f975bfb9bd2db0e66c3f6d3b6d0440b4e /test | |
parent | 85b2a47ec0450ee78b2c36ec482179cb4743bff7 (diff) |
Static variables and functions won't collide with standard library
functions, so if we're declaring a static we should implicitly declare
a library function by the same name (e.g., malloc, strdup). Fixes PR3592.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Sema/implicit-builtin-decl.c | 1 | ||||
-rw-r--r-- | test/Sema/implicit-builtin-redecl.c | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/test/Sema/implicit-builtin-decl.c b/test/Sema/implicit-builtin-decl.c index 892e372eff..efaf3ed455 100644 --- a/test/Sema/implicit-builtin-decl.c +++ b/test/Sema/implicit-builtin-decl.c @@ -41,4 +41,3 @@ void * realloc(void *p, int size) { // expected-warning{{incompatible redeclarat // expected-note{{use -ffreestanding to compile as a freestanding implementation}} return p; } - diff --git a/test/Sema/implicit-builtin-redecl.c b/test/Sema/implicit-builtin-redecl.c new file mode 100644 index 0000000000..837f79f4ef --- /dev/null +++ b/test/Sema/implicit-builtin-redecl.c @@ -0,0 +1,7 @@ +// RUN: clang -fsyntax-only -verify %s + +// PR3592 +static void* malloc(int); +static void* malloc(int size) { + return ((void*)0); /*do not use heap in this file*/ +} |