Glenn Randers-Pehrson
2017-03-29 16:02:22 UTC
New libpng warnings. I don't know why clang is objecting to
what seems to be valid use of the comma. The warning messages
hint that using "(void)" would suppress the warnings.
I suspect that in most cases the warning could also be suppressed
by using semicolons instead of commas, and adding braces
if necessary, as in
if (test <= DBL_MAX)
{
++exp_b10; base=test;
}
in place of
if (test <= DBL_MAX)
++exp_b10, base = test;
Glenn
---------- Forwarded message ----------
From: Viktor Szakats <***@github.com>
Date: Wed, Mar 29, 2017 at 5:56 AM
Subject: [glennrp/libpng] Apple clang 8.1.0 warnings (#156)
To: glennrp/libpng <***@noreply.github.com>
Cc: Subscribed <***@noreply.github.com>
After this week's toolchain updates, the following, mostly -Wcomma warnings
appeared. Also included some existing const stripping warnings. This is so
when building libpng with -Weverything option, I haven't tested with other
warning levels. Anyhow some of these *may* be useful information.
png.c:2835:16: warning: possible misuse of comma operator here [-Wcomma]
recip = 1, power = -power;
^
png.c:2835:7: note: cast expression to void to silence warning
recip = 1, power = -power;
^~~~~~~~~
(void)( )
png.c:2913:25: warning: possible misuse of comma operator here [-Wcomma]
++exp_b10, base = test;
^
png.c:2913:16: note: cast expression to void to silence warning
++exp_b10, base = test;
^~~~~~~~~
(void)( )
[snip]
what seems to be valid use of the comma. The warning messages
hint that using "(void)" would suppress the warnings.
I suspect that in most cases the warning could also be suppressed
by using semicolons instead of commas, and adding braces
if necessary, as in
if (test <= DBL_MAX)
{
++exp_b10; base=test;
}
in place of
if (test <= DBL_MAX)
++exp_b10, base = test;
Glenn
---------- Forwarded message ----------
From: Viktor Szakats <***@github.com>
Date: Wed, Mar 29, 2017 at 5:56 AM
Subject: [glennrp/libpng] Apple clang 8.1.0 warnings (#156)
To: glennrp/libpng <***@noreply.github.com>
Cc: Subscribed <***@noreply.github.com>
After this week's toolchain updates, the following, mostly -Wcomma warnings
appeared. Also included some existing const stripping warnings. This is so
when building libpng with -Weverything option, I haven't tested with other
warning levels. Anyhow some of these *may* be useful information.
png.c:2835:16: warning: possible misuse of comma operator here [-Wcomma]
recip = 1, power = -power;
^
png.c:2835:7: note: cast expression to void to silence warning
recip = 1, power = -power;
^~~~~~~~~
(void)( )
png.c:2913:25: warning: possible misuse of comma operator here [-Wcomma]
++exp_b10, base = test;
^
png.c:2913:16: note: cast expression to void to silence warning
++exp_b10, base = test;
^~~~~~~~~
(void)( )
[snip]