jaewonjoo / webp

Automatically exported from code.google.com/p/webp
0 stars 0 forks source link

-Wincompatible-pointer-types warning on Clang on Windows #253

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In file included from ../../third_party/libwebp/dec/io.c:20:
../../third_party/libwebp/dec/../utils/utils.h(94,19) :  error: incompatible 
pointer types passing 'uint32_t *' (aka 'unsigned int *') to parameter of type 
'unsigned long *' [-Werror,-Wincompatible-pointer-types]
  _BitScanReverse(&first_set_bit, n);
                  ^~~~~~~~~~~~~~
d:\sammc\chrome\src\third_party\llvm-build\Release+Asserts\bin\..\lib\clang\3.7.
0\include\intrin.h(510,32):  note: passing argument to parameter '_Index' here
_BitScanReverse(unsigned long *_Index, unsigned long _Mask) {
                               ^

Original issue reported on code.google.com by sa...@chromium.org on 8 Jul 2015 at 12:25

GoogleCodeExporter commented 8 years ago
thanks for the report!

which platform are you operating on? I'm assuming Windows64 here. It seems we 
need to make
a distinction in the code between _M_X64 and the rest...

Original comment by pascal.m...@gmail.com on 8 Jul 2015 at 7:11

GoogleCodeExporter commented 8 years ago
This occurs with 64 and 32 bit builds on Windows. Changing first_set_bit to an 
unsigned long fixes the warning.

There's a similar warning being fixed in libvpx: 
https://chromium-review.googlesource.com/#/c/283979/1/vp8/encoder/x86/quantize_s
sse3.c.

Original comment by sa...@chromium.org on 8 Jul 2015 at 7:32

GoogleCodeExporter commented 8 years ago
The clang build is a bit more strict than the Visual Studio ones we run. I'll 
put a change together.
For reference can you include the current warnings being used? It might be 
helpful in extending our autoconf build.

Original comment by jz...@google.com on 14 Jul 2015 at 4:10

GoogleCodeExporter commented 8 years ago
For Windows, we build third-party code with /W3 plus a bunch of disables: 
https://code.google.com/p/chromium/codesearch/#chromium/src/build/config/compile
r/BUILD.gn&l=718.
Clang on Windows treats /W3 as -Wall 
(http://llvm.org/releases/3.6.0/tools/clang/docs/UsersManual.html#id5) so it 
enables more warnings than /W3 normally would.

For other platforms, it doesn't look like we enable many warnings for 
third-party code: 
https://code.google.com/p/chromium/codesearch/#chromium/src/build/config/compile
r/BUILD.gn&l=815, 
https://code.google.com/p/chromium/codesearch/#chromium/src/build/config/compile
r/BUILD.gn&l=993.

Original comment by sa...@chromium.org on 15 Jul 2015 at 4:46

GoogleCodeExporter commented 8 years ago
Looks like this was converted for no particular reason when this function was 
moved around. C4057 is a level 4 warning with visual studio, which is why we 
missed it.

https://chromium-review.googlesource.com/#/c/286661/
0250dfc msvc: fix pointer type warning in BitsLog2Floor

Original comment by jz...@google.com on 18 Jul 2015 at 6:32

GoogleCodeExporter commented 8 years ago
Thanks for the report and the links to the compiler settings. This has been 
merged and I'll cherry-pick it to chrome next week.

Original comment by jz...@google.com on 18 Jul 2015 at 6:33