add a new LangOptions::GNUMode bit to distinguish between GNU99 and C99 etc.
llvm-svn: 67374
This commit is contained in:
parent
4655d731e1
commit
91d63d1248
|
@ -622,9 +622,12 @@ static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
|
|||
break;
|
||||
}
|
||||
|
||||
// GNUMode - Set if we're in gnu99, gnu89, gnucxx98, etc.
|
||||
Options.GNUMode = LangStd >= lang_gnu_START;
|
||||
|
||||
if (Options.CPlusPlus) {
|
||||
Options.C99 = 0;
|
||||
Options.HexFloats = (LangStd == lang_gnucxx98 || LangStd==lang_gnucxx0x);
|
||||
Options.HexFloats = Options.GNUMode;
|
||||
}
|
||||
|
||||
if (LangStd == lang_c89 || LangStd == lang_c94 || LangStd == lang_gnu89)
|
||||
|
@ -634,15 +637,15 @@ static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
|
|||
|
||||
// Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs or -ansi
|
||||
// is specified, or -std is set to a conforming mode.
|
||||
Options.Trigraphs = LangStd < lang_gnu_START;
|
||||
Options.Trigraphs = !Options.GNUMode;
|
||||
if (Trigraphs.getPosition())
|
||||
Options.Trigraphs = Trigraphs; // Command line option wins.
|
||||
Options.Trigraphs = Trigraphs; // Command line option wins if specified.
|
||||
|
||||
// If in a conformant language mode (e.g. -std=c99) Blocks defaults to off
|
||||
// even if they are normally on for the target. In GNU modes (e.g.
|
||||
// -std=gnu99) the default for blocks depends on the target settings.
|
||||
// However, blocks are not turned off when compiling Obj-C or Obj-C++ code.
|
||||
if (!Options.ObjC1 && LangStd < lang_gnu_START)
|
||||
if (!Options.ObjC1 && !Options.GNUMode)
|
||||
Options.Blocks = 0;
|
||||
|
||||
// Never accept '$' in identifiers when preprocessing assembler.
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
unsigned BCPLComment : 1; // BCPL-style '//' comments.
|
||||
unsigned DollarIdents : 1; // '$' allowed in identifiers.
|
||||
unsigned AsmPreprocessor : 1; // Preprocessor in asm mode.
|
||||
unsigned GNUMode : 1; // True in gnu99 mode false in c99 mode (etc)
|
||||
unsigned ImplicitInt : 1; // C89 implicit 'int'.
|
||||
unsigned Digraphs : 1; // C94, C99 and C++
|
||||
unsigned HexFloats : 1; // C99 Hexadecimal float constants.
|
||||
|
@ -71,7 +72,7 @@ public:
|
|||
|
||||
LangOptions() {
|
||||
Trigraphs = BCPLComment = DollarIdents = AsmPreprocessor = 0;
|
||||
ImplicitInt = Digraphs = 0;
|
||||
GNUMode = ImplicitInt = Digraphs = 0;
|
||||
HexFloats = 0;
|
||||
GC = ObjC1 = ObjC2 = ObjCNonFragileABI = 0;
|
||||
C99 = Microsoft = CPlusPlus = CPlusPlus0x = NoExtensions = 0;
|
||||
|
|
Loading…
Reference in New Issue