aaron.ballman added a comment.

In D3976#3721421 <https://reviews.llvm.org/D3976#3721421>, @gpakosz wrote:

> Hello,
>
> As of today, `-Wcomma` is not really documented: 
> https://clang.llvm.org/docs/DiagnosticsReference.html#wcomma
>
>> The current whitelisted expressions are increments, decrements, assignments, 
>> compound assignments, overloaded versions of these operators, **and void 
>> returning functions**

FWIW, none of our diagnostics get documentation beyond what you see there (it's 
auto-generated from the diagnostic definition file).

> About `void` returning functions, the following example 
> <https://godbolt.org/z/Wa8qxKv8j> emits `-Wcomma`:
>
>   void foo()
>   {
>   
>   }
>   
>   int bar(int i)
>   {
>     return i;
>   }
>   
>   int main(int argc, char* argv[])
>   {
>     if (foo(), bar(argc))
>       return 0;
>   
>     return -1;
>   }
>
>
>
>   <source>:13:12: warning: possible misuse of comma operator here [-Wcomma]
>     if (foo(), bar(argc))
>              ^
>   <source>:13:7: note: cast expression to void to silence warning
>     if (foo(), bar(argc))
>         ^~~~~
>         (void)( )
>   1 warning generated.
>
> Should I open a bug?

I think opening a bug is appropriate, good catch!


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D3976/new/

https://reviews.llvm.org/D3976

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to