]> granicus.if.org Git - clang/commit
Make GNUInline consistent with whether we use traditional GNU inline semantics.
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 13 May 2015 22:07:22 +0000 (22:07 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 13 May 2015 22:07:22 +0000 (22:07 +0000)
commit4afd81447ff830f25fbd2b328e1bec69e225fb9f
treec52ecd640adabcdab9223e5de2c416608a3ea2b3
parentf5c6ef2efb15d1bab9c64df5038895e6f13c9c71
Make GNUInline consistent with whether we use traditional GNU inline semantics.

Previously we were setting LangOptions::GNUInline (which controls whether we
use traditional GNU inline semantics) if the language did not have the C99
feature flag set. The trouble with this is that C++ family languages also
do not have that flag set, so we ended up setting this flag in C++ modes
(and working around it in a few places downstream by also checking CPlusPlus).

The fix is to check whether the C89 flag is set for the target language,
rather than whether the C99 flag is cleared. This also lets us remove most
CPlusPlus checks. We continue to test CPlusPlus when deciding whether to
pre-define the __GNUC_GNU_INLINE__ macro for consistency with GCC.

There is a change in semantics in two other places
where we weren't checking both CPlusPlus and GNUInline
(FunctionDecl::doesDeclarationForceExternallyVisibleDefinition and
FunctionDecl::isInlineDefinitionExternallyVisible), but this change seems to
put us back into line with GCC's semantics (test case: test/CodeGen/inline.c).

While at it, forbid -fgnu89-inline in C++ modes, as GCC doesn't support it,
it didn't have any effect before, and supporting it just makes things more
complicated.

Differential Revision: http://reviews.llvm.org/D9333

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237299 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Frontend/CompilerInvocation.cpp
lib/Frontend/InitPreprocessor.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaExpr.cpp
test/CodeGen/inline.c
test/Frontend/gnu-inline.c [new file with mode: 0644]