notes without warnings and a question to -cc1

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

notes without warnings and a question to -cc1

Olaf Krzikalla
Hi @clang,

sometimes I'd like to issue some notes just at the start of compilation.
However while there is "Diagnostic::setLastDiagnosticIgnored", there is
no similiar function for other diagnostic levels. Thus for the moment I
have to issue warnings instead of notes. Granted, it is a cosmetical
issue only, but IMHO it can be easily fixed by introducing a
"Diagnostic::setLastDiagnosticNote" or similar. I don't see any harm in
introducing such a function.

The second question is related to the available options in normal and
-cc1 mode. Actually I call

CompilerInvocation::CreateFromArgs(...);

to get a compiler invocation.
But CreateFromArgs uses the cc1 option table hard-coded and thus I can't
pass options like "-msse2" to the compiler. This in turn forbids the
handling of files which includes <xmmintrin.h> and similiar headers.
Is there a reason for using the cc1 option table there and is it
possible to change it so that it is optionally possible to use the
driver option table instead?


Thanks in advance and best regards
Olaf Krzikalla
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: notes without warnings and a question to -cc1

John McCall
On Mar 25, 2011, at 9:25 AM, Olaf Krzikalla wrote:
> sometimes I'd like to issue some notes just at the start of compilation.

Notes are always subordinate to another diagnostic.  If you just want
to print to console, you should write to an output stream instead of
pretending it's a diagnostic.

> CompilerInvocation::CreateFromArgs(...);
>
> to get a compiler invocation.
> But CreateFromArgs uses the cc1 option table hard-coded and thus I can't
> pass options like "-msse2" to the compiler. This in turn forbids the
> handling of files which includes <xmmintrin.h> and similiar headers.
> Is there a reason for using the cc1 option table there and is it
> possible to change it so that it is optionally possible to use the
> driver option table instead?

No.  If you want to use the driver logic to figure out the arguments to pass to
CompilerInvocation, you should do that.

John.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: notes without warnings and a question to -cc1

Argyrios Kyrtzidis-2
In reply to this post by Olaf Krzikalla
On Mar 25, 2011, at 9:25 AM, Olaf Krzikalla wrote:

>
> The second question is related to the available options in normal and
> -cc1 mode. Actually I call
>
> CompilerInvocation::CreateFromArgs(...);
>
> to get a compiler invocation.
> But CreateFromArgs uses the cc1 option table hard-coded and thus I can't
> pass options like "-msse2" to the compiler. This in turn forbids the
> handling of files which includes <xmmintrin.h> and similiar headers.
> Is there a reason for using the cc1 option table there and is it
> possible to change it so that it is optionally possible to use the
> driver option table instead?

If you look into ASTUnit::LoadFromCommandLine you can find code to get a CompilerInvocation out of driver options.
This code should be factored out into its own function like a static driver::Compilation::createInvocationFromArgs.

>
>
> Thanks in advance and best regards
> Olaf Krzikalla
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: notes without warnings and a question to -cc1

Olaf Krzikalla
Hi,

Am 25.03.2011 20:16, schrieb Argyrios Kyrtzidis:

>> CompilerInvocation::CreateFromArgs(...);
>>
>> to get a compiler invocation.
>> But CreateFromArgs uses the cc1 option table hard-coded and thus I can't
>> pass options like "-msse2" to the compiler. This in turn forbids the
>> handling of files which includes<xmmintrin.h>  and similiar headers.
>> Is there a reason for using the cc1 option table there and is it
>> possible to change it so that it is optionally possible to use the
>> driver option table instead?
>
> If you look into ASTUnit::LoadFromCommandLine you can find code to get a CompilerInvocation out of driver options.
> This code should be factored out into its own function like a static driver::Compilation::createInvocationFromArgs.
Hmm, the code there filters out the driver options but I can't find the
part where these filtered-out options are reinjected in the
CompilerInvocation.
Generally speaking I don't get the point of the stripped down cc1 option
list. Judging from the mails here I guess these are the options
sufficiently for parsing a C file. However then something like "-msse2"
(or something similiar if you want to emanzipate from gcc) is clearly
missing, because some files are not parseable without that options.

Best regards
Olaf Krzikalla
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: notes without warnings and a question to -cc1

Olaf Krzikalla
In reply to this post by John McCall
Am 25.03.2011 18:40, schrieb John McCall:

>> CompilerInvocation::CreateFromArgs(...);
>>
>> to get a compiler invocation.
>> But CreateFromArgs uses the cc1 option table hard-coded and thus I can't
>> pass options like "-msse2" to the compiler. This in turn forbids the
>> handling of files which includes<xmmintrin.h>  and similiar headers.
>> Is there a reason for using the cc1 option table there and is it
>> possible to change it so that it is optionally possible to use the
>> driver option table instead?
>
> No.  If you want to use the driver logic to figure out the arguments to pass to
> CompilerInvocation, you should do that.
Sorry, but I can't figure out how to do that. I can create a Compilation
from a Driver but I have no idea how I can get from a Compilation to a
CompilerInstance or CompilerInvocation. Which missing link was I unable
to find?

Best regards
Olaf Krzikalla
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev