[PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

Dávid Bolvanský via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 13 11:23:29 PDT 2020


Done


> Dňa 13. 8. 2020 o 7:29 užívateľ Arthur Eubanks via Phabricator <reviews at reviews.llvm.org> napísal:
> 
> aeubanks added a comment.
> 
> It still seems to trigger on structs at head:
> 
> $ cat /tmp/a.cc
> struct A {
> 
>  const char *a;
>  const char *b;
>  const char *c;
> 
> };
> 
> static A a = {"",
> 
>  ""
>  "",
>  ""};
> 
> $ ./build/bin/clang++ -Wstring-concatenation -o /dev/null -c /tmp/a.cc
> C:/src/tmp/a.cc:10:15: warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Wstring-concatenation]
> 
>  "",
>  ^
> 
> C:/src/tmp/a.cc:9:15: note: place parentheses around the string literal to silence warning
> 
>  ""
>  ^
> 
> 1 warning generated.
> 
> 
> Repository:
>  rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D85545/new/
> 
> https://reviews.llvm.org/D85545
> 


More information about the cfe-commits mailing list