summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/varargs.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't claim that va_start has special semantic checksReid Kleckner2018-03-021-0/+9
| | | | | | | | | | | | | | We don't have special checks for BI_va_start in Sema::CheckBuiltinFunctionCall, so setting the 't' flag for va_start in Builtins.def disables semantic checking for it. That's not desired, and IRGen crashes when it tries to generate a call to va_start that doesn't have at least one argument. Follow-up to r322573 Fixes PR36565 llvm-svn: 326622
* Simplify some va_start checking logicReid Kleckner2017-05-021-1/+1
| | | | | | | | | | | | | | | Combine the logic doing the ms_abi/sysv_abi checks into one function so that each check and its logical opposite are near each other. Now we don't need two Sema entry points for MS va_start and regular va_start. Refactor the code that checks if the va_start caller is a function, block, or obj-c method. We do this in three places, and they are all buggy for variadic lambdas (PR32737). After this change, I have one place to apply the functional fix. NFC llvm-svn: 301968
* Reapply: Silence false positive diagnostics regarding passing an object of ↵Aaron Ballman2016-09-151-1/+19
| | | | | | | | | | enumeration type to va_start(). The underlying type for an enumeration in C is either char, signed int, or unsigned int. In the case the underlying type is chosen to be char (such as when passing -fshort-enums or using __attribute__((packed)) on the enum declaration), the enumeration can result in undefined behavior. However, when the underlying type is signed int or unsigned int (or long long as an extension), there is no undefined behavior because the types are compatible. This patch silences diagnostics for the latter while retaining the diagnostics for the former. This patch addresses PR29140. llvm-svn: 281632
* Reverting r281609; it caused some build bots to break.Aaron Ballman2016-09-151-19/+1
| | | | | | http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/20061/steps/test/logs/stdio llvm-svn: 281612
* Silence false positive diagnostics regarding passing an object of ↵Aaron Ballman2016-09-151-1/+19
| | | | | | | | enumeration type to va_start(). The underlying type for an enumeration in C is either char, signed int, or unsigned int. In the case the underlying type is chosen to be char (such as when passing -fshort-enums or using __attribute__((packed)) on the enum declaration), the enumeration can result in undefined behavior. However, when the underlying type is signed int or unsigned int (or long long as an extension), there is no undefined behavior because the types are compatible. This patch silences diagnostics for the latter while retaining the diagnostics for the former. This patch addresses PR29140. llvm-svn: 281609
* Improve diagnostic checking for va_start to also warn on other instances of ↵Aaron Ballman2016-04-241-4/+15
| | | | | | | | undefined behavior, such as a parameter declared with the register keyword in C, or a parameter of a type that undergoes default argument promotion. This helps cover some more of the CERT secure coding rule EXP58-CPP. Pass an object of the correct type to va_start (https://www.securecoding.cert.org/confluence/display/cplusplus/EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start). llvm-svn: 267338
* Clarifying the wording of this diagnostic; it confused parameter and argument.Aaron Ballman2016-04-181-5/+5
| | | | llvm-svn: 266644
* Fixed bug in return type of __builtin_va_start().Enea Zaffanella2013-11-071-0/+7
| | | | llvm-svn: 194197
* PR15132: Replace "address expression must be an lvalue or a functionRichard Smith2013-02-021-1/+1
| | | | | | | | | | | | | | designator" diagnostic with more correct and more human-friendly "cannot take address of rvalue of type 'T'". For the case of & &T::f, provide a custom diagnostic, rather than unhelpfully saying "cannot take address of rvalue of type '<overloaded function type>'". For the case of &array_temporary, treat it just like a class temporary (including allowing it as an extension); the existing diagnostic wording for the class temporary case works fine. llvm-svn: 174262
* Add diagnostic for constructs like "va_arg(l, float)" which have undefined ↵Eli Friedman2011-07-111-0/+9
| | | | | | behavior. PR10201. llvm-svn: 134926
* Properly diagnose using abstract and incomplete types in va_argDavid Majnemer2011-06-141-0/+6
| | | | | | | - Move a test from test/SemaTemplate/instantiate-expr-3.cpp, it did not belong there - Incomplete and abstract types are considered hard errors llvm-svn: 132979
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-2/+2
| | | | | | | | | - 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
* Eliminate &&s in tests.Daniel Dunbar2009-11-081-1/+1
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
* PR2524: downgrade taking address of expression of type 'void' to an Eli Friedman2009-05-031-1/+1
| | | | | | extension warning. llvm-svn: 70805
* Add a warning for questionable va_args usage.Chris Lattner2009-04-051-6/+0
| | | | llvm-svn: 68435
* GCC compatibility: gcc allows applying va_args to const Chris Lattner2009-04-051-0/+7
| | | | | | va_lists for some reason. This fixes rdar://6726818 llvm-svn: 68434
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-2/+2
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Fix va_arg bug noticed by Eli, __builtin_va_arg is not an l-valueDaniel Dunbar2009-02-121-0/+8
| | | | | | designating an object. llvm-svn: 64371
* Fix for PR3350: add special-casing for "references" to va_lists in Eli Friedman2009-01-201-0/+9
| | | | | | | | builtins. Also, a minor tweak to va_copy for consistency. llvm-svn: 62574
* Make error handling for va_start a bit more robust. Fixes PR3213.Eli Friedman2008-12-151-0/+9
| | | | llvm-svn: 61055
* Fix PR3075, __builtin_stdarg_start being misprototyped. This affects netbsd ↵Chris Lattner2008-11-161-0/+9
| | | | | | headers. llvm-svn: 59419
* Fix va_arg handling to do argument decaying at the correct place. ThisChris Lattner2008-09-291-1/+2
| | | | | | | fixes problems handling references of va_list, which happens on x86_64. This fixes PR2841 and rdar://6252231 llvm-svn: 56809
* Get rid of bogus warnings when the second argument in va_start is either an ↵Anders Carlsson2008-02-111-0/+8
| | | | | | implicit cast expr or a paren expr. llvm-svn: 46950
* Add some more diagnostics for va_start, fix tests so they pass with these ↵Anders Carlsson2007-10-121-0/+18
new diags. llvm-svn: 42917
OpenPOWER on IntegriCloud