<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Great. Thanks!<div><br></div><div>-- adrian</div><div><br><div><div>On Feb 20, 2014, at 17:11, Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Thanks, this should have been fixed in <span style="font-family:arial,sans-serif;font-size:13px">r201825, and the builder has subsequent runs that don't fail that test.</span></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Feb 20, 2014 at 4:55 PM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Reid,<br>
<br>
this or possibly 201820 is causing our buildbot to fail:<br>
<br>
<a href="http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/12417" target="_blank">http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/12417</a><br>

<br>
please have a quick look.<br>
<span class="HOEnZb"><font color="#888888">-- adrian<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Feb 20, 2014, at 14:59, Reid Kleckner <<a href="mailto:reid@kleckner.net">reid@kleckner.net</a>> wrote:<br>
<br>
> Author: rnk<br>
> Date: Thu Feb 20 16:59:51 2014<br>
> New Revision: 201821<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=201821&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=201821&view=rev</a><br>
> Log:<br>
> Expand macros in pragmas with -fms-extensions and -E<br>
><br>
> gcc never expands macros in pragmas and MSVC always expands macros<br>
> before processing pragmas.  Clang usually allows macro expansion, except<br>
> in a handful of pragmas, most of which are handled by the lexer.<br>
><br>
> Also remove PPCallbacks for pragmas that are currently handled in the<br>
> parser.  Without a Parser, such as with clang -E, these callbacks would<br>
> never be called.<br>
><br>
> Fixes PR18576.<br>
><br>
> Added:<br>
>    cfe/trunk/test/Preprocessor/print-pragma-microsoft.c<br>
> Modified:<br>
>    cfe/trunk/include/clang/Lex/PPCallbacks.h<br>
>    cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp<br>
>    cfe/trunk/lib/Parse/ParsePragma.cpp<br>
><br>
> Modified: cfe/trunk/include/clang/Lex/PPCallbacks.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PPCallbacks.h?rev=201821&r1=201820&r2=201821&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PPCallbacks.h?rev=201821&r1=201820&r2=201821&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/include/clang/Lex/PPCallbacks.h (original)<br>
> +++ cfe/trunk/include/clang/Lex/PPCallbacks.h Thu Feb 20 16:59:51 2014<br>
> @@ -161,18 +161,6 @@ public:<br>
>                                PragmaIntroducerKind Introducer) {<br>
>   }<br>
><br>
> -  /// \brief Callback invoked when a \#pragma comment directive is read.<br>
> -  virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind,<br>
> -                             const std::string &Str) {<br>
> -  }<br>
> -<br>
> -  /// \brief Callback invoked when a \#pragma detect_mismatch directive is<br>
> -  /// read.<br>
> -  virtual void PragmaDetectMismatch(SourceLocation Loc,<br>
> -                                    const std::string &Name,<br>
> -                                    const std::string &Value) {<br>
> -  }<br>
> -<br>
>   /// \brief Callback invoked when a \#pragma clang __debug directive is read.<br>
>   /// \param Loc The location of the debug directive.<br>
>   /// \param DebugType The identifier following __debug.<br>
> @@ -387,19 +375,6 @@ public:<br>
>     Second->Ident(Loc, str);<br>
>   }<br>
><br>
> -  virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind,<br>
> -                             const std::string &Str) {<br>
> -    First->PragmaComment(Loc, Kind, Str);<br>
> -    Second->PragmaComment(Loc, Kind, Str);<br>
> -  }<br>
> -<br>
> -  virtual void PragmaDetectMismatch(SourceLocation Loc,<br>
> -                                    const std::string &Name,<br>
> -                                    const std::string &Value) {<br>
> -    First->PragmaDetectMismatch(Loc, Name, Value);<br>
> -    Second->PragmaDetectMismatch(Loc, Name, Value);<br>
> -  }<br>
> -<br>
>   virtual void PragmaMessage(SourceLocation Loc, StringRef Namespace,<br>
>                              PragmaMessageKind Kind, StringRef Str) {<br>
>     First->PragmaMessage(Loc, Namespace, Kind, Str);<br>
><br>
> Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=201821&r1=201820&r2=201821&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=201821&r1=201820&r2=201821&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)<br>
> +++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Thu Feb 20 16:59:51 2014<br>
> @@ -138,11 +138,6 @@ public:<br>
>                                   const Module *Imported);<br>
>   virtual void Ident(SourceLocation Loc, const std::string &str);<br>
>   virtual void PragmaCaptured(SourceLocation Loc, StringRef Str);<br>
> -  virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind,<br>
> -                             const std::string &Str);<br>
> -  virtual void PragmaDetectMismatch(SourceLocation Loc,<br>
> -                                    const std::string &Name,<br>
> -                                    const std::string &Value);<br>
>   virtual void PragmaMessage(SourceLocation Loc, StringRef Namespace,<br>
>                              PragmaMessageKind Kind, StringRef Str);<br>
>   virtual void PragmaDebug(SourceLocation Loc, StringRef DebugType);<br>
> @@ -402,36 +397,6 @@ static void outputPrintable(llvm::raw_os<br>
>     }<br>
> }<br>
><br>
> -void PrintPPOutputPPCallbacks::PragmaComment(SourceLocation Loc,<br>
> -                                             const IdentifierInfo *Kind,<br>
> -                                             const std::string &Str) {<br>
> -  startNewLineIfNeeded();<br>
> -  MoveToLine(Loc);<br>
> -  OS << "#pragma comment(" << Kind->getName();<br>
> -<br>
> -  if (!Str.empty()) {<br>
> -    OS << ", \"";<br>
> -    outputPrintable(OS, Str);<br>
> -    OS << '"';<br>
> -  }<br>
> -<br>
> -  OS << ')';<br>
> -  setEmittedDirectiveOnThisLine();<br>
> -}<br>
> -<br>
> -void PrintPPOutputPPCallbacks::PragmaDetectMismatch(SourceLocation Loc,<br>
> -                                                    const std::string &Name,<br>
> -                                                    const std::string &Value) {<br>
> -  startNewLineIfNeeded();<br>
> -  MoveToLine(Loc);<br>
> -  OS << "#pragma detect_mismatch(\"" << Name << '"';<br>
> -  outputPrintable(OS, Name);<br>
> -  OS << "\", \"";<br>
> -  outputPrintable(OS, Value);<br>
> -  OS << "\")";<br>
> -  setEmittedDirectiveOnThisLine();<br>
> -}<br>
> -<br>
> void PrintPPOutputPPCallbacks::PragmaMessage(SourceLocation Loc,<br>
>                                              StringRef Namespace,<br>
>                                              PragmaMessageKind Kind,<br>
> @@ -615,7 +580,13 @@ struct UnknownPragmaHandler : public Pra<br>
>         Callbacks->OS << ' ';<br>
>       std::string TokSpell = PP.getSpelling(PragmaTok);<br>
>       Callbacks->OS.write(&TokSpell[0], TokSpell.size());<br>
> -      PP.LexUnexpandedToken(PragmaTok);<br>
> +<br>
> +      // Expand macros in pragmas with -fms-extensions.  The assumption is that<br>
> +      // the majority of pragmas in such a file will be Microsoft pragmas.<br>
> +      if (PP.getLangOpts().MicrosoftExt)<br>
> +        PP.Lex(PragmaTok);<br>
> +      else<br>
> +        PP.LexUnexpandedToken(PragmaTok);<br>
>     }<br>
>     Callbacks->setEmittedDirectiveOnThisLine();<br>
>   }<br>
><br>
> Modified: cfe/trunk/lib/Parse/ParsePragma.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=201821&r1=201820&r2=201821&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=201821&r1=201820&r2=201821&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/lib/Parse/ParsePragma.cpp (original)<br>
> +++ cfe/trunk/lib/Parse/ParsePragma.cpp Thu Feb 20 16:59:51 2014<br>
> @@ -1253,11 +1253,6 @@ void PragmaDetectMismatchHandler::Handle<br>
>     return;<br>
>   }<br>
><br>
> -  // If the pragma is lexically sound, notify any interested PPCallbacks.<br>
> -  if (PP.getPPCallbacks())<br>
> -    PP.getPPCallbacks()->PragmaDetectMismatch(CommentLoc, NameString,<br>
> -                                              ValueString);<br>
> -<br>
>   Actions.ActOnPragmaDetectMismatch(NameString, ValueString);<br>
> }<br>
><br>
> @@ -1328,9 +1323,5 @@ void PragmaCommentHandler::HandlePragma(<br>
>     return;<br>
>   }<br>
><br>
> -  // If the pragma is lexically sound, notify any interested PPCallbacks.<br>
> -  if (PP.getPPCallbacks())<br>
> -    PP.getPPCallbacks()->PragmaComment(CommentLoc, II, ArgumentString);<br>
> -<br>
>   Actions.ActOnPragmaMSComment(Kind, ArgumentString);<br>
> }<br>
><br>
> Added: cfe/trunk/test/Preprocessor/print-pragma-microsoft.c<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/print-pragma-microsoft.c?rev=201821&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/print-pragma-microsoft.c?rev=201821&view=auto</a><br>

> ==============================================================================<br>
> --- cfe/trunk/test/Preprocessor/print-pragma-microsoft.c (added)<br>
> +++ cfe/trunk/test/Preprocessor/print-pragma-microsoft.c Thu Feb 20 16:59:51 2014<br>
> @@ -0,0 +1,20 @@<br>
> +// RUN: %clang_cc1 %s -fsyntax-only -fms-extensions -E -o - | FileCheck %s<br>
> +<br>
> +#define BAR "2"<br>
> +#pragma comment(linker, "bar=" BAR)<br>
> +// CHECK: #pragma comment(linker, "bar=" "2")<br>
> +#pragma comment(user, "Compiled on " __DATE__ " at " __TIME__)<br>
> +// CHECK: #pragma comment(user, "Compiled on " "{{[^"]*}}" " at " "{{[^"]*}}")<br>
> +<br>
> +#define KEY1 "KEY1"<br>
> +#define KEY2 "KEY2"<br>
> +#define VAL1 "VAL1\""<br>
> +#define VAL2 "VAL2"<br>
> +<br>
> +#pragma detect_mismatch(KEY1 KEY2, VAL1 VAL2)<br>
> +// CHECK: #pragma detect_mismatch("KEY1" "KEY2", "VAL1\"" "VAL2")<br>
> +<br>
> +#define _CRT_PACKING 8<br>
> +#pragma pack(push, _CRT_PACKING)<br>
> +// CHECK: #pragma pack(push, 8)<br>
> +#pragma pack(pop)<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div>
</blockquote></div><br></div></body></html>