Commit Graph

1022 Commits

Author SHA1 Message Date
Anders Carlsson 2898af59dc Update tests
llvm-svn: 81802
2009-09-14 22:00:20 +00:00
Sam Weinig b7608d7064 -Wchar-subscripts should not warn for explicit signed char subscripts either. Another fix for PR4978.
llvm-svn: 81780
2009-09-14 20:14:57 +00:00
Sam Weinig 80cf843fe9 -Wchar-subscripts should not warn for unsigned char subscripts. Fixes PR4978.
llvm-svn: 81776
2009-09-14 18:17:16 +00:00
Sam Weinig 914244e7b0 Add support for -Wchar-subscripts. Fixes PR4801.
llvm-svn: 81747
2009-09-14 01:58:58 +00:00
Daniel Dunbar 125f8fb761 ARM target tweaks.
- Change TargetData string to match llvm-gcc.
 - Some -target-abi support for 'apcs-gnu', most importantly the alignment of double and long long changes.

llvm-svn: 81732
2009-09-14 00:02:24 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Chris Lattner 870158eebf reject returning a block expr even when it has parens and casts in the way.
llvm-svn: 81176
2009-09-08 00:36:37 +00:00
Eli Friedman 7e4faaccda PR4836, part 1: add Sema support for __builtin_isnan and friends; they
are apparently used by Solaris libc despite the fact that clang claims 
to be compatible with gcc 4.2, which doesn't support them.

llvm-svn: 80610
2009-08-31 20:06:00 +00:00
Eli Friedman ba7908796a Remove unnecessary include.
llvm-svn: 80275
2009-08-27 19:02:44 +00:00
Mike Stump a5f00ef372 Cleanups.
llvm-svn: 80185
2009-08-27 00:29:21 +00:00
Douglas Gregor 66a985d16e Fix bug in __extension__ handling for declarations, from Abramo
Bagnara with a fix from Enea Zaffanella!

llvm-svn: 80094
2009-08-26 14:27:30 +00:00
Eli Friedman 16c209610c Catch a few more cases of illegal comparisons.
llvm-svn: 79793
2009-08-23 00:27:47 +00:00
Chris Lattner d99bd52c73 Eli points out that we really must diagnose "void* > 0" as an extension.
Explicitly add it as an EXTENSION instead of an EXTWARN so that it only
comes out with -pedantic.  Thanks Eli!

llvm-svn: 79791
2009-08-23 00:03:44 +00:00
Chris Lattner f8344dbfdd tweak some pointer sema checking stuff (which was added to implement PR4175) to
avoid emitting a warning on "someptr > 0".  This is obviously questionable (they 
could use != instead) but is reasonable, and the warning "ordered comparison 
between pointer and integer" didn't make a ton of sense because 0 is a valid 
null pointer constant.

Just silence the warning in this case, it is unlikely to indicate a bug.

llvm-svn: 79743
2009-08-22 18:58:31 +00:00
Eli Friedman 629ffb9ad3 Fix bit-field promotion to be a bit closer to the behavior of gcc.
Patch by Enea Zaffanella, with some simplifications/corrections to
isPromotableBitField by me.

llvm-svn: 79510
2009-08-20 04:21:42 +00:00
Eli Friedman 5ae98ee006 Make integer promotions work correctly on PIC16 and other platforms
where sizeof(short) == sizeof(int).  Move UsualArithmeticConversionsType 
out of Sema, since it was only there as a historical artifact.  Patch by 
Enea Zaffanella.

llvm-svn: 79412
2009-08-19 07:44:53 +00:00
Eli Friedman da8d4def72 Don't perform integer promotions on the operand to a cast; this
simplifies the AST, and can matter in some rare cases involving 
casts to vector types. Patch by Enea Zaffanella.

llvm-svn: 79126
2009-08-15 19:02:19 +00:00
Eli Friedman b360412582 Make test more precise.
llvm-svn: 79074
2009-08-15 03:40:49 +00:00
John McCall deb8448690 Disable all recognition of main() in -ffreestanding. Addresses bug #4720.
llvm-svn: 79070
2009-08-15 02:09:25 +00:00
Ted Kremenek 08479ae7fe Change handling of attribute 'malloc' to only accept the attribute on function
declarations (and not function pointers). This is consistent with GCC. Accepting
this attribute on function pointers means that the attribute should be treated
as a type qualifier, which apparently is not what GCC does. We obviously can
change this later should we desire to enhance the 'malloc' attribute in this
way.

llvm-svn: 79060
2009-08-15 00:51:46 +00:00
Ted Kremenek 8d091dbe13 Add more attribute 'malloc' test cases involving function pointers.
llvm-svn: 79055
2009-08-14 22:06:01 +00:00
Ted Kremenek f22c410efa Per Eli Friedman's feedback, handle attribute 'malloc' being applied to
declarations of function pointers.

llvm-svn: 79053
2009-08-14 22:03:27 +00:00
Benjamin Kramer b3788a24c6 Rename macro to avoid a name clash on FreeBSD.
llvm-svn: 78741
2009-08-11 22:46:25 +00:00
Nate Begeman 5ec4b318e3 Take 2 on AltiVec-style vector initializers.
Fixes PR4704 problems

Addresses Eli's patch feedback re: ugly cast code

Updates all postfix operators to remove ParenListExprs.  While this is awful,
no better solution (say, in the parser) is obvious to me.  Better solutions
welcome.

llvm-svn: 78621
2009-08-10 23:49:36 +00:00
Chris Lattner 30ba674391 fix a couple of problems with section attributes:
1. Passing something that isn't a string used to cause:
   "argument to annotate attribute was not a string literal"
  make it say "section attribute" instead.

2. Fix the location of the above message to point to the
   bad argument instead of the section token.

3. Implement rdar://4341926, by diagnosing invalid section
   specifiers in the frontend rather than letting them slip all
   the way to the assembler (a QoI win).

An example of #3 is that we used to produce something like this:

/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Expected comma after segment-name
/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Rest of line ignored. 1st junk character valued 46 (.).

Daniel improved clang to use llvm_report_error, so now we got:

$ clang t.c -c
fatal error: error in backend: Global variable 'x' has an invalid section specifier 'sadf': mach-o section specifier
      requires a segment and section separated by a comma.

with no loc info.  Now we get:

$ clang t.c -fsyntax-only
t.c:4:30: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment
      and section separated by a comma
int x __attribute__((section("sadf")));
                             ^

which is nice :)

llvm-svn: 78586
2009-08-10 19:03:04 +00:00
Daniel Dunbar 481fe50903 Revert r78535, it is causing a number of failures to build projects.
--- Reverse-merging r78535 into '.':
D    test/Sema/altivec-init.c
U    include/clang/Basic/DiagnosticSemaKinds.td
U    include/clang/AST/Expr.h
U    include/clang/AST/StmtNodes.def
U    include/clang/Parse/Parser.h
U    include/clang/Parse/Action.h
U    tools/clang-cc/clang-cc.cpp
U    lib/Frontend/PrintParserCallbacks.cpp
U    lib/CodeGen/CGExprScalar.cpp
U    lib/Sema/SemaInit.cpp
U    lib/Sema/Sema.h
U    lib/Sema/SemaExpr.cpp
U    lib/Sema/SemaTemplateInstantiateExpr.cpp
U    lib/AST/StmtProfile.cpp
U    lib/AST/Expr.cpp
U    lib/AST/StmtPrinter.cpp
U    lib/Parse/ParseExpr.cpp
U    lib/Parse/ParseExprCXX.cpp

llvm-svn: 78551
2009-08-10 03:01:36 +00:00
Ryan Flynn e64ffc277c warn, as gcc does, if __attribute__((malloc)) applied to function returning non-pointer type
llvm-svn: 78542
2009-08-09 22:36:29 +00:00
Ryan Flynn 1f1fdc070e map previously ignored __attribute((malloc)) to noalias attribute of llvm function's return
llvm-svn: 78541
2009-08-09 20:07:29 +00:00
Nate Begeman a96114ed08 AltiVec-style vector initializer syntax, vec4 a = (vec4)(a, b, c, d);
In addition to being defined by the AltiVec PIM, this is also the vector
initializer syntax used by OpenCL, so that vector literals are compatible
with macro arguments.

llvm-svn: 78535
2009-08-09 17:55:44 +00:00
Anders Carlsson e139f868b7 Add tests.
llvm-svn: 78491
2009-08-08 19:43:14 +00:00
Ryan Flynn 2f08571e4d PR4700 - remove shift by 0 warning
llvm-svn: 78488
2009-08-08 19:18:23 +00:00
Ryan Flynn f53fab87d8 PR3333: warn when shifting by invalid amount
llvm-svn: 78385
2009-08-07 16:20:20 +00:00
Ryan Flynn aa5e5fd2f4 add support for FreeBSD's format(printf0,x,y) attribute; allows null format string.
llvm-svn: 78276
2009-08-06 03:00:50 +00:00
Douglas Gregor f9bd4ecea2 Fix canonical type construction for function types with the noreturn
attribute. Fixes PR4865.

llvm-svn: 78224
2009-08-05 19:03:35 +00:00
Daniel Dunbar e9863976b3 Fix test case for Darwin10 (which sets ssp), and move to CodeGen/
llvm-svn: 78049
2009-08-04 04:38:31 +00:00
Ted Kremenek fb50bf5a6f Per advice that Doug Gregor gave me several months ago, clean up the
implementation of '#pragma unused' by not constructing intermediate
DeclRefExprs, but instead do the name lookup directly.  The
implementation is greatly simplified.

Along the way, degrade '#pragma unused(undeclaredvariable)' to a
warning instead of being a hard error.  This implements:

<rdar://problem/6761874> [sema] allow #pragma unused to reference undefined variable (with warning)

llvm-svn: 78019
2009-08-03 23:24:57 +00:00
Ryan Flynn e1ca39456b PR3679: add #pragma weak test file
llvm-svn: 78016
2009-08-03 23:16:15 +00:00
Daniel Dunbar 769f940655 Ok, ok, I give in. Fix tests for unused result warning.
llvm-svn: 77780
2009-08-01 06:07:15 +00:00
Anders Carlsson 1682af5bac More warnings for unused expressions.
llvm-svn: 77763
2009-08-01 01:39:59 +00:00
Anders Carlsson 5c5f160c7f Diagnose unused expression results for all statements, just not compound statements.
llvm-svn: 77631
2009-07-30 22:39:03 +00:00
Mike Stump d97c26921a Be sure to turn on -fblocks.
llvm-svn: 77406
2009-07-29 00:17:20 +00:00
Mike Stump bce7a27d22 Add support for -Wmissing-noreturn.
llvm-svn: 77391
2009-07-28 23:11:12 +00:00
Mike Stump 3bf1ab48d3 Add noreturn support for blocks.
llvm-svn: 77377
2009-07-28 22:04:01 +00:00
Chris Lattner 2706a55071 fix PR4633: cast to void should silence the 'unused expression' warning.
llvm-svn: 77344
2009-07-28 18:25:28 +00:00
John McCall 8945266f3d Bounds checking for address spaces.
llvm-svn: 77303
2009-07-28 06:52:18 +00:00
Mike Stump 31d9254f7a Ensure we can work through typedefs.
llvm-svn: 77265
2009-07-27 22:25:19 +00:00
Mike Stump 9e3b01f697 Add knowledge about _longjmp being noreturn.
llvm-svn: 77254
2009-07-27 21:45:16 +00:00
Mike Stump 9a9e0c2b17 Add builtin knowledge about longjmp being noreturn. Add printing for
the noreturn attribute.

llvm-svn: 77253
2009-07-27 21:33:40 +00:00
Mike Stump ca6c875e47 Add noreturn for exit.
llvm-svn: 77237
2009-07-27 19:14:18 +00:00
Chris Lattner 4ead0b9e1c add bugzilla #
llvm-svn: 77183
2009-07-27 04:49:58 +00:00