[llvm] r174347 - Use the do-while(0) thing for this #define.
Michael Gottesman
mgottesman at apple.com
Mon Feb 4 23:53:10 PST 2013
Nice.
On Feb 4, 2013, at 11:19 PM, Bill Wendling <isanbard at gmail.com> wrote:
> Author: void
> Date: Tue Feb 5 01:19:31 2013
> New Revision: 174347
>
> URL: http://llvm.org/viewvc/llvm-project?rev=174347&view=rev
> Log:
> Use the do-while(0) thing for this #define.
>
> Modified:
> llvm/trunk/lib/AsmParser/LLLexer.cpp
>
> Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=174347&r1=174346&r2=174347&view=diff
> ==============================================================================
> --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original)
> +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Tue Feb 5 01:19:31 2013
> @@ -436,9 +436,11 @@ lltok::Kind LLLexer::LexIdentifier() {
> CurPtr = KeywordEnd;
> --StartChar;
> unsigned Len = CurPtr-StartChar;
> -#define KEYWORD(STR) \
> - if (Len == strlen(#STR) && !memcmp(StartChar, #STR, strlen(#STR))) \
> - return lltok::kw_##STR;
> +#define KEYWORD(STR) \
> + do { \
> + if (Len == strlen(#STR) && !memcmp(StartChar, #STR, strlen(#STR))) \
> + return lltok::kw_##STR; \
> + } while (0)
>
> KEYWORD(true); KEYWORD(false);
> KEYWORD(declare); KEYWORD(define);
> @@ -490,11 +492,11 @@ lltok::Kind LLLexer::LexIdentifier() {
> KEYWORD(seq_cst);
> KEYWORD(singlethread);
>
> - KEYWORD(nnan)
> - KEYWORD(ninf)
> - KEYWORD(nsz)
> - KEYWORD(arcp)
> - KEYWORD(fast)
> + KEYWORD(nnan);
> + KEYWORD(ninf);
> + KEYWORD(nsz);
> + KEYWORD(arcp);
> + KEYWORD(fast);
> KEYWORD(nuw);
> KEYWORD(nsw);
> KEYWORD(exact);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list