[patch] Microsoft Extension - #pragma message

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

[patch] Microsoft Extension - #pragma message

Michael Spencer-2
I implemented this rather simple extension to get more familiar with
the code base. It differs from the MSVC implementation because of the
way clang handles diagnostics. MSVC simply prints _exactly_ what's in
the quoted string to the standard output with a new line at the end.
Because this behavior does not fit in well with the way clang handles
diagnostics, I added a new warning that prints out the quoted string.
This should not {a,e}ffect the correctness of any code, but still
provides the intended functionality.

- Michael Spencer

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

pragma-message.patch (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Microsoft Extension - #pragma message

Chris Lattner

On Jun 19, 2010, at 6:25 AM, Michael Spencer wrote:

> I implemented this rather simple extension to get more familiar with
> the code base. It differs from the MSVC implementation because of the
> way clang handles diagnostics. MSVC simply prints _exactly_ what's in
> the quoted string to the standard output with a new line at the end.
> Because this behavior does not fit in well with the way clang handles
> diagnostics, I added a new warning that prints out the quoted string.
> This should not {a,e}ffect the correctness of any code, but still
> provides the intended functionality.

Hi Michael,

Thanks for working on this.  This looks good with two minor changes:

1) please drop the testcase into the Lex directory instead of making a new MicrosoftExtensions directory for it.  The MS testcases can be found by grepping for ms-extensions.

2) Though it almost certainly isn't a performance issue, for code cleanliness, please change "PragmaMessage" to take a StringRef by value instead of taking a std::string.  This will allow PP::HandlePragmaMessage to pass the string directly from the literal parser instead of indirecting through the std::string.

Thanks again,

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

Re: [patch] Microsoft Extension - #pragma message

Michael Spencer-2
On Wed, Jun 23, 2010 at 1:52 AM, Chris Lattner <[hidden email]> wrote:

> Hi Michael,
>
> Thanks for working on this.  This looks good with two minor changes:
>
> 1) please drop the testcase into the Lex directory instead of making a new MicrosoftExtensions directory for it.  The MS testcases can be found by grepping for ms-extensions.
>
> 2) Though it almost certainly isn't a performance issue, for code cleanliness, please change "PragmaMessage" to take a StringRef by value instead of taking a std::string.  This will allow PP::HandlePragmaMessage to pass the string directly from the literal parser instead of indirecting through the std::string.
>
> Thanks again,
>
> -Chris
Changes made and new patch attached. Would you like those same changes
made to PragmaComment? That's the style I followed for PragmaMessage.

- Michael Spencer

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

pragma-message.patch (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Microsoft Extension - #pragma message

Chris Lattner

On Jun 24, 2010, at 9:33 AM, Michael Spencer wrote:

> On Wed, Jun 23, 2010 at 1:52 AM, Chris Lattner <[hidden email]> wrote:
>> Hi Michael,
>>
>> Thanks for working on this.  This looks good with two minor changes:
>>
>> 1) please drop the testcase into the Lex directory instead of making a new MicrosoftExtensions directory for it.  The MS testcases can be found by grepping for ms-extensions.
>>
>> 2) Though it almost certainly isn't a performance issue, for code cleanliness, please change "PragmaMessage" to take a StringRef by value instead of taking a std::string.  This will allow PP::HandlePragmaMessage to pass the string directly from the literal parser instead of indirecting through the std::string.
>>
>> Thanks again,
>>
>> -Chris
>
> Changes made and new patch attached.

Looks great, applied in r106950, thanks again!

> Would you like those same changes
> made to PragmaComment? That's the style I followed for PragmaMessage.

Yes please!  It looks like it is going back to pre-stringref style.  Thanks Michael,

-Chris


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