[cfe-commits] r158416 - in /cfe/trunk: include/clang/Driver/Options.td lib/Driver/Tools.cpp test/Driver/warning-options.cpp
Richard Smith
richard at metafoo.co.uk
Wed Jun 13 13:24:54 PDT 2012
On Wed, Jun 13, 2012 at 1:09 PM, Chandler Carruth <chandlerc at google.com>wrote:
> On Wed, Jun 13, 2012 at 12:48 PM, John McCall <rjmccall at apple.com> wrote:
>
>> Author: rjmccall
>> Date: Wed Jun 13 14:48:01 2012
>> New Revision: 158416
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=158416&view=rev
>> Log:
>> Provide a -no-pedantic to cancel out -pedantic.
>>
>> Modified:
>> cfe/trunk/include/clang/Driver/Options.td
>> cfe/trunk/lib/Driver/Tools.cpp
>> cfe/trunk/test/Driver/warning-options.cpp
>>
>> Modified: cfe/trunk/include/clang/Driver/Options.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=158416&r1=158415&r2=158416&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/Driver/Options.td (original)
>> +++ cfe/trunk/include/clang/Driver/Options.td Wed Jun 13 14:48:01 2012
>> @@ -831,6 +831,7 @@
>> def no_cpp_precomp : Flag<"-no-cpp-precomp">,
>> Group<clang_ignored_f_Group>;
>> def no_integrated_as : Flag<"-no-integrated-as">, Flags<[DriverOption]>;
>> def no_integrated_cpp : Flag<"-no-integrated-cpp">,
>> Flags<[DriverOption]>;
>> +def no_pedantic : Flag<"-no-pedantic">, Group<pedantic_Group>;
>> def no__dead__strip__inits__and__terms :
>> Flag<"-no_dead_strip_inits_and_terms">;
>> def nobuiltininc : Flag<"-nobuiltininc">, Flags<[CC1Option]>,
>> HelpText<"Disable builtin #include directories">;
>> @@ -1033,6 +1034,7 @@
>> def _machine : Separate<"--machine">, Alias<m_Joined>;
>> def _no_integrated_cpp : Flag<"--no-integrated-cpp">,
>> Alias<no_integrated_cpp>;
>> def _no_line_commands : Flag<"--no-line-commands">, Alias<P>;
>> +def _no_pedantic : Flag<"--no-pedantic">, Alias<no_pedantic>;
>> def _no_standard_includes : Flag<"--no-standard-includes">,
>> Alias<nostdinc>;
>> def _no_standard_libraries : Flag<"--no-standard-libraries">,
>> Alias<nostdlib>;
>> def _no_undefined : Flag<"--no-undefined">, Flags<[LinkerInput]>;
>>
>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=158416&r1=158415&r2=158416&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> +++ cfe/trunk/lib/Driver/Tools.cpp Wed Jun 13 14:48:01 2012
>> @@ -2034,7 +2034,8 @@
>> }
>>
>> Args.AddAllArgs(CmdArgs, options::OPT_W_Group);
>> - Args.AddLastArg(CmdArgs, options::OPT_pedantic);
>> + if (Args.hasFlag(options::OPT_pedantic, options::OPT_no_pedantic,
>> false))
>> + CmdArgs.push_back("-pedantic");
>> Args.AddLastArg(CmdArgs, options::OPT_pedantic_errors);
>> Args.AddLastArg(CmdArgs, options::OPT_w);
>>
>>
>> Modified: cfe/trunk/test/Driver/warning-options.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/warning-options.cpp?rev=158416&r1=158415&r2=158416&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/Driver/warning-options.cpp (original)
>> +++ cfe/trunk/test/Driver/warning-options.cpp Wed Jun 13 14:48:01 2012
>> @@ -8,3 +8,8 @@
>> // CHECK: unknown warning option '-Wmonkey'
>> // CHECK: unknown warning option '-Wno-monkey'
>> // CHECK: unknown warning option '-Wno-unused-command-line-arguments';
>> did you mean '-Wno-unused-command-line-argument'?
>> +
>> +// RUN: %clang -### -pedantic -no-pedantic %s 2>&1 | FileCheck
>> -check-prefix=NO_PEDANTIC %s
>> +// NO_PEDANTIC-NOT: -pedantic
>> +// RUN: %clang -### -pedantic -pedantic -no-pedantic -pedantic %s 2>&1 |
>> FileCheck -check-prefix=PEDANTIC %s
>> +// PEDANTIC: -pedantic
>
>
> But you didn't test the interaction of '--pedantic' and '--no-pedantic',
> much less '--pedantic' and '-no-pedantic' or '-pedantic' and
> '--no-pedantic'. =7
>
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120613/f70f58ab/attachment.html>
More information about the cfe-commits
mailing list