summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/inline.c
Commit message (Collapse)AuthorAgeFilesLines
* C does not have inline variables.Paul Robinson2016-07-141-1/+1
| | | | | | | | Add a few missing tests for related C++ diagnostics. Differential Revision: http://reviews.llvm.org/D22113 llvm-svn: 275493
* Implement C++17 P0386R2, inline variables. (The 'inline' specifier gives aRichard Smith2016-06-251-1/+1
| | | | | | | variable weak discardable linkage and partially-ordered initialization, and is implied for constexpr static data members.) llvm-svn: 273754
* Update a few more tests in response to the MS ABI enum semanticsDavid Majnemer2015-10-081-1/+1
| | | | | | | Our self hosting buildbots found a few more tests which weren't updated to reflect that the enum semantics are part of the Microsoft ABI. llvm-svn: 249670
* Split isFromMainFile into two functions.Eli Friedman2013-08-221-0/+13
| | | | | | | | | Basically, isInMainFile considers line markers, and isWrittenInMainFile doesn't. Distinguishing between the two is useful when dealing with files which are preprocessed files or rewritten with -frewrite-includes (so we don't, for example, print useless warnings). llvm-svn: 188968
* Add -Wstatic-local-in-inline, which warns about using a static localJohn McCall2013-04-021-0/+10
| | | | | | | | | | | | | | variable in a C99 inline (but not static-inline or extern-inline) function definition. The standard doesn't actually say that this doesn't apply to "extern inline" definitions, but that seems like a useful extension, and it at least doesn't have the obvious flaw that a static mutable variable in an externally-available definition does. rdar://13535367 llvm-svn: 178520
* c: small refactoring of checking for __attribute__(const))Fariborz Jahanian2012-08-131-2/+0
| | | | | | per Richard's comment. llvm-svn: 161786
* c: make __has_attribute(const) work for constFariborz Jahanian2012-08-131-0/+2
| | | | | | function attribute. // rdar://10253857 llvm-svn: 161767
* Don't warn for -Wstatic-in-inline if the used function is also inline.Jordan Rose2012-06-211-0/+14
| | | | | | | | | | | | | | | | | | Also, don't warn if the used function is __attribute__((const)), in which case it's not supposed to use global variables anyway. The inline-in-inline thing is a heuristic, and one that's possibly incorrect fairly often because the function being inlined could definitely use global variables. However, even some C standard library functions are written using other (trivial) static-inline functions in the headers, and we definitely don't want to be warning on that (or on anything that /uses/ these trivial inline functions). So we're using "inlined" as a marker for "fairly trivial". (Note that __attribute__((pure)) does /not/ guarantee safety like ((const), because ((const)) does not guarantee that global variables are not being used, and the warning is about globals not being shared across TUs.) llvm-svn: 158898
* Reword -Winternal-linkage-in-inline, and rename it to -Wstatic-in-inline.Jordan Rose2012-06-201-8/+10
| | | | | | | | | Now that this is a C-only warning, we can use "static" instead of "internal linkage", which is a term developers are probably more familiar with. This makes for a better warning message. The warning name was changed to match, since "internal linkage" is not mentioned in the warning text anymore. llvm-svn: 158853
* Change -Winternal-linkage-in-inline from ExtWarn to Warning in C++.Jordan Rose2012-06-181-1/+0
| | | | | | | | | | Per post-commit review, it's not appropriate to use ExtWarn in C++, because we can't prove that the inline function will actually be defined in more than one place (and thus we can't prove that this violates the ODR). This removes the warning entirely from uses in the main source file in C++. llvm-svn: 158689
* Support -Winternal-linkage-in-inline in C++ code.Jordan Rose2012-06-181-1/+2
| | | | | | | | This includes treating anonymous namespaces like internal linkage, and allowing const variables to be used even if internal. The whole thing's been broken out into a separate function to avoid nested ifs. llvm-svn: 158683
* Allow internal decls in inline functions if the function is in the main file.Jordan Rose2012-06-181-7/+43
| | | | | | | | | | | This handles the very common case of people writing inline functions in their main source files and not tagging them as inline. These cases should still behave as the user intended. (The diagnostic is still emitted as an extension.) I'm reworking this code anyway to account for C++'s equivalent restriction in [basic.def.odr]p6, but this should get some bots back to green. llvm-svn: 158666
* Warn when a static variable is referenced in a non-static inline function.Jordan Rose2012-06-151-0/+20
| | | | | | | | | | | | | This is explicitly forbidden in C99 6.7.4p3. This is /not/ forbidden in C++, probably because by default file-scope const/constexpr variables have internal linkage, while functions have external linkage. There's also the issue of anonymous namespaces to consider. Nevertheless, there should probably be a similar warning, since the semantics of inlining a function that references a variable with internal linkage do not seem well-defined. <rdar://problem/11577619> llvm-svn: 158531
* Make __gnu_inline__ functions in gnu99 mode work the same way as inline ↵Eli Friedman2011-06-131-17/+1
| | | | | | | | functions in gnu89 mode in terms of redefinitions. rdar://9559708 . llvm-svn: 132953
* Allow redefinitions of extern inline functions in GNU89 mode, just as GCCCharles Davis2010-02-181-1/+17
| | | | | | does. Fixes PR5253. llvm-svn: 96553
* 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
* Diagnose uses of function specifiers on declarations which don't declareEli Friedman2009-04-071-0/+6
functions. Fixes PR3941. llvm-svn: 68541
OpenPOWER on IntegriCloud