Commit Graph

92 Commits

Author SHA1 Message Date
Chris Lattner d330036c06 The awesome GNU "comma elision extension" works with both the standard
__VA_ARGS__ syntax as well as with the amazingly awesome GNU "named 
variadic macro" extension.  Allow it with the GNU syntax as well.

llvm-svn: 50843
2008-05-08 05:10:33 +00:00
Chris Lattner db65ff7223 Fix a few more bugs in preprocessor expressions w.r.t. ?:. Now I
think it is really right. :)  This fixes PR2284.

llvm-svn: 50665
2008-05-05 20:07:41 +00:00
Chris Lattner 3c57f7ebab fix a bug handling right associative operators that Neil noticed, hopefully
the final part of PR2279

llvm-svn: 50635
2008-05-05 04:10:51 +00:00
Chris Lattner d89e458ce0 Fix the rest of PR2279:
a) correct rejection of ',' in pp expressions.
b) the precedence of ',' was wrong w.r.t. ?:.

Thanks again to Neil for finding these and providing testcases.

llvm-svn: 50625
2008-05-04 18:36:18 +00:00
Chris Lattner a08f869c22 Fix PR2279 part C: shifts don't perform the UACs, thanks to Neil
for pointing this out.

llvm-svn: 50624
2008-05-04 18:25:32 +00:00
Chris Lattner 0a9718eab0 fix a nasty bug that Neil identifier in pp-expr parsing (this is PR2279 part D).
llvm-svn: 50617
2008-05-04 07:15:21 +00:00
Chris Lattner f8f945499c Fix PR2220, making diagnostics for unexpected tokens in pp expressions
more nice.

llvm-svn: 49619
2008-04-13 20:38:43 +00:00
Chris Lattner 4f55259237 fix this test.
llvm-svn: 48668
2008-03-22 00:07:50 +00:00
Sam Bishop f4303edfa3 Only invoke the preprocessor; it's the only thing being tested. Also, check
the output to make sure that the macros and comments are being treated as such.

llvm-svn: 48638
2008-03-21 08:05:55 +00:00
Sam Bishop 558447416d Use the -E option when invoking clang. Only the preprocessor is
required to perform this test.

llvm-svn: 48636
2008-03-21 07:02:04 +00:00
Chris Lattner 54ee63886e remove two obsolete tests, not sure why my previous commit didn't commit the removal.
llvm-svn: 47986
2008-03-06 05:47:17 +00:00
Lauro Ramos Venancio 8983891531 Fix PR2086.
llvm-svn: 47551
2008-02-25 19:03:15 +00:00
Chris Lattner 27055194b7 Fix CheckEndOfDirective to diagnose lines that contain macros that expand to
zero tokens.  This fixes PR2045, thanks to Neil for finding another 
incredibly subtle corner case :)

llvm-svn: 47203
2008-02-16 01:20:36 +00:00
Chris Lattner 3b5054dda0 Implement support for the extremely atrocious MS /##/ extension,
which pastes together a comment.  This is only enabled with 
-fms-extensions of course.

llvm-svn: 46845
2008-02-07 06:03:59 +00:00
Chris Lattner 0c8a1edb8b Fix a bug where we would incorrectly emit a "cannot paste" error
message when handling the GNU ", ## __VA_ARGS__" extension.  While
I'm at it, flag uses of this as extensions.

llvm-svn: 46503
2008-01-29 07:54:23 +00:00
Chris Lattner 7238225c28 add support for -Wundef.
llvm-svn: 46274
2008-01-23 17:19:46 +00:00
Chris Lattner 97ff7763dc Fix PR1936, a crash on malformed #if. Thanks to Neil for
noticing this!

llvm-svn: 46256
2008-01-22 19:34:51 +00:00
Chris Lattner 15346fae70 avoid pasting L + "foo" into L"foo".
llvm-svn: 46000
2008-01-15 05:22:14 +00:00
Chris Lattner a30be59fa2 Fix a nasty corner case that Neil noticed in PR1900, where we would
incorrectly apply the multiple include optimization to files with 
guards like:

#if !defined(x) MACRO

where MACRO could expand to different things in different contexts.
Thanks Neil!

llvm-svn: 45716
2008-01-07 19:50:27 +00:00
Chris Lattner 58c8be81bb add run line
llvm-svn: 44917
2007-12-12 06:20:40 +00:00
Chris Lattner 2fbe8e98c4 add runline, make this test real.
llvm-svn: 44916
2007-12-12 06:20:18 +00:00
Chris Lattner 3ed83c1c0f The flags on tokens indicate whether they are the start of a *physical* line,
not the start of a logical line.  Be careful about this distinction, which 
affects when newlines are printed and when paste-avoidance happens, etc.  
This fixes PR1848, thanks to Neil for noticing this!

llvm-svn: 44743
2007-12-09 21:11:08 +00:00
Chris Lattner 9fcdc52243 Fix PR1820, an incredibly subtle macro expansion bug that Neil discovered.
Neil, please review this fix.

llvm-svn: 44285
2007-11-23 06:50:21 +00:00
Chris Lattner 609d413363 fix a bug Steve noticed, where a #import of the main file itself would fail.
llvm-svn: 44178
2007-11-15 19:07:47 +00:00
Chris Lattner d05e44e74e If we see an invalid #ifdef directive, enter a conditional compilation region
so that we don't emit an error on the #endif.  Suggestion by Neil.

llvm-svn: 42258
2007-09-24 05:14:57 +00:00
Chris Lattner 43eafb4ed5 implement a missing feature in the #include handler, where
it did not handle <xyz> headers coming from macro expansions.
This requires special treatment, as the include name is lexed
as multiple tokens, which require reassembly before processing.

llvm-svn: 40418
2007-07-23 04:56:47 +00:00
Chris Lattner 24dbee71ab Fix a stringizing bug that Neil noticed. We should preprocess this:
#define t(x) #x
t(a
c)

to "a c", not "ac".

llvm-svn: 40060
2007-07-19 16:11:58 +00:00
Chris Lattner 5c98379b1c Correctly respect C99 5.1.1.2p4 when searching for the first '(' of
a function-like macro invocation.  Patch contributed by Neil Booth.

llvm-svn: 40026
2007-07-19 00:07:36 +00:00
Chris Lattner 99ca091b9c Warn when performing 'usual' conversions that require a sign change. This
implements test/Preprocessor/expr_usual_conversions.c, which produces this
output:

expr_usual_conversions.c:5:10: warning: left side of operator converted from negative value to unsigned: -42 to 18446744073709551574
#if (-42 + 0U) / -2
         ^
expr_usual_conversions.c:5:16: warning: right side of operator converted from negative value to unsigned: -2 to 18446744073709551614
#if (-42 + 0U) / -2
               ^

llvm-svn: 39406
2007-04-11 04:14:45 +00:00
Chris Lattner 9e2fcccc33 Fix run line
llvm-svn: 39401
2007-04-10 07:06:36 +00:00
Chris Lattner a7fa1b247c 'true' in a CPP expression evaluates to 1 when in C++ mode. This implements
test/Preprocessor/cxx_true.cpp

llvm-svn: 39399
2007-04-10 06:16:30 +00:00
Chris Lattner 6acf759735 new testcase
llvm-svn: 39396
2007-04-10 05:25:39 +00:00
Chris Lattner 1b65aaef2b improve this test to also check -fno-operator-keywords.
llvm-svn: 39246
2006-12-04 18:00:36 +00:00
Chris Lattner c5b966f893 check minutia of the standard.
llvm-svn: 39215
2006-11-21 17:31:32 +00:00
Chris Lattner 5b9f4891d7 Add support for C++ operator keywords. Patch by Bill Wendling.
llvm-svn: 39214
2006-11-21 17:23:33 +00:00
Chris Lattner ce999c490a new testcase
llvm-svn: 39068
2006-10-27 05:43:33 +00:00
Chris Lattner a32cda40b5 make this harder
llvm-svn: 39054
2006-10-25 06:21:19 +00:00
Chris Lattner 1178cbd941 new testcase
llvm-svn: 39053
2006-10-25 06:18:35 +00:00
Chris Lattner 2bda2df3dc new testcase
llvm-svn: 39020
2006-10-20 05:08:12 +00:00
Chris Lattner 02846975da new testcase
llvm-svn: 38982
2006-10-14 19:53:37 +00:00
Chris Lattner 3e8b4d2854 new testcase for #define_target.
llvm-svn: 38981
2006-10-14 19:09:13 +00:00
Chris Lattner 8f46a38503 new testcase
llvm-svn: 38953
2006-10-06 02:59:40 +00:00
Chris Lattner cc211add25 Make this testcase pass the right arg.
llvm-svn: 38829
2006-08-06 18:31:20 +00:00
Chris Lattner b10969b9b2 new testcase
llvm-svn: 38799
2006-07-30 07:33:49 +00:00
Chris Lattner 022b62e941 new testcase
llvm-svn: 38798
2006-07-30 07:20:09 +00:00
Chris Lattner 8d31b5d1aa new testcase
llvm-svn: 38794
2006-07-29 07:32:40 +00:00
Chris Lattner 2641bd549c new testcase
llvm-svn: 38792
2006-07-29 07:19:41 +00:00
Chris Lattner 5b123fde96 new testcase
llvm-svn: 38790
2006-07-29 07:08:39 +00:00
Chris Lattner b631d7ce6c new testcase
llvm-svn: 38789
2006-07-29 06:59:47 +00:00
Chris Lattner 232daf6834 testcase from the c99 standard
llvm-svn: 38788
2006-07-29 06:48:55 +00:00