diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-10-03 00:31:35 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-10-03 00:31:35 +0000 |
commit | ef99e4d88a251ca162e5611b05ea769a8574a68d (patch) | |
tree | ebbd3fcf8eeb5f511d5fc2b355c2934df09d341c /clang/test | |
parent | 5312afe7e1b9646d096e92b30fcaf720c93186f9 (diff) | |
download | bcm5719-llvm-ef99e4d88a251ca162e5611b05ea769a8574a68d.tar.gz bcm5719-llvm-ef99e4d88a251ca162e5611b05ea769a8574a68d.zip |
Fix interaction of max_align_t and modules.
When building with modules enabled, we were defining max_align_t as a typedef
for a different anonymous struct type each time it was included, resulting in
an error if <stddef.h> is not covered by a module map and is included more than
once in the same modules-enabled compilation of C11 or C++11 code.
llvm-svn: 218931
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Headers/c11.c | 2 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/StdDef/include_again.h | 2 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/StdDef/module.map | 10 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/StdDef/ptrdiff_t.h | 2 | ||||
-rw-r--r-- | clang/test/Modules/stddef.c | 13 | ||||
-rw-r--r-- | clang/test/Modules/system_headers.m | 7 |
6 files changed, 34 insertions, 2 deletions
diff --git a/clang/test/Headers/c11.c b/clang/test/Headers/c11.c index b7b15011f3c..6594823c273 100644 --- a/clang/test/Headers/c11.c +++ b/clang/test/Headers/c11.c @@ -1,6 +1,6 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -fmodules -fmodules-cache-path=%t %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -fmodules -fmodules-cache-path=%t %s -D__STDC_WANT_LIB_EXT1__=1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -ffreestanding %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -triple i686-pc-win32 -fms-compatibility-version=17.00 %s diff --git a/clang/test/Modules/Inputs/StdDef/include_again.h b/clang/test/Modules/Inputs/StdDef/include_again.h new file mode 100644 index 00000000000..f29f6366cc6 --- /dev/null +++ b/clang/test/Modules/Inputs/StdDef/include_again.h @@ -0,0 +1,2 @@ +#include <stddef.h> + diff --git a/clang/test/Modules/Inputs/StdDef/module.map b/clang/test/Modules/Inputs/StdDef/module.map index 69c69eac35b..5c4e0dae7ba 100644 --- a/clang/test/Modules/Inputs/StdDef/module.map +++ b/clang/test/Modules/Inputs/StdDef/module.map @@ -8,4 +8,14 @@ module StdDef { header "other.h" export * } + + module PtrDiffT { + header "ptrdiff_t.h" + export * + } + + module IncludeAgain { + header "include_again.h" + export * + } } diff --git a/clang/test/Modules/Inputs/StdDef/ptrdiff_t.h b/clang/test/Modules/Inputs/StdDef/ptrdiff_t.h new file mode 100644 index 00000000000..acb0ab81ffc --- /dev/null +++ b/clang/test/Modules/Inputs/StdDef/ptrdiff_t.h @@ -0,0 +1,2 @@ +#define __need_ptrdiff_t +#include <stddef.h> diff --git a/clang/test/Modules/stddef.c b/clang/test/Modules/stddef.c new file mode 100644 index 00000000000..aefc90f9a11 --- /dev/null +++ b/clang/test/Modules/stddef.c @@ -0,0 +1,13 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/StdDef %s -verify -fno-modules-error-recovery + +#include "ptrdiff_t.h" + +ptrdiff_t pdt; + +size_t st; // expected-error {{must be imported}} +// expected-note@stddef.h:* {{previous}} + +#include "include_again.h" + +size_t st2; diff --git a/clang/test/Modules/system_headers.m b/clang/test/Modules/system_headers.m index 39b13ca5fc4..8adc7e85769 100644 --- a/clang/test/Modules/system_headers.m +++ b/clang/test/Modules/system_headers.m @@ -1,8 +1,13 @@ // Test that system-headerness works for building modules. // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -isystem %S/Inputs -pedantic -Werror %s -verify +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -isystem %S/Inputs -pedantic -Werror %s -verify -std=c11 // expected-no-diagnostics @import warning; int i = bigger_than_int; + +#include <stddef.h> + +#define __need_size_t +#include <stddef.h> |