Commit Graph

86 Commits

Author SHA1 Message Date
Hans Wennborg dd0f5304f6 MS intrinsics: don't declare __readeflags and __writeeflags in Intrin.h
They're already defined in ia32intrin.h, and this would cause including Intrin.h
in 64-bit mode to fail because of conflicting types. Update ms-intrin.cpp to
also run in 64-bit mode to catch things like this.

llvm-svn: 203714
2014-03-12 21:09:03 +00:00
Ben Langmuir 101390e116 Add -fmodules-cache-path to test/Headers/c11.c
This started failing for me the last time someone modified the AST file
format. It would be nice if we could just have lit take care of the
module cache used during testing for us, but this helps in the meantime.

llvm-svn: 203511
2014-03-10 23:17:14 +00:00
Rafael Espindola 1368f8ac96 Update for llvm change.
llvm-svn: 203000
2014-03-05 20:08:57 +00:00
David Majnemer 1e57976ec0 Headers: Provide an ABI compatible max_align_t when _MSC_VER is defined
Summary:
Our usual definition of max_align_t wouldn't match up with MSVC if it
was used in a template argument.

Reviewers: chandlerc, rsmith, rnk

Reviewed By: chandlerc

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2924

llvm-svn: 202911
2014-03-04 23:43:48 +00:00
Daniel Jasper 2f0f297bdb Revert r201734 and r201742.
This breaks backwards compatibility with existing code. Previously, this
was defined as

  #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

Which basically accepts any pointer. Changing this to char* simply
breaks a lot of existing code. I have tried changing char* to
"const void*", which seems to be the right thing as per Intel
specification this should work on basically any pointer. However,
apparently this breaks windows compatibility (because of a conflicting
declaration in windows.h).

So, we probably need to #ifdef this based on whether clang is compiling
for windows. According to Chandler, this might be done by introducing an
additional symbol to a fake type in BuiltinsX86.def and then condition
the type expansion on the platform.

llvm-svn: 201775
2014-02-20 11:10:48 +00:00
Timur Iskhodzhanov 1f2ce39006 Revert r201772 as it breaks things on Windows
We should probably use different argument types on different platforms?

llvm-svn: 201774
2014-02-20 10:46:28 +00:00
Daniel Jasper 5a02bf26fc Change parameter type of _mm_prefetch to "const void *".
Otherwise, this is not backwards compatible to the existing macro and
can break existing code.

llvm-svn: 201772
2014-02-20 10:04:07 +00:00
Daniel Jasper 2b05fd96d5 Don't actually emit output in test/Headers/mmprefetch.c.
The test directory cannot assumed to be writable.

llvm-svn: 201768
2014-02-20 08:45:49 +00:00
Warren Hunt 40d6f29ad8 Add _mm_prefetch and some others as MS builtins
This patch adds several built-ins that are required for ms 
compatibility. _mm_prefetch must be a built-in because it takes a 
compile-time constant argument and our prior approach of using a #define 
to the current built-in doesn't work in the presence of re-declaration 
of _mm_prefetch. The others can be obtained by including the windows 
system headers. If a user includes the windows system headers but not 
intrin.h they still need to work and therefore must be built-in because 
we don't get a chance to implement them in intrin.h in this case.

llvm-svn: 201734
2014-02-19 23:20:20 +00:00
Chandler Carruth e813984b43 Teach Clang to provide ::max_align_t in C11 and C++11 modes.
This definition is not chosen idly. There is an unfortunate reality with
max_align_t -- the specific nature of its definition leaks into the ABI
almost immediately. Because it is part of C11 and C++11 it becomes
essential for it to match with other systems on that ABI. There is an
effort to discourage any further use of this construct as a consequence
-- using max_align_t introduces an immediate ABI problem. We can never
update it to have larger alignment even as the microarchitecture changes
to necessitate higher alignment. =/

The particular definition here exactly matches the ABI of GCC's chosen
::max_align_t definition, for better or worse. This was written with the
help of Richard Smith who was decoding the exact ABI implications of the
selected definition in GCC. Notably, in-register arguments are impacted
by the particular definition chosen. =/

No one is under the illusion that this is a "good" or "useful"
definition of max_align_t, and we are working with the standards
committee to specify a more useful interface to address this need.

llvm-svn: 201729
2014-02-19 22:35:01 +00:00
Hans Wennborg 1fd6dd3616 Intrin.h: include setjmp.h to get a jmp_buf definition
This makes sure that the ms-intrin.cpp test passes by providing
a mock setjmp.h as a test input.

llvm-svn: 200344
2014-01-28 23:01:59 +00:00
Bob Wilson 2d5d005842 Temporarily disable test that fails on Mac OS X 10.9.
PR18322. This test will be reenabled when the SDK gets fixed. In the meantime,
it is pretty disruptive to have this test keep failing.

llvm-svn: 200256
2014-01-27 22:43:21 +00:00
Alp Toker 6bd95b8aac Add a proper test for -Wsystem-headers
This will be extended as we fix issues in the current implementation.

llvm-svn: 200054
2014-01-25 00:32:40 +00:00
Hans Wennborg 72005cb59d ms-intrin.cpp: add -Werror to the test
llvm-svn: 199450
2014-01-17 01:41:07 +00:00
Hans Wennborg b3dec1b4b9 ms-intrin.cpp: no need for -verify anymore
llvm-svn: 199442
2014-01-17 00:04:43 +00:00
Hans Wennborg aae6ac48e7 Relax the ms-intrin.cpp test
The part that checks that certain functions are marked deprecated doesn't
seem that useful, and it has the bad effect that the test hard-coded the
locations of the notes from that test.

llvm-svn: 199441
2014-01-16 23:59:08 +00:00
Alp Toker 11a71128b7 Forbid driver use in Sema tests
This ports the last Sema tests over to use the frontend directly, and adds a
local lit substitution to disable inappropriate %clang usage under this
directory.

llvm-svn: 199348
2014-01-16 02:37:08 +00:00
Nico Weber 428a93b8ab Add a FIXME to a failing test.
(See discussion in the bug for why this isn't XFAILed.)

llvm-svn: 197991
2013-12-24 20:48:13 +00:00
Ted Kremenek b79ee57080 Implemented delayed processing of 'unavailable' checking, just like with 'deprecated'.
Fixes <rdar://problem/15584219> and <rdar://problem/12241361>.

This change looks large, but all it does is reuse and consolidate
the delayed diagnostic logic for deprecation warnings with unavailability
warnings.  By doing so, it showed various inconsistencies between the
diagnostics, which were close, but not consistent.  It also revealed
some missing "note:"'s in the deprecated diagnostics that were showing
up in the unavailable diagnostics, etc.

This change also changes the wording of the core deprecation diagnostics.
Instead of saying "function has been explicitly marked deprecated"
we now saw "'X' has been been explicitly marked deprecated".  It
turns out providing a bit more context is useful, and often we
got the actual term wrong or it was not very precise
 (e.g., "function" instead of "destructor").  By just saying the name
of the thing that is deprecated/deleted/unavailable we define
this issue away.  This diagnostic can likely be further wordsmithed
to be shorter.

llvm-svn: 197627
2013-12-18 23:30:06 +00:00
NAKAMURA Takumi 7cbe30fc43 clang/test: REQUIRES: s/ppc{32|64}-registered-target/powerpc-registered-target/
llvm-svn: 196349
2013-12-04 03:41:15 +00:00
JF Bastien 1334d0aedf Define [U]LLONG_{MIN,MAX} for C++11, add tests.
Add tests for limits.h, not just [U]LLONG_{MIN,MAX}.

llvm-svn: 193506
2013-10-27 19:00:49 +00:00
Reid Kleckner 00d33a5cb1 Add implementations of the MSVC barrier intrinsics
Summary:
These are deprecated in VS 2012 according to MSDN.  They don't actually
compile down to any code.  They prevent the compiler from reordering
memory accesses across the barrier, which is what a memory-clobbering
volatile asm does.

Reviewers: echristo

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1954

llvm-svn: 192860
2013-10-17 01:29:48 +00:00
Chandler Carruth 2c93cb2a6f Switch tests in test/Headers to use %clang_cc1 rather than %clang. There
is no need to go through the driver indirection here, and it clutters
things up as dependencies can sneak in for specific things the driver is
doing.

llvm-svn: 191107
2013-09-20 21:12:25 +00:00
Reid Kleckner 2f7fe8acb3 Use -ffreestanding in ms-intrin.cpp and define size_t manually.
llvm-svn: 190985
2013-09-19 01:54:40 +00:00
Reid Kleckner 5cc15addbe Avoid including <stdlib.h> in the intrin.h test
llvm-svn: 190979
2013-09-19 00:32:11 +00:00
Reid Kleckner f0e232287a Fix ifdef ordering at the end of Intrin.h from r190965
Test that intrin.h at least parses in C++ TUs.

llvm-svn: 190978
2013-09-19 00:19:53 +00:00
Peter Collingbourne ec1cb850d1 Add missing definitions to unwind.h.
Original patch by Charles Davis.

llvm-svn: 189535
2013-08-28 23:16:49 +00:00
Hans Wennborg d1ddb9afd4 CC1: Only parse command-line options that have the CC1Option flag.
We already reject flags that don't have the CC1Option flag,
but we would previously do so after parsing the command-line
arguments.

Since the option parser now has a parameter for excluding options,
we should just use that instead.

Differential Revision: http://llvm-reviews.chandlerc.com/D1270

llvm-svn: 187668
2013-08-02 20:16:22 +00:00
Richard Smith a9d6a0e1f8 Enable -ffreestanding for this test, to avoid #include_next'ing the system's
<stdint.h> (which might not exist or might not work).

llvm-svn: 185565
2013-07-03 18:35:53 +00:00
Richard Smith 2edd9709c6 Remove dependence on system headers from this test, to try to make the Windows bots happier.
llvm-svn: 181558
2013-05-09 22:45:27 +00:00
Richard Smith 8797d39fd9 Add testcase missed from r181527.
llvm-svn: 181531
2013-05-09 18:33:50 +00:00
Benjamin Kramer 4baf67a61b xopintrin.h: Add wrappers for all flavors of _mm_com.
GCC defines only the wrappers, MSVC defines both, we define both now too.
PR15844.

llvm-svn: 181514
2013-05-09 15:07:46 +00:00
Hans Wennborg 4c02be3b83 Make sure we define wchar_t related macros correctly in -fms-extensions mode.
This adds a test to make sure we define _WCHAR_T_DEFINED and
_NATIVE_WCHAR_T_DEFINED correctly in the preprocessor, and updates
stddef.h to set it when typedeffing wchar_t.

llvm-svn: 180918
2013-05-02 13:12:32 +00:00
Daniel Dunbar 893f3d54d9 [tests] Only include stdint.h if we are in freestanding mode.
- We shouldn't even try to include stdint.h in hosted mode, as the dependency
   on even parsing a platforms stdint.h might fail for some targets.

llvm-svn: 179723
2013-04-17 21:11:07 +00:00
Daniel Dunbar 50b8b5507b Headers: Don't try to use RSIZE_MAX unless we are freestanding.
- We don't want to depend on the platforms stdint.h.

llvm-svn: 179429
2013-04-12 23:41:08 +00:00
Daniel Dunbar 95f1de3de5 Headers: Add support for ISO9899:2011 rsize_t.
llvm-svn: 179427
2013-04-12 23:24:56 +00:00
Richard Smith 2362829734 tl;dr: Teach Clang to work around g++ changing its workaround to glibc's
implementation of C99's attempt to control the C++ standard. *sigh*


The C99 standard says that certain macros in <stdint.h>, such as SIZE_MAX,
should not be defined when the header is included in C++ mode, unless
__STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined. The C++11 standard
says "Thanks, but no thanks" and C11 removed this rule, but various C library
implementations (such as glibc) follow C99 anyway.

g++ prior to 4.8 worked around the C99 / glibc behavior by defining
__STDC_*_MACROS in <cstdint>, which was incorrect, because <stdint.h> is
supposed to provide these macros too. g++ 4.8 works around it by defining
__STDC_*_MACROS in its builtin <stdint.h> header.

This change makes Clang act like g++ 4.8 in this regard: our <stdint.h> now
countermands any attempt by the C library to implement the undesired C99 rules,
by defining the __STDC_*_MACROS first. Unlike g++, we do this even in C++98
mode, since that was the intent of the C++ committee, matches the behavior
required in C11, and matches our built-in implementation of <stdint.h>.

llvm-svn: 179419
2013-04-12 22:11:07 +00:00
Richard Smith 5dacbec4aa Don't build this test with modules for now, it's causing buildbot failures.
llvm-svn: 178740
2013-04-04 03:48:33 +00:00
Richard Smith 584f7dcc0e Add tests that build modules for our builtin headers, and fix two buglets exposed by doing so.
llvm-svn: 178736
2013-04-04 02:55:24 +00:00
Richard Smith 8acb4044d8 libstdc++'s <cstdalign> #includes <stdalign.h> and expects it to guard against
being included in C++. Don't define alignof or alignas in this case. Note that
the C++11 standard is broken in various ways here (it refers to the contents
of <stdalign.h> in C99, where that header did not exist, and doesn't mention
the alignas macro at all), but we do our best to do what it intended.

llvm-svn: 175708
2013-02-21 02:17:58 +00:00
Douglas Gregor 1a347f76c2 Reinstate r173952, this time limiting it to exactly the form
#define X X

for which there is no point warning, ever.

llvm-svn: 173991
2013-01-30 23:10:17 +00:00
Argyrios Kyrtzidis a94bd438f8 Revert "[preprocessor] Don't warn about "disabled expansion of recursive macro""
This reverts commit r173952

llvm-svn: 173970
2013-01-30 20:42:17 +00:00
Argyrios Kyrtzidis 8c8684bbe1 [preprocessor] Don't warn about "disabled expansion of recursive macro"
for "#define X X".

This is a pattern that, for example, stdbool.h uses.
rdar://12435773

llvm-svn: 173952
2013-01-30 18:55:52 +00:00
Richard Smith 4dab709484 C11: Provide the missing half of <stdalign.h>
llvm-svn: 173900
2013-01-30 06:33:54 +00:00
Richard Smith 0015f09877 Parsing support for C11's _Noreturn keyword. No semantics yet.
llvm-svn: 172761
2013-01-17 22:16:11 +00:00
Michael Gottesman 3d423040f5 [clang tests] Added require ppc64-registered-target to Headers/altivec-header.c to ensure it only runs on ppc64.
llvm-svn: 167162
2012-10-31 20:20:04 +00:00
Ulrich Weigand 9936f137eb Add "static" to some functions in altivec.c where it was missing.
llvm-svn: 167148
2012-10-31 18:17:07 +00:00
Andy Gibbs c6e68daac0 Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.
llvm-svn: 166280
2012-10-19 12:44:48 +00:00
Jordan Rose 8ba0fba28a Use %clang_cc1 so that the test works even if the target isn't available.
Xcode-style clang builds only support Xcode's architectures, so mips
isn't available and the driver tries to use gcc instead. cc1 will go
ahead and do -fsyntax-only for any platform it knows about even if it
can't actually compile.

llvm-svn: 164742
2012-09-27 01:40:12 +00:00
Jordan Rose 17df40d484 Make our mini-stdint.h platform-independent by using predefined macros.
This also adds a definition for uint64_t, which was causing build failures
on some platforms. (I'm actually surprised this didn't happen on more
builders, but maybe the search paths are different.)

llvm-svn: 164706
2012-09-26 16:41:11 +00:00