[cfe-commits] r67549 - in /cfe/trunk: include/clang/Driver/Options.def lib/Driver/Tools.cpp

Daniel Dunbar daniel at zuster.org
Mon Mar 23 12:03:36 PDT 2009


Author: ddunbar
Date: Mon Mar 23 14:03:36 2009
New Revision: 67549

URL: http://llvm.org/viewvc/llvm-project?rev=67549&view=rev
Log:
Driver: Add two special groups of "whitelisted" options which we know
clang doesn't support, and don't want to warn are unused. Eventually
these should disappear.

Here is a more readable list than is in the diff:

W options: -Wall, -Wcast-align, -Wchar-align, -Wchar-subscripts,
-Werror, -Wextra, -Winline, -Wint-to-pointer-cast, -Wmissing-braces,
-Wmost, -Wnested-externs, -Wno-format-y2k, -Wno-four-char-constants,
-Wno-missing-field-initializers, -Wno-trigraphs, -Wno-unknown-pragmas,
-Wno-unused-parameter, -Wparentheses, -Wpointer-arith,
-Wpointer-to-int-cast, -Wreturn-type, -Wshorten-64-to-32, -Wswitch,
-Wunused-function, -Wunused-label, -Wunused-value, -Wunused-variable,
-Wwrite-strings.

f options: -fasm-blocks, -fmessage-length=.

Modified:
    cfe/trunk/include/clang/Driver/Options.def
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/Options.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.def?rev=67549&r1=67548&r2=67549&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Options.def (original)
+++ cfe/trunk/include/clang/Driver/Options.def Mon Mar 23 14:03:36 2009
@@ -99,6 +99,13 @@
 
 OPTION("<pedantic group>", pedantic_Group, Group, INVALID, INVALID, "", 0)
 
+// Temporary groups for clang options which we know we don't support,
+// but don't want to verbosely warn the user about.
+OPTION("<clang ignored W group>", clang_ignored_W_Group, Group, W_Group, 
+       INVALID, "", 0)
+OPTION("<clang ignored f group>", clang_ignored_f_Group, Group, f_Group, 
+       INVALID, "", 0)
+
 //////////
 // Options
 
@@ -255,18 +262,45 @@
 OPTION("-U", U, JoinedOrSeparate, INVALID, INVALID, "", 0)
 OPTION("-V", V, JoinedOrSeparate, INVALID, INVALID, "u", 0)
 OPTION("-Wa,", Wa_COMMA, CommaJoined, INVALID, INVALID, "", 0)
-OPTION("-Wall", Wall, Flag, W_Group, INVALID, "", 0)
+OPTION("-Wall", Wall, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wcast-align", Wcast_align, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wchar-align", Wchar_align, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wchar-subscripts", Wchar_subscripts, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Werror", Werror, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wextra", Wextra, Flag, clang_ignored_W_Group, INVALID, "", 0)
 OPTION("-Wfloat-equal", Wfloat_equal, Flag, clang_W_Group, INVALID, "", 0)
 OPTION("-Wimplicit-function-declaration", Wimplicit_function_declaration, Flag, clang_W_Group, INVALID, "", 0)
+OPTION("-Winline", Winline, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wint-to-pointer-cast", Wint_to_pointer_cast, Flag, clang_ignored_W_Group, INVALID, "", 0)
 OPTION("-Wl,", Wl_COMMA, CommaJoined, INVALID, INVALID, "li", 0)
+OPTION("-Wmissing-braces", Wmissing_braces, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wmost", Wmost, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wnested-externs", Wnested_externs, Flag, clang_ignored_W_Group, INVALID, "", 0)
 OPTION("-Wno-format-nonliteral", Wno_format_nonliteral, Flag, clang_W_Group, INVALID, "", 0)
+OPTION("-Wno-format-y2k", Wno_format_y2k, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wno-four-char-constants", Wno_four_char_constants, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wno-missing-field-initializers", Wno_missing_field_initializers, Flag, clang_ignored_W_Group, INVALID, "", 0)
 OPTION("-Wno-nonportable-cfstrings", Wno_nonportable_cfstrings, Joined, W_Group, INVALID, "", 0)
 OPTION("-Wno-strict-selector-match", Wno_strict_selector_match, Flag, clang_W_Group, INVALID, "", 0)
+OPTION("-Wno-trigraphs", Wno_trigraphs, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wno-unknown-pragmas", Wno_unknown_pragmas, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wno-unused-parameter", Wno_unused_parameter, Flag, clang_ignored_W_Group, INVALID, "", 0)
 OPTION("-Wnonportable-cfstrings", Wnonportable_cfstrings, Joined, W_Group, INVALID, "", 0)
 OPTION("-Wp,", Wp_COMMA, CommaJoined, INVALID, INVALID, "", 0)
+OPTION("-Wparentheses", Wparentheses, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wpointer-arith", Wpointer_arith, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wpointer-to-int-cast", Wpointer_to_int_cast, Flag, clang_ignored_W_Group, INVALID, "", 0)
 OPTION("-Wreadonly-setter-attrs", Wreadonly_setter_attrs, Flag, clang_W_Group, INVALID, "", 0)
+OPTION("-Wreturn-type", Wreturn_type, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wshorten-64-to-32", Wshorten_64_to_32, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wswitch", Wswitch, Flag, clang_ignored_W_Group, INVALID, "", 0)
 OPTION("-Wundef", Wundef, Flag, clang_W_Group, INVALID, "", 0)
+OPTION("-Wunused-function", Wunused_function, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wunused-label", Wunused_label, Flag, clang_ignored_W_Group, INVALID, "", 0)
 OPTION("-Wunused-macros", Wunused_macros, Flag, clang_W_Group, INVALID, "", 0)
+OPTION("-Wunused-value", Wunused_value, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wunused-variable", Wunused_variable, Flag, clang_ignored_W_Group, INVALID, "", 0)
+OPTION("-Wwrite-strings", Wwrite_strings, Flag, clang_ignored_W_Group, INVALID, "", 0)
 OPTION("-W", W, Joined, W_Group, INVALID, "", 0)
 OPTION("-Xanalyzer", Xanalyzer, Separate, INVALID, INVALID, "", 0)
 OPTION("-Xarch_", Xarch__, JoinedAndSeparate, INVALID, INVALID, "", 0)
@@ -313,6 +347,7 @@
 OPTION("-fPIC", fPIC, Flag, f_Group, INVALID, "", 0)
 OPTION("-fPIE", fPIE, Flag, f_Group, INVALID, "", 0)
 OPTION("-fapple-kext", fapple_kext, Flag, f_Group, INVALID, "", 0)
+OPTION("-fasm-blocks", fasm_blocks, Flag, clang_ignored_f_Group, INVALID, "", 0)
 OPTION("-fastcp", fastcp, Flag, f_Group, INVALID, "", 0)
 OPTION("-fastf", fastf, Flag, f_Group, INVALID, "", 0)
 OPTION("-fast", fast, Flag, f_Group, INVALID, "", 0)
@@ -332,13 +367,14 @@
 OPTION("-fextdirs=", fextdirs_EQ, Joined, f_Group, INVALID, "", 0)
 OPTION("-ffreestanding", ffreestanding, Flag, clang_f_Group, INVALID, "", 0)
 OPTION("-fgnu-runtime", fgnu_runtime, Flag, clang_f_Group, INVALID, "", 0)
-OPTION("-filelist", filelist, Separate, INVALID, INVALID, "l", 0)
 OPTION("-fheinous-gnu-extensions", fheinous_gnu_extensions, Flag, INVALID, INVALID, "", 0)
+OPTION("-filelist", filelist, Separate, INVALID, INVALID, "l", 0)
 OPTION("-findirect-virtual-calls", findirect_virtual_calls, Flag, f_Group, INVALID, "", 0)
 OPTION("-flat_namespace", flat__namespace, Flag, INVALID, INVALID, "", 0)
 OPTION("-flax-vector-conversions", flax_vector_conversions, Flag, clang_f_Group, INVALID, "", 0)
 OPTION("-flimited-precision=", flimited_precision_EQ, Joined, f_Group, INVALID, "", 0)
 OPTION("-fmath-errno", fmath_errno, Flag, f_Group, INVALID, "", 0)
+OPTION("-fmessage-length=", fmessage_length_EQ, Joined, clang_ignored_f_Group, INVALID, "", 0)
 OPTION("-fms-extensions", fms_extensions, Flag, clang_f_Group, INVALID, "", 0)
 OPTION("-fmudflapth", fmudflapth, Flag, f_Group, INVALID, "", 0)
 OPTION("-fmudflap", fmudflap, Flag, f_Group, INVALID, "", 0)

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=67549&r1=67548&r2=67549&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Mar 23 14:03:36 2009
@@ -334,6 +334,18 @@
   const char *Exec = 
     Args.MakeArgString(getToolChain().GetProgramPath(C, "clang").c_str());
   Dest.addCommand(new Command(Exec, CmdArgs));
+
+  // Claim some arguments which clang doesn't support, but we don't
+  // care to warn the user about.
+  
+  // FIXME: Use iterator.
+  for (ArgList::const_iterator 
+         it = Args.begin(), ie = Args.end(); it != ie; ++it) {
+    const Arg *A = *it;
+    if (A->getOption().matches(options::OPT_clang_ignored_W_Group) ||
+        A->getOption().matches(options::OPT_clang_ignored_f_Group))
+      A->claim();
+  }
 }
 
 void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,





More information about the cfe-commits mailing list