[cfe-commits] r67374 - in /cfe/trunk: Driver/clang.cpp include/clang/Basic/LangOptions.h
Chris Lattner
sabre at nondot.org
Fri Mar 20 08:44:27 PDT 2009
Author: lattner
Date: Fri Mar 20 10:44:26 2009
New Revision: 67374
URL: http://llvm.org/viewvc/llvm-project?rev=67374&view=rev
Log:
add a new LangOptions::GNUMode bit to distinguish between GNU99 and C99 etc.
Modified:
cfe/trunk/Driver/clang.cpp
cfe/trunk/include/clang/Basic/LangOptions.h
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=67374&r1=67373&r2=67374&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Fri Mar 20 10:44:26 2009
@@ -622,9 +622,12 @@
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 @@
// 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.
Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=67374&r1=67373&r2=67374&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Fri Mar 20 10:44:26 2009
@@ -26,6 +26,7 @@
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 @@
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;
More information about the cfe-commits
mailing list