<div class="gmail_quote">On Wed, Jun 13, 2012 at 1:09 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="font-family:arial,helvetica,sans-serif"><font><div class="gmail_quote"><div><div class="h5">On Wed, Jun 13, 2012 at 12:48 PM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rjmccall<br>
Date: Wed Jun 13 14:48:01 2012<br>
New Revision: 158416<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=158416&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=158416&view=rev</a><br>
Log:<br>
Provide a -no-pedantic to cancel out -pedantic.<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Driver/Options.td<br>
    cfe/trunk/lib/Driver/Tools.cpp<br>
    cfe/trunk/test/Driver/warning-options.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Driver/Options.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=158416&r1=158415&r2=158416&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=158416&r1=158415&r2=158416&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/include/clang/Driver/Options.td (original)<br>
+++ cfe/trunk/include/clang/Driver/Options.td Wed Jun 13 14:48:01 2012<br>
@@ -831,6 +831,7 @@<br>
 def no_cpp_precomp : Flag<"-no-cpp-precomp">, Group<clang_ignored_f_Group>;<br>
 def no_integrated_as : Flag<"-no-integrated-as">, Flags<[DriverOption]>;<br>
 def no_integrated_cpp : Flag<"-no-integrated-cpp">, Flags<[DriverOption]>;<br>
+def no_pedantic : Flag<"-no-pedantic">, Group<pedantic_Group>;<br>
 def no__dead__strip__inits__and__terms : Flag<"-no_dead_strip_inits_and_terms">;<br>
 def nobuiltininc : Flag<"-nobuiltininc">, Flags<[CC1Option]>,<br>
   HelpText<"Disable builtin #include directories">;<br>
@@ -1033,6 +1034,7 @@<br>
 def _machine : Separate<"--machine">, Alias<m_Joined>;<br>
 def _no_integrated_cpp : Flag<"--no-integrated-cpp">, Alias<no_integrated_cpp>;<br>
 def _no_line_commands : Flag<"--no-line-commands">, Alias<P>;<br>
+def _no_pedantic : Flag<"--no-pedantic">, Alias<no_pedantic>;<br>
 def _no_standard_includes : Flag<"--no-standard-includes">, Alias<nostdinc>;<br>
 def _no_standard_libraries : Flag<"--no-standard-libraries">, Alias<nostdlib>;<br>
 def _no_undefined : Flag<"--no-undefined">, Flags<[LinkerInput]>;<br>
<br>
Modified: cfe/trunk/lib/Driver/Tools.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=158416&r1=158415&r2=158416&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=158416&r1=158415&r2=158416&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/lib/Driver/Tools.cpp (original)<br>
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jun 13 14:48:01 2012<br>
@@ -2034,7 +2034,8 @@<br>
   }<br>
<br>
   Args.AddAllArgs(CmdArgs, options::OPT_W_Group);<br>
-  Args.AddLastArg(CmdArgs, options::OPT_pedantic);<br>
+  if (Args.hasFlag(options::OPT_pedantic, options::OPT_no_pedantic, false))<br>
+    CmdArgs.push_back("-pedantic");<br>
   Args.AddLastArg(CmdArgs, options::OPT_pedantic_errors);<br>
   Args.AddLastArg(CmdArgs, options::OPT_w);<br>
<br>
<br>
Modified: cfe/trunk/test/Driver/warning-options.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/warning-options.cpp?rev=158416&r1=158415&r2=158416&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/warning-options.cpp?rev=158416&r1=158415&r2=158416&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/test/Driver/warning-options.cpp (original)<br>
+++ cfe/trunk/test/Driver/warning-options.cpp Wed Jun 13 14:48:01 2012<br>
@@ -8,3 +8,8 @@<br>
 // CHECK: unknown warning option '-Wmonkey'<br>
 // CHECK: unknown warning option '-Wno-monkey'<br>
 // CHECK: unknown warning option '-Wno-unused-command-line-arguments'; did you mean '-Wno-unused-command-line-argument'?<br>
+<br>
+// RUN: %clang -### -pedantic -no-pedantic %s 2>&1 | FileCheck -check-prefix=NO_PEDANTIC %s<br>
+// NO_PEDANTIC-NOT: -pedantic<br>
+// RUN: %clang -### -pedantic -pedantic -no-pedantic -pedantic %s 2>&1 | FileCheck -check-prefix=PEDANTIC %s<br>
+// PEDANTIC: -pedantic</blockquote><div><br></div></div></div><div>But you didn't test the interaction of '--pedantic' and '--no-pedantic', much less '--pedantic' and '-no-pedantic' or '-pedantic' and '--no-pedantic'. =7</div>
</div></font></div></blockquote></div><br><div>Less =7ly, it looks like -pedantic-errors -no-pedantic will still produce -pedantic errors. Is that what we want? I would have expected -pedantic, -pedantic-errors, -no-pedantic to work analogously to -Wpedantic, -Werror=pedantic, -Wno-pedantic.</div>