summaryrefslogtreecommitdiff
path: root/test/SemaCXX/Inputs
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-12 07:32:17 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-12 07:32:17 +0000
commite13ad837709cd7730e18d8af1cf6b7d35a56d6b7 (patch)
treeca2e49deee5dc33eb0730ebf041c66f26a96d39b /test/SemaCXX/Inputs
parent96058953c72355efb266abe8e333db4f5715dbd2 (diff)
Work around an annoying, non-standard optimization in the glibc
headers, where malloc (and many other libc functions) are declared with empty throw specifications, e.g., extern void *malloc (__SIZE_TYPE__ __size) throw () __attribute__ ((__malloc__)) ; The C++ standard doesn't seem to allow this, and redeclaring malloc as the standard permits (as follows) resulted in Clang (rightfully!) complaining about mis-matched exception specifications. void *malloc(size_t size); We work around this by silently propagating an empty throw specification "throw()" from a function with C linkage declared in a system header to a redeclaration that has no throw specifier. Ick. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95969 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/Inputs')
-rw-r--r--test/SemaCXX/Inputs/lit.local.cfg1
-rw-r--r--test/SemaCXX/Inputs/malloc.h3
2 files changed, 4 insertions, 0 deletions
diff --git a/test/SemaCXX/Inputs/lit.local.cfg b/test/SemaCXX/Inputs/lit.local.cfg
new file mode 100644
index 0000000000..e6f55eef7a
--- /dev/null
+++ b/test/SemaCXX/Inputs/lit.local.cfg
@@ -0,0 +1 @@
+config.suffixes = []
diff --git a/test/SemaCXX/Inputs/malloc.h b/test/SemaCXX/Inputs/malloc.h
new file mode 100644
index 0000000000..c54d621501
--- /dev/null
+++ b/test/SemaCXX/Inputs/malloc.h
@@ -0,0 +1,3 @@
+extern "C" {
+extern void *malloc (__SIZE_TYPE__ __size) throw () __attribute__ ((__malloc__)) ;
+}