[vector] RFR: Fix a typo LibraryCallKit::inline_vector_broadcast_coerced()

John Rose john.r.rose at oracle.com
Tue Jun 9 20:49:40 UTC 2020


On Jun 9, 2020, at 1:30 PM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> 
> +1
> 
> Ouch, easy to make and hard to spot.

C++ compilers output so many warnings to watch your
back, you’d think this would be something they’d catch.

And in fact, they do; it would be -Wcomma and/or
-Wunreachable-code-return, which are not turned
on by -Wall.

— John

P.S. Here’s a little experiment I did to see what gets warned about.
I used gcc -Wall and gcc -Weverything.

int foo(int); int bar(int);
int foo(int x) {
  // -Weverything warning: possible misuse of comma operator here [-Wcomma]
  // -Weverything note: cast expression to void to silence warning
  // (no warning here with -Wall)
  if (bar(x), 1) {
    return 0;
  }
  // -Weverything warning: 'return' will never be executed [-Wunreachable-code-return]
  return x;
}
int bar(int x) {
  // -Wall warning: relational comparison result unused [-Wunused-comparison]
  // (similar warnings as above with -Weverything)
  if (x < 5, 0) {
    return 0;
  }
  return x > 5;
}



More information about the panama-dev mailing list