[cfe-dev] Clang driver
Marcin Zalewski
marcin.zalewski at gmail.com
Wed Jun 22 19:00:43 PDT 2011
OK. But should the driver totally ignore unknown flags, or should it
pass them to the tool it calls?
clang -cc1 -finvalidflag some_file.cpp
The above command gives the following error:
error: unknown argument: '-finvalidflag'
What happened to me was that I added a flag to cc1. Everything was
working correctly until I actually tried to use the driver. It was
silently eating up my flag. Only after examining the output of "-v" I
notice that my flag disappears, and then I added proper support for
the flag in the driver. In case of some other options (not flags), I
at least get a warning:
clang -auao testt.cpp
clang: warning: argument unused during compilation: '-auao'
but
clang -invalidoption testt.cpp
gives no warning. As an "outsider," I was confused by some options
giving warnings and some not.
Thanks,
Marcin
On Wed, Jun 22, 2011 at 18:23, Eric Christopher <echristo at apple.com> wrote:
>
> On Jun 22, 2011, at 1:20 PM, Marcin Zalewski wrote:
>
>> I have noticed that clang silently ignores unknown flags:
>>
>> clang -finvalidflag some_file.cpp
>>
>> The above does not produce any error or warning, and adding "-v" shows
>> that the invalid flag does not make it out of the driver.
>>
>> I looked through bug reports, and I did not see any on this. Is it an
>> intentional design? I have only seen this behavior for flags (starting
>> with "-f"), so I want to make sure that there is no rationale behind
>> this behavior.
>
> The rationale is that it makes swapping projects to clang a little easier in that we're not going to support every random flag, but also don't want to worry about some project not compiling if we don't support -finline-limit=
>
> -eric
>
More information about the cfe-dev
mailing list