]> granicus.if.org Git - clang/commitdiff
Driver: Manually translate a number of -f with no- variants options to
authorDaniel Dunbar <daniel@zuster.org>
Tue, 7 Apr 2009 21:16:11 +0000 (21:16 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 7 Apr 2009 21:16:11 +0000 (21:16 +0000)
clang.
 - We will eventually want some more driver infrastructre for this
   probably.

 - For now, the clang-cc interface stays relatively the same, but we
   don't accept multiple instances anymore, or the [no-] variants
   directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68550 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Options.def
lib/Driver/Tools.cpp
test/Sema/exprs.c
test/Sema/unused-expr.c
tools/clang-cc/clang-cc.cpp

index 7e77a1a51cbdca3c831658a0602826e0b9c699ab..bfa5a664ee8379e2ff0ed157e021b08e6030ec5a 100644 (file)
@@ -424,11 +424,11 @@ OPTION("-fasm-blocks", fasm_blocks, Flag, clang_ignored_f_Group, INVALID, "", 0,
 OPTION("-fastcp", fastcp, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fastf", fastf, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fast", fast, Flag, f_Group, INVALID, "", 0, 0, 0)
-OPTION("-fblocks", fblocks, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
+OPTION("-fblocks", fblocks, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fbootclasspath=", fbootclasspath_EQ, Joined, f_Group, INVALID, "", 0, 0, 0)
-OPTION("-fbuiltin", fbuiltin, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
+OPTION("-fbuiltin", fbuiltin, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fclasspath=", fclasspath_EQ, Joined, f_Group, INVALID, "", 0, 0, 0)
-OPTION("-fcommon", fcommon, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
+OPTION("-fcommon", fcommon, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fcompile-resource=", fcompile_resource_EQ, Joined, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fconstant-cfstrings", fconstant_cfstrings, Flag, clang_ignored_f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fcreate-profile", fcreate_profile, Flag, f_Group, INVALID, "", 0, 0, 0)
@@ -459,10 +459,10 @@ OPTION("-fmudflapth", fmudflapth, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fmudflap", fmudflap, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fnested-functions", fnested_functions, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fnext-runtime", fnext_runtime, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
-OPTION("-fno-blocks", fno_blocks, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
-OPTION("-fno-builtin", fno_builtin, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
+OPTION("-fno-blocks", fno_blocks, Flag, f_Group, INVALID, "", 0, 0, 0)
+OPTION("-fno-builtin", fno_builtin, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fno-caret-diagnostics", fno_caret_diagnostics, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
-OPTION("-fno-common", fno_common, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
+OPTION("-fno-common", fno_common, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fno-constant-cfstrings", fno_constant_cfstrings, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fno-eliminate-unused-debug-symbols", fno_eliminate_unused_debug_symbols, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fno-inline-functions", fno_inline_functions, Flag, clang_ignored_f_Group, INVALID, "", 0, 0, 0)
@@ -488,7 +488,7 @@ OPTION("-fopenmp", fopenmp, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-force_cpusubtype_ALL", force__cpusubtype__ALL, Flag, INVALID, INVALID, "", 0, 0, 0)
 OPTION("-force_flat_namespace", force__flat__namespace, Flag, INVALID, INVALID, "", 0, 0, 0)
 OPTION("-foutput-class-dir=", foutput_class_dir_EQ, Joined, f_Group, INVALID, "", 0, 0, 0)
-OPTION("-fpascal-strings", fpascal_strings, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
+OPTION("-fpascal-strings", fpascal_strings, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fpch-preprocess", fpch_preprocess, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fpic", fpic, Flag, f_Group, INVALID, "", 0, 0, 0)
 OPTION("-fpie", fpie, Flag, f_Group, INVALID, "", 0, 0, 0)
index e26bb9e85adf7a33e4c9128e62ee036115e5c7f5..dd3a00ecb338c755e3b1b6d430e45d0ca1cd368e 100644 (file)
@@ -357,8 +357,34 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     CmdArgs.push_back(A->getValue(Args));
   }
 
+  // Forward -f options which we can pass directly.
   Args.AddAllArgs(CmdArgs, options::OPT_clang_f_Group);
 
+  // Forward -f options with positive and negative forms; we translate
+  // these by hand.
+
+  // -fbuiltin is default, only pass non-default.
+  if (!Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin))
+    CmdArgs.push_back("-fbuiltin=0");
+
+  // -fblocks default varies depending on platform and language;
+  // -always pass if specified.
+  if (Arg *A = Args.getLastArg(options::OPT_fblocks, options::OPT_fno_blocks)) {
+    if (A->getOption().matches(options::OPT_fblocks))
+      CmdArgs.push_back("-fblocks");
+    else
+      CmdArgs.push_back("-fblocks=0");
+  }
+
+  // -fno-pascal-strings is default, only pass non-default.
+  if (Args.hasFlag(options::OPT_fpascal_strings, 
+                      options::OPT_fno_pascal_strings))
+    CmdArgs.push_back("-fpascal-strings");
+
+  // -fcommon is default, only pass non-default.
+  if (!Args.hasFlag(options::OPT_fcommon, options::OPT_fno_common))
+    CmdArgs.push_back("-fno-common");
+
   // If tool chain translates fpascal-strings, we want to back
   // translate here.
   // FIXME: This is gross; that translation should be pulled from the
index ae4c37cd469e87cfdde9e0a93e2682da31fbea4b..9db8c9248de38894e6039e1d95e3ecf2e5a87441 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -verify -pedantic -fsyntax-only -fno-blocks
+// RUN: clang-cc %s -verify -pedantic -fsyntax-only -fblocks=0
 
 // PR1966
 _Complex double test1() {
index b3d6efb7d3749cab4ac3c82d7a6e21a8e74a1a78..9c231e960a2a467d8ea95c3c109cc9a3414ba75c 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fno-math-errno %s
+// RUN: clang-cc -fsyntax-only -verify -fmath-errno=0 %s
 
 int foo(int X, int Y);
 
index d257c432fc6d0e3224ccca9746a26a2349efb65a..9260afe4b7dbe6d4aa68d9a4dbae005e9420595e 100644 (file)
@@ -323,15 +323,13 @@ Freestanding("ffreestanding",
                             "freestanding environment"));
 
 static llvm::cl::opt<bool>
-AllowBuiltins("fbuiltin",
-              llvm::cl::desc("Disable implicit builtin knowledge of functions"),
-              llvm::cl::init(true), llvm::cl::AllowInverse);
+AllowBuiltins("fbuiltin", llvm::cl::init(true),
+             llvm::cl::desc("Disable implicit builtin knowledge of functions"));
 
 
 static llvm::cl::opt<bool>
-MathErrno("fmath-errno", 
-          llvm::cl::desc("Require math functions to respect errno"),
-          llvm::cl::init(true), llvm::cl::AllowInverse);
+MathErrno("fmath-errno", llvm::cl::init(true),
+          llvm::cl::desc("Require math functions to respect errno"));
 
 //===----------------------------------------------------------------------===//
 // Language Options
@@ -546,9 +544,7 @@ NoLaxVectorConversions("fno-lax-vector-conversions",
                                       "elements or different element types"));
 
 static llvm::cl::opt<bool>
-EnableBlocks("fblocks", llvm::cl::desc("enable the 'blocks' language feature"),
-             llvm::cl::ValueDisallowed, llvm::cl::AllowInverse,
-             llvm::cl::ZeroOrMore);
+EnableBlocks("fblocks", llvm::cl::desc("enable the 'blocks' language feature"));
 
 static llvm::cl::opt<bool>
 EnableHeinousExtensions("fheinous-gnu-extensions",