summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/array-init.c
Commit message (Collapse)AuthorAgeFilesLines
* Switch C compilations to C11 by default.Richard Smith2014-10-201-2/+2
| | | | | | | | This is long-since overdue, and matches GCC 5.0. This should also be backwards-compatible, because we already supported all of C11 as an extension in C99 mode. llvm-svn: 220244
* Improved location for non-constant initializers diagnostics.Abramo Bagnara2014-05-221-1/+6
| | | | llvm-svn: 209466
* Recognition of empty structures and unions is moved to semantic stageSerge Pavlov2013-06-081-1/+2
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D586 llvm-svn: 183609
* Fix assert if __extension__ or _Generic is used when initializing a char ↵Richard Smith2013-05-061-1/+1
| | | | | | array from a string literal. llvm-svn: 181174
* PR13881: Add -Wzero-length-array for zero length array extension, and move ↵Richard Smith2012-09-201-0/+1
| | | | | | it into -Wgnu. llvm-svn: 164272
* clang/test: [PR8833] Introduce the feature "LP64" to suppress ↵NAKAMURA Takumi2012-09-121-0/+1
| | | | | | | | LLP64-incompatible tests. I think some of them could be rewritten to fit also LLP64. llvm-svn: 163699
* Improve some of the conversion warnings to fire on conversion to bool.David Blaikie2012-05-151-1/+1
| | | | | | | | | | | Moves the bool bail-out down a little in SemaChecking - so now -Wnull-conversion and -Wliteral-conversion can fire when the target type is bool. Also improve the wording/details in the -Wliteral-conversion warning to match the -Wconstant-conversion. llvm-svn: 156826
* Enable warn_impcast_literal_float_to_integer by default.David Blaikie2012-04-051-1/+3
| | | | | | | | | | | | | | | | | This diagnostic seems to be production ready, it's just an oversight that it wasn't turned on by default. The test changes are a bit of a mixed bag. Some tests that seemed like they clearly didn't need to use this behavior have been modified not to use it. Others that I couldn't be sure about, I added the necessary expected-warnings to. It's possible the diagnostic message could be improved to make it clearer that this warning can be suppressed by using a value that won't lose precision when converted to the target type (but can still be a floating point literal, such as "bool b = 1.0;"). llvm-svn: 154068
* Don't warn about anonymous struct/union in C11.Hans Wennborg2012-02-031-1/+1
| | | | | | Also, in C, call this a C11 extension rather than a GNU extension. llvm-svn: 149695
* The value of a const weak variable is not an integer constant.John McCall2012-01-051-1/+8
| | | | llvm-svn: 147575
* Change the diagnostics which said 'accepted as an extension' to instead sayRichard Smith2011-12-291-2/+2
| | | | | | | 'is an extension'. The former is inappropriate and confusing when building with -Werror/-pedantic-errors. llvm-svn: 147357
* Add list initialization for complex numbers in C. Essentially, this allows ↵Eli Friedman2011-09-191-1/+1
| | | | | | | | "_Complex float x = {1.0f, 2.0f};". See changes to docs/LanguageExtensions.html for a longer description. <rdar://problem/9397672>. llvm-svn: 140090
* Implement the GNU C extension which permits the initialization of anDouglas Gregor2011-02-221-0/+14
| | | | | | array from a constant array compound literal. Fixes PR9261. llvm-svn: 126230
* PR3344: Downgrade "too many braces around scalar initializer" to a warning.Eli Friedman2010-08-141-1/+1
| | | | llvm-svn: 111067
* Reword the empty struct/union warning in C to note that such structs and ↵Douglas Gregor2010-07-291-2/+4
| | | | | | unions have size 0 in C, size 1 in C++. Put this warning under -Wc++-compat. llvm-svn: 109748
* Improve diagnostics like "initializing <type> from an expression ofDouglas Gregor2010-04-091-7/+7
| | | | | | | type..." with "initializing <type> with an expression of type...", which reads better. Thanks to John for the improved wording. llvm-svn: 100873
* Improve diagnostics when we fail to convert from a source type to aDouglas Gregor2010-04-091-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | destination type for initialization, assignment, parameter-passing, etc. The main issue fixed here is that we used rather confusing wording for diagnostics such as t.c:2:9: warning: initializing 'char const [2]' discards qualifiers, expected 'char *' [-pedantic] char *name = __func__; ^ ~~~~~~~~ We're not initializing a 'char const [2]', we're initializing a 'char *' with an expression of type 'char const [2]'. Similar problems existed for other diagnostics in this area, so I've normalized them all with more precise descriptive text to say what we're initializing/converting/assigning/etc. from and to. The warning for the code above is now: t.c:2:9: warning: initializing 'char *' from an expression of type 'char const [2]' discards qualifiers [-pedantic] char *name = __func__; ^ ~~~~~~~~ Fixes <rdar://problem/7447179>. llvm-svn: 100832
* Initialization improvements: addition of string initialization and a fewEli Friedman2009-12-191-1/+1
| | | | | | | | small bug fixes in SemaInit, switch over SemaDecl to use it more often, and change a bunch of diagnostics which are different with the new initialization code. llvm-svn: 91767
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-9/+8
| | | | llvm-svn: 81346
* Prep for new warning.Mike Stump2009-07-221-3/+3
| | | | llvm-svn: 76709
* Make sure we don't give the wrong warning, and make sure not to set Eli Friedman2009-05-291-0/+2
| | | | | | | hadError (suppressing future diagnostics) if we didn't print an error. llvm-svn: 72588
* PR3009: Get rid of bogus warning for scalar compound literals.Eli Friedman2009-05-161-1/+1
| | | | | | | | | This patch isn't quite ideal in that it eliminates the warning for constructs like "int a = {1};", where the braces are in fact redundant. However, that would have required a bunch of refactoring, and it's much less likely to cause confusion compared to redundant nested braces. llvm-svn: 71939
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Allow flexible array initializers that are not surrounded byDouglas Gregor2009-03-201-2/+2
| | | | | | | | braces. We now build the appropriate fully-structured initializer list for such things. Per PR3618, verified that we're getting the right code generation. llvm-svn: 67353
* Downgrade the "excess elements in initializer" errors to warnings *inDouglas Gregor2009-02-181-10/+10
| | | | | | C*. They're required errors in C++. llvm-svn: 64964
* Implement semantic analysis for the GNU flexible array initializationDouglas Gregor2009-02-041-6/+5
| | | | | | | | | | | | | extension. The interaction with designated initializers is a bit... interesting... but we follow GNU's lead and don't permit too much crazy code in this area. Also, make the "excess initializers" error message a bit more informative. Addresses PR2561: http://llvm.org/bugs/show_bug.cgi?id=2561 llvm-svn: 63785
* Upgrade the "excess elements in array initializer" warning to anDouglas Gregor2009-01-301-9/+9
| | | | | | | error, since both C99 and C++ consider it an error. For reference, GCC makes this a warning while G++ makes it an error. llvm-svn: 63435
* Code generation support for C99 designated initializers.Douglas Gregor2009-01-281-2/+26
| | | | | | | | | | | | | | | | | | | | The approach I've taken in this patch is relatively straightforward, although the code itself is non-trivial. Essentially, as we process an initializer list we build up a fully-explicit representation of the initializer list, where each of the subobject initializations occurs in order. Designators serve to "fill in" subobject initializations in a non-linear way. The fully-explicit representation makes initializer lists (both with and without designators) easy to grok for codegen and later semantic analyses. We keep the syntactic form of the initializer list linked into the AST for those clients interested in exactly what the user wrote. Known limitations: - Designating a member of a union that isn't the first member may result in bogus initialization (we warn about this) - GNU array-range designators are not supported (we warn about this) llvm-svn: 63242
* 64-bit test fixes.Sebastian Redl2008-11-121-5/+5
| | | | llvm-svn: 59165
* readd test as it passes correctly. nice, but weirdNuno Lopes2008-09-011-0/+14
| | | | llvm-svn: 55615
* Backing out r55607 due to logic errors and test regression.Eli Friedman2008-09-011-14/+0
| | | | | | I'll try to come up with a correct fix for the testcase sometime soon. llvm-svn: 55614
* fix one more this-is-not-a-constant error. test includedNuno Lopes2008-09-011-0/+3
| | | | llvm-svn: 55609
* make CheckArithmeticConstantExpression() aware of &foo and pointersNuno Lopes2008-09-011-0/+13
| | | | llvm-svn: 55607
* Support initialization of incomplete array with zero size (asDaniel Dunbar2008-08-181-1/+1
| | | | | | extension). llvm-svn: 54946
* wrap some long diagnostics, make 'initializer is not a constant' diagnosticChris Lattner2008-08-101-2/+2
| | | | | | a bit more clear (rdar://5646070) llvm-svn: 54606
* Count the number of initializable members correctly in structs/unions Eli Friedman2008-05-251-0/+6
| | | | | | with unnamed members. llvm-svn: 51557
* Diagnose implicit init list for empty aggregate, like struct {}. Fixes Eli Friedman2008-05-251-0/+4
| | | | | | PR2151 (by not creating the empty implicit init list). llvm-svn: 51556
* Move the error checking for variable-sized objects so we don't Eli Friedman2008-05-251-0/+4
| | | | | | double-report errors; fixes PR2362. llvm-svn: 51555
* Switch on SemaInit; this makes some code in SemaDecl dead, but I'll give Eli Friedman2008-05-191-2/+2
| | | | | | it a few days to make sure there aren't any significant regressions. llvm-svn: 51273
* Fix PR2017 and silence some bogus errors.Chris Lattner2008-04-021-3/+2
| | | | llvm-svn: 49068
* Fix PR1992 by computing the right type for string literals, whichChris Lattner2008-02-111-5/+5
| | | | | | | | is an array type not a pointer type. This requires updating some diags that change and updating the code generator to handle the proper form of strings. llvm-svn: 46941
* Fix a bug with struct initializers (in Sema::CheckInitializerListTypes()). Steve Naroff2008-01-281-0/+5
| | | | | | | Test case included from bz1948 (thanks Neil!). Also fixed an 80 column violation... llvm-svn: 46430
* Replace Sema::CheckVariableInitList, CheckConstantInitList, and ↵Steve Naroff2008-01-251-4/+41
| | | | | | | | | | CheckForCharArrayInitializer with CheckInitializerListTypes. The new routine now supports struct/union initializers. This is a modified version of a patch by Eli Friedman. This version passes all of the clang tests and supports vectors:-) Note that Eli and I are still unsatisfied the implementation of CheckInitializerListTypes(). We'd like to find a more elegant implementation. Nevertheless, this is a complex part of the standard (and may be hard to simplify). Since the complexity is localized to this routine, we can iterate without too much disruption:-) llvm-svn: 46339
* Sema::CheckInitializerTypes(). Start simpliying and cleaning up...Steve Naroff2008-01-211-0/+5
| | | | llvm-svn: 46234
* add comments for the various AssignConvertType's, and split int->pointer ↵Chris Lattner2008-01-041-3/+3
| | | | | | from pointer->int. llvm-svn: 45591
* Merge all the 'assignment' diagnostic code into one routine, decloning Chris Lattner2008-01-041-3/+3
| | | | | | | | | | | | | it from several places. This merges the diagnostics, making them more uniform and fewer in number. This also simplifies and cleans up the code. Some highlights: 1. This removes a bunch of very-similar diagnostics. 2. This renames AssignmentCheckResult -> AssignConvertType 3. This merges PointerFromInt + IntFromPointer which were always treated the same. 4. This updates a bunch of test cases that have minor changes to the produced diagnostics. llvm-svn: 45589
* Add support for initializing char arrays from string literals.Steve Naroff2007-12-101-0/+25
| | | | | | Adapted from a patch by Anders Carlsson. llvm-svn: 44816
* Fix the following bug...Steve Naroff2007-10-181-0/+5
| | | | | | | | | | | | | | | | | unsigned char asso_values[] = { 34 }; int legal2() { return asso_values[0]; } The code that creates the new constant array type was operating on the original type. As a result, the constant type being generated was "unsigned char [1][]" (which is wrong). The fix is to operate on the element type - in this case, the correct type is "unsigned char [1]" I added this case to array-init.c, which clearly didn't catch this bogosity... llvm-svn: 43112
* rename -parse-ast-print to -ast-printChris Lattner2007-10-111-1/+1
| | | | | | | rename -parse-ast-dump to -ast-dump remove -parse-ast, which is redundant with -fsyntax-only llvm-svn: 42852
OpenPOWER on IntegriCloud