Commit Graph

369 Commits

Author SHA1 Message Date
John McCall 9b0a7cea0f Make -fobjc-nonfragile-abi the -cc1 default, since it's the
increasingly prevailing case to the point that new features
like ARC don't even support the fragile ABI anymore.

This required a little bit of reshuffling with exceptions
because a check was assuming that ObjCNonFragileABI was
only being set in ObjC mode, and that's actually a bit
obnoxious to do.

Most, though, it involved a perl script to translate a ton
of test cases.

Mostly no functionality change for driver users, although
there are corner cases with disabling language-specific
exceptions that we should handle more correctly now.

llvm-svn: 140957
2011-10-02 01:16:38 +00:00
Chandler Carruth cd99bad4ac Generate tests for all of the x86 SIMD instruction feature set
predefines based on the output of GCC as well as the CPU predefines.

Invert tests for __AVX__, Clang's AVX feature is hard coded off still.

Switch Atom from 'SSE3' to 'SSSE3'. This matches GCC's behavior, Intel's
documentation, and ICC's documentation (such as I could dig up).

Switch Athlon and Geode to enable 3dnowa rather than just 3dnow and
nothing (resp.).

llvm-svn: 140692
2011-09-28 10:36:46 +00:00
Chandler Carruth e83c3d9d33 Add a little banner to this test. This lets my scripts more easily
automate the process of updating and generating these tests.

If anyone is really interested, I can check my scripts for generating
this test in, but its a horrible pile of shell... Not sure its really
worth it.

llvm-svn: 140691
2011-09-28 10:17:41 +00:00
Chandler Carruth 5d0feef373 Fix a think-o on my part that got enshrined in a FIXME by setting up the
__tune_...__ define as well.

llvm-svn: 140690
2011-09-28 09:54:11 +00:00
Chandler Carruth 6e20c2bd35 Teach Clang to reject 32-bit only CPUs when compiling in 64-bit mode.
Add 64-bit preprocessor macro tests.

llvm-svn: 140688
2011-09-28 09:45:08 +00:00
Chandler Carruth 5ac1e8e6b1 Begin fixing Clang's predefined macros for various architectures. This
is *very* much a WIP that I'll be refining over the next several
commits, but I need to get this checkpoint in place for sanity.

This also adds a much more comprehensive test for architecture macros,
which is roughly generated by inspecting the behavior of a trunk build
of GCC. It still requires some massaging, but eventually I'll even check
in the script that generates these so that others can use it to append
more tests for more architectures, etc.

Next up is a bunch of simplification of the Targets.cpp code, followed
by a lot more test cases once we can reject invalid architectures.

llvm-svn: 140673
2011-09-28 02:59:25 +00:00
Douglas Gregor b63ab9477c Only predefine the __EXCEPTIONS macro if C++ exceptions are turned on.
Only predefine the OBJC_ZEROCOST_EXCEPTIONS macro if Objective-C
exceptions are turned on. Fixes PR10910.

llvm-svn: 139496
2011-09-12 15:17:19 +00:00
Eli Friedman 3781a36238 Change err_pp_file_not_found back to an Error; when it's a Warning, we suppress it in system headers. And it is not a good idea to suppress it in system headers. (This was originally changed in r134996 to implement -MG.)
Fixes <rdar://10041960>.  And also brings down the number of warnings without a flag by one :)

llvm-svn: 138842
2011-08-30 23:07:51 +00:00
Eli Friedman b3bfd84ebb A couple fixes for preprocessor expressions:
1. Be more tolerant of comments in -CC (comment-preserving) mode.  We were missing a few cases.

2. Make sure to expand the second FOO in "#if defined FOO FOO".  (See also
r97253, which addressed the case of "#if defined(FOO FOO".)

Fixes PR10286.

llvm-svn: 136748
2011-08-03 00:04:13 +00:00
Argyrios Kyrtzidis bf65d2d820 Reenable test.
llvm-svn: 134928
2011-07-11 21:58:47 +00:00
Argyrios Kyrtzidis c645d60f12 Add missing header file for the test.
llvm-svn: 134927
2011-07-11 21:58:44 +00:00
Eli Friedman 8532db2ec4 Test is broken; XFAIL it until Argyrios gets a chance to look at it.
llvm-svn: 134925
2011-07-11 21:44:14 +00:00
Argyrios Kyrtzidis 2299889f87 Don't warn for unused macro when undef'ing it, if it comes from an included file. rdar://9745065
llvm-svn: 134919
2011-07-11 20:39:47 +00:00
NAKAMURA Takumi 1f2aacf276 test/Preprocessor/include-directive2.c: Get rid of using <float.h> to avoid #include_next on mingw.
llvm-svn: 134896
2011-07-11 14:53:27 +00:00
Argyrios Kyrtzidis e245aa2a93 When expanding macro arguments, treat '##' coming from an argument as a normal token.
e.g.

#define M(x) A x B
M(##) // should expand to 'A ## B', not 'AB'

llvm-svn: 134588
2011-07-07 03:40:37 +00:00
Douglas Gregor 3bde9b15a1 Copy diagnostic pragmas to the preprocessed output, from Richard Osborne!
llvm-svn: 133633
2011-06-22 19:41:48 +00:00
Douglas Gregor 10c1d268ea Define __cplusplus to 201103L when in (non-GNU) C++0x mode.
llvm-svn: 133437
2011-06-20 15:00:58 +00:00
Chris Lattner 848fa212e8 revert r133003 and fix the bug properly: the issue was that ## in a token
lexer is not a paste operator, it is a normal token.  This fixes a conformance
issue shown here:
http://p99.gforge.inria.fr/c99-conformance/c99-conformance-clang-2.9.html

and it defines away the crash from before.

llvm-svn: 133005
2011-06-14 18:19:37 +00:00
Chris Lattner 07efdfdafa Fix a crash on the testcase in PR9981 / rdar://9486765.
llvm-svn: 133003
2011-06-14 18:12:03 +00:00
Chris Lattner 6804685c43 attempt to fix windows testers, which generate #line by default.
llvm-svn: 131882
2011-05-22 23:47:57 +00:00
Chris Lattner 3bdc7679ce Invoke the FileChanged callback before pushing the linemarker for a system
header.  Getting it in the wrong order generated incorrect line markers in -E 
mode.  In the testcase from PR9861 we used to generate:

# 1 "test.c" 2
# 1 "./foobar.h" 1
# 0 "./foobar.h"
# 0 "./foobar.h" 3
# 2 "test.c" 2

now we properly produce:

# 1 "test.c" 2
# 1 "./foobar.h" 1
# 1 "./foobar.h" 3
# 2 "test.c" 2

This fixes PR9861.

llvm-svn: 131871
2011-05-22 22:10:16 +00:00
Argyrios Kyrtzidis 627c14a068 Only ignore extra tokens after #else if we skip it, otherwise warn. Fixes rdar://9475098.
llvm-svn: 131788
2011-05-21 04:26:04 +00:00
Eli Friedman fe0739dffb Some small improvements to the builtin (-ffreestanding) stdint.h; in
particular, make sure to handle WCHAR_MIN correctly.

llvm-svn: 130618
2011-04-30 19:02:59 +00:00
Francois Pichet 84133e41be Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin defines to real types.
Otherwise statements like:
  __int64 var = __int64(0);

would be expanded to:
  long long var = long long(0);

and fail to compile.

llvm-svn: 130369
2011-04-28 01:59:37 +00:00
Chandler Carruth 30483fb188 Move all of the logic for __DEPRECATED to the driver based on comments
from dgregor.

llvm-svn: 130066
2011-04-23 19:48:40 +00:00
Eli Friedman 4547752402 PR9772: Fix the definition of WINT_MIN and WINT_MAX on Linux -ffreestanding.
llvm-svn: 129907
2011-04-21 05:45:45 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Daniel Dunbar 3b17a865bb Change Clang's __VERSION__ to include the same basic info as in clang -v.
- Please never ever ever ever write a tool that sniffs this.

llvm-svn: 128599
2011-03-31 00:53:51 +00:00
Chandler Carruth 33bf3e758d Diagnose uninitialized uses of a variable within its own initializer.
This is basically the same idea as the warning on uninitialized uses of
fields within an initializer list. As such, it is on by default and
under -Wuninitialized.

Original patch by Richard Trieu, with some massaging from me on the
wording and grouping of the diagnostics.

llvm-svn: 128376
2011-03-27 09:46:56 +00:00
Daniel Dunbar 1057f86d0e Lexer: Add extremely limited support for -traditional-cpp, ignoring BCPL
comments.

llvm-svn: 127910
2011-03-18 21:23:38 +00:00
Peter Collingbourne 2f1e36bfd0 Rename tok::eom to tok::eod.
The previous name was inaccurate as this token in fact appears at
the end of every preprocessing directive, not just macro definitions.
No functionality change, except for a diagnostic tweak.

llvm-svn: 126631
2011-02-28 02:37:51 +00:00
Peter Collingbourne 3bffa52933 Make LexOnOffSwitch a Preprocessor member function
llvm-svn: 125473
2011-02-14 01:42:24 +00:00
Ted Kremenek e543be3531 Merge -Wuninitialized-experimental into -Wuninitialized.
llvm-svn: 124279
2011-01-26 04:49:48 +00:00
Argyrios Kyrtzidis b495cc1a7b When redefining a macro don't warn twice if it's not used and don't warn for duplicate
definition by command line options. Fixes rdar://8875916.

llvm-svn: 123767
2011-01-18 19:50:15 +00:00
Douglas Gregor e6d6e51686 wint_t is defined as 'unsigned int' on Linux. Fixes PR8938.
llvm-svn: 123320
2011-01-12 21:19:25 +00:00
Chris Lattner 56f64c14b7 fix rdar://8823139, a crash on a comment in a preprocessed .s file
that contains the ## operator.

llvm-svn: 122946
2011-01-06 05:01:51 +00:00
Argyrios Kyrtzidis 338f9aaab2 Handle locations coming from macro instantiations properly in SourceManager::isBeforeInTranslationUnit().
Fixes rdar://8790245 and http://llvm.org/PR8821.

llvm-svn: 122536
2010-12-24 02:53:53 +00:00
Argyrios Kyrtzidis 1cb0de1d4c Fix diagnostic pragmas.
Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state.
Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect
a lot of places, like C++ inline methods, template instantiations, the lexer, etc.

Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location.

Fixes rdar://8365684.

llvm-svn: 121873
2010-12-15 18:44:22 +00:00
Chandler Carruth b19289331d This really seems like a boring set of fixes to our tests to make them more
independent of the underlying system. Let me know if any of these are too
aggressive.

llvm-svn: 119345
2010-11-16 10:26:08 +00:00
John McCall 18a2c2c0b9 Split out -Wconversion warnings about constant precision into their
own subcategory, -Wconstant-conversion, which is on by default.

Tweak the constant folder to give better results in the invalid
case of a negative shift amount.

Implements rdar://problem/6792488

llvm-svn: 118636
2010-11-09 22:22:12 +00:00
Michael J. Spencer cac9df3bf6 Add test for Windows predefined macros.
llvm-svn: 117000
2010-10-21 05:23:48 +00:00
Ted Kremenek 2c8028bcf4 In ~Preprocessor(), also cleanup the MacroInfo objects left-over from stray "#pragma push_macro" uses. This
fixes a potential memory leak.

llvm-svn: 116826
2010-10-19 17:40:53 +00:00
Chris Lattner a09e8efd1f Per discussion with Sanjiv, remove the PIC16 target from mainline. When/if
it comes back, it will be largely a rewrite, so keeping the old codebase
in tree isn't helping anyone.

llvm-svn: 116191
2010-10-11 05:44:49 +00:00
Argyrios Kyrtzidis 40cec8326c Revert r114316, -Wunused-value enabled by default was intended.
llvm-svn: 114318
2010-09-19 23:03:35 +00:00
Argyrios Kyrtzidis 3698bf1c6d Make -Wunused-value off by default, matching GCC. Fixes rdar://7126194.
llvm-svn: 114316
2010-09-19 21:21:44 +00:00
Daniel Dunbar 7eba1bf0b7 Fix this test to use -cc1.
llvm-svn: 114156
2010-09-17 02:47:35 +00:00
Ted Kremenek 6174ca456f Handle '#line' in '-E' that has an empty file name. Fixes <rdar://problem/8439412>.
llvm-svn: 114142
2010-09-17 00:41:18 +00:00
Daniel Dunbar 53c9ac30f9 tests: Use -ffreestanding when including stdint.h, to avoid platform dependencies.
llvm-svn: 113301
2010-09-07 22:54:28 +00:00
Douglas Gregor 3cc2648b47 Now that GCC will have #pragma push/pop (in GCC 4.6), allow the
#pragma without requiring it to be in the "clang" namespace, from
Louis Gerbarg!

llvm-svn: 112484
2010-08-30 15:15:34 +00:00
John McCall 89e925d78e Add support for Microsoft's __pragma in the preprocessor.
Patch by Francois Pichet!

llvm-svn: 112391
2010-08-28 22:34:47 +00:00