r301500 - Remove unnecessary and somewhat inaccurate "C89" flag from language standards.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 26 16:49:58 PDT 2017


Author: rsmith
Date: Wed Apr 26 18:49:57 2017
New Revision: 301500

URL: http://llvm.org/viewvc/llvm-project?rev=301500&view=rev
Log:
Remove unnecessary and somewhat inaccurate "C89" flag from language standards.

Modified:
    cfe/trunk/include/clang/Frontend/LangStandard.h
    cfe/trunk/include/clang/Frontend/LangStandards.def
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Frontend/LangStandard.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandard.h?rev=301500&r1=301499&r2=301500&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandard.h (original)
+++ cfe/trunk/include/clang/Frontend/LangStandard.h Wed Apr 26 18:49:57 2017
@@ -20,18 +20,17 @@ namespace frontend {
 
 enum LangFeatures {
   LineComment = (1 << 0),
-  C89 = (1 << 1),
-  C99 = (1 << 2),
-  C11 = (1 << 3),
-  CPlusPlus = (1 << 4),
-  CPlusPlus11 = (1 << 5),
-  CPlusPlus14 = (1 << 6),
-  CPlusPlus1z = (1 << 7),
-  Digraphs = (1 << 8),
-  GNUMode = (1 << 9),
-  HexFloat = (1 << 10),
-  ImplicitInt = (1 << 11),
-  OpenCL = (1 << 12)
+  C99 = (1 << 1),
+  C11 = (1 << 2),
+  CPlusPlus = (1 << 3),
+  CPlusPlus11 = (1 << 4),
+  CPlusPlus14 = (1 << 5),
+  CPlusPlus1z = (1 << 6),
+  Digraphs = (1 << 7),
+  GNUMode = (1 << 8),
+  HexFloat = (1 << 9),
+  ImplicitInt = (1 << 10),
+  OpenCL = (1 << 11)
 };
 
 }
@@ -64,9 +63,6 @@ public:
   /// Language supports '//' comments.
   bool hasLineComments() const { return Flags & frontend::LineComment; }
 
-  /// isC89 - Language is a superset of C89.
-  bool isC89() const { return Flags & frontend::C89; }
-
   /// isC99 - Language is a superset of C99.
   bool isC99() const { return Flags & frontend::C99; }
 

Modified: cfe/trunk/include/clang/Frontend/LangStandards.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LangStandards.def?rev=301500&r1=301499&r2=301500&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LangStandards.def (original)
+++ cfe/trunk/include/clang/Frontend/LangStandards.def Wed Apr 26 18:49:57 2017
@@ -31,24 +31,24 @@
 // C89-ish modes.
 LANGSTANDARD(c89, "c89",
              C, "ISO C 1990",
-             C89 | ImplicitInt)
+             ImplicitInt)
 LANGSTANDARD(c90, "c90", C,
              "ISO C 1990",
-             C89 | ImplicitInt)
+             ImplicitInt)
 LANGSTANDARD(iso9899_1990, "iso9899:1990",
              C, "ISO C 1990",
-             C89 | ImplicitInt)
+             ImplicitInt)
 
 LANGSTANDARD(c94, "iso9899:199409",
              C, "ISO C 1990 with amendment 1",
-             C89 | Digraphs | ImplicitInt)
+             Digraphs | ImplicitInt)
 
 LANGSTANDARD(gnu89, "gnu89",
              C, "ISO C 1990 with GNU extensions",
-             LineComment | C89 | Digraphs | GNUMode | ImplicitInt)
+             LineComment | Digraphs | GNUMode | ImplicitInt)
 LANGSTANDARD(gnu90, "gnu90",
              C, "ISO C 1990 with GNU extensions",
-             LineComment | C89 | Digraphs | GNUMode | ImplicitInt)
+             LineComment | Digraphs | GNUMode | ImplicitInt)
 
 // C99-ish modes
 LANGSTANDARD(c99, "c99",

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=301500&r1=301499&r2=301500&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Apr 26 18:49:57 2017
@@ -1615,7 +1615,7 @@ void CompilerInvocation::setLangDefaults
   Opts.CPlusPlus1z = Std.isCPlusPlus1z();
   Opts.Digraphs = Std.hasDigraphs();
   Opts.GNUMode = Std.isGNUMode();
-  Opts.GNUInline = Std.isC89();
+  Opts.GNUInline = !Opts.C99 && !Opts.CPlusPlus;
   Opts.HexFloats = Std.hasHexFloats();
   Opts.ImplicitInt = Std.hasImplicitInt();
 




More information about the cfe-commits mailing list