r194845 - Revert "Using an invalid -O falls back on -O3 instead of an error"

Alp Toker alp at nuanti.com
Sat Nov 16 07:27:31 PST 2013


On 16/11/2013 09:25, Sylvestre Ledru wrote:
> On 15/11/2013 21:40, Alp Toker wrote:
>> Author: alp
>> Date: Fri Nov 15 14:40:58 2013
>> New Revision: 194845
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=194845&view=rev
>> Log:
>> Revert "Using an invalid -O falls back on -O3 instead of an error"
>>
>> Trying to fix test failures since earlier today.
>>
>> One of the tests added in this commit is outputting test/Driver/clang_f_opts.s
>> which the builders that build in-tree (eg. clang-native-arm-cortex-a9) are
>> trying to run as a test case, causing failures.
>>
>> clang_f_opts.c:
>>    If -### doesn't emit the warning then this test probably shouldn't be in
>>    here in the first place. Frontend maybe?
>>
> Do you have an idea on how to fix that ?

Hello Sylvestre,

It's down to the spit between driver and frontend in clang.

Although this is a simplification, the driver is a top-level executable 
that invokes other tools including clang -cc1. Both are the same binary 
in practice.

clang -### will never invoke clang -cc1, instead only running the 
driver's command-line processing.

I don't know the full history of the patch you were working on. It'll be 
helpful if you can mention why the new fallback from higher -O numbers 
wasn't added in the same place as the existing -04/-03 logic.

It's usually the driver's job to massage arguments into a format 
compatible with the native -cc1 command line, which us usually kept 
simple and strict. So I'd have expected this to be implemented in the 
driver, in which case -### would have worked properly to begin with.

As for the test failure, the generated .S file was appearing due to the 
not having -### which resulted in the compiler being run and output 
generated. (A quick-fix would have been -o /dev/null but it doesn't seem 
the right way to go for the reasons given.)

Alp.


> It was related to this question I asked:
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131111/092937.html
>
> Thanks,
> Sylvestre
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-commits mailing list