<div dir="ltr">On Tue, Jul 23, 2013 at 11:54 AM, Matt Beaumont-Gay <span dir="ltr"><<a href="mailto:matthewbg@google.com" target="_blank">matthewbg@google.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On Tue, Jul 23, 2013 at 11:01 AM, Richard Trieu <<a href="mailto:rtrieu@google.com">rtrieu@google.com</a>> wrote:<br>

> Author: rtrieu<br>
> Date: Tue Jul 23 13:01:49 2013<br>
> New Revision: 186971<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=186971&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=186971&view=rev</a><br>
> Log:<br>
> Add new diagnostic messages when too many arguments are presented to a<br>
> function-like macro.  Clang will attempt to correct the arguments by detecting<br>
> braced initializer lists:<br>
><br>
> 1) If possible, suggest parentheses around arguments<br>
> containing braced lists which will give the proper number of arguments.<br>
> 2) If a braced list is detected at the start of a macro argument, it cannot be<br>
> corrected by parentheses.  Instead, just point out the location of these<br>
> braced lists.<br>
><br>
> Added:<br>
>     cfe/trunk/test/Preprocessor/macro_with_initializer_list.cpp<br>
> Modified:<br>
>     cfe/trunk/include/clang/Basic/Diagnostic.h<br>
>     cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td<br>
>     cfe/trunk/lib/Lex/PPMacroExpansion.cpp<br>
>     cfe/trunk/test/Preprocessor/macro_fn.c<br>
><br>
> Modified: cfe/trunk/include/clang/Basic/Diagnostic.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=186971&r1=186970&r2=186971&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=186971&r1=186970&r2=186971&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/include/clang/Basic/Diagnostic.h (original)<br>
> +++ cfe/trunk/include/clang/Basic/Diagnostic.h Tue Jul 23 13:01:49 2013<br>
> @@ -990,6 +990,10 @@ public:<br>
>    bool hasMaxRanges() const {<br>
>      return NumRanges == DiagnosticsEngine::MaxRanges;<br>
>    }<br>
> +<br>
> +  bool hasMaxFixItHints() const {<br>
> +    return NumFixits == DiagnosticsEngine::MaxFixItHints;<br>
> +  }<br>
>  };<br>
><br>
>  inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,<br>
><br>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=186971&r1=186970&r2=186971&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=186971&r1=186970&r2=186971&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)<br>
> +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Tue Jul 23 13:01:49 2013<br>
> @@ -460,6 +460,11 @@ def err_unterm_macro_invoc : Error<<br>
>    "unterminated function-like macro invocation">;<br>
>  def err_too_many_args_in_macro_invoc : Error<<br>
>    "too many arguments provided to function-like macro invocation">;<br>
> +def note_suggest_parens_for_macro : Note<<br>
> +  "parentheses are required around macro argument containing braced "<br>
> +  "initializer list">;<br>
> +def note_init_list_at_beginning_of_macro_argument : Note<<br>
> +  "cannot use initializer list at the beginning of an macro argument">;<br>
<br>
</div></div>Nit: s/an/a/<br>
</blockquote></div><br></div><div class="gmail_extra">Nit fixed in r186988.</div></div>