Open swisspol opened 8 years ago
Our main development platform is 64 bit Mac, however our CI tests the build on various platforms, 32-bit and 64-bit. Could you elaborate on the warnings? Our build system emits 0.
You need to have -Wshorten-64-to-32
enabled or "Implicit Conversion to 32 Bit Type" in Xcode (ON by default for new Xcode projects). I don't think this warning is part of -Wall
or even -Weverything
for some strange reason.
CompileC /Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Intermediates/Bindings.build/Debug/Bindings.build/Objects-normal/x86_64/v7.o /Users/pol/Downloads/Cross/v7/v7.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/pol/Downloads/Bindings
export LANG=en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fmodules -gmodules -fmodules-cache-path=/Users/pol/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fmodules-ignore-macro=V7_NO_FS -fbuild-session-file=/Users/pol/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.8 -g -fvisibility=hidden -Wno-sign-conversion -iquote /Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Intermediates/Bindings.build/Debug/Bindings.build/Bindings-generated-files.hmap -I/Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Intermediates/Bindings.build/Debug/Bindings.build/Bindings-own-target-headers.hmap -I/Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Intermediates/Bindings.build/Debug/Bindings.build/Bindings-all-target-headers.hmap -iquote /Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Intermediates/Bindings.build/Debug/Bindings.build/Bindings-project-headers.hmap -I/Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Products/Debug/include -I/Users/pol/Source/Libraries/libffi/macosx/include -I/Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Intermediates/Bindings.build/Debug/Bindings.build/DerivedSources/x86_64 -I/Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Intermediates/Bindings.build/Debug/Bindings.build/DerivedSources -F/Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Products/Debug -DV7_NO_FS -MMD -MT dependencies -MF /Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Intermediates/Bindings.build/Debug/Bindings.build/Objects-normal/x86_64/v7.d --serialize-diagnostics /Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Intermediates/Bindings.build/Debug/Bindings.build/Objects-normal/x86_64/v7.dia -c /Users/pol/Downloads/Cross/v7/v7.c -o /Users/pol/Library/Developer/Xcode/DerivedData/Bindings-dszrglnhjjfxujalgazdsxrajzqq/Build/Intermediates/Bindings.build/Debug/Bindings.build/Objects-normal/x86_64/v7.o
/Users/pol/Downloads/Cross/v7/v7.c:4141:22: warning: code will never be executed [-Wunreachable-code]
if (UTFmax == 3 || c < T4) return n >= 3;
^
/Users/pol/Downloads/Cross/v7/v7.c:4141:17: note: silence by adding parentheses to mark code as explicitly dead
if (UTFmax == 3 || c < T4) return n >= 3;
^
/* DISABLES CODE */ ( )
/Users/pol/Downloads/Cross/v7/v7.c:4158:25: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
if (!fullrune(s, es - s)) break;
~~~~~~~~ ~~~^~~
/Users/pol/Downloads/Cross/v7/v7.c:4161:10: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return n;
~~~~~~ ^
/Users/pol/Downloads/Cross/v7/v7.c:6006:31: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
cs_sha1_update(&ctx, key, keylen);
~~~~~~~~~~~~~~ ^~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:6024:30: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
cs_sha1_update(&ctx, data, datalen);
~~~~~~~~~~~~~~ ^~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:6184:31: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int pad = field_width - (precision >= 0 ? strnlen(s, precision) : 0);
~~~ ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:7677:11: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
*llen = i;
~ ^
/Users/pol/Downloads/Cross/v7/v7.c:9167:31: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
comparison_result = len - v->len;
~ ~~~~^~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:9174:14: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return mid;
~~~~~~ ^~~
/Users/pol/Downloads/Cross/v7/v7.c:9517:12: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return size;
~~~~~~ ^~~~
/Users/pol/Downloads/Cross/v7/v7.c:9519:10: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return n;
~~~~~~ ^
/Users/pol/Downloads/Cross/v7/v7.c:9588:10: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return i;
~~~~~~ ^
/Users/pol/Downloads/Cross/v7/v7.c:9735:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return b - buf;
~~~~~~ ~~^~~~~
/Users/pol/Downloads/Cross/v7/v7.c:9759:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return b - buf;
~~~~~~ ~~^~~~~
/Users/pol/Downloads/Cross/v7/v7.c:9876:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return b - buf;
~~~~~~ ~~^~~~~
/Users/pol/Downloads/Cross/v7/v7.c:9943:10: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return n;
~~~~~~ ^
/Users/pol/Downloads/Cross/v7/v7.c:11394:80: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
gc_arena_size(&v7->function_arena) * v7->function_arena.cell_size +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/pol/Downloads/Cross/v7/v7.c:11398:70: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
v7->function_arena.alive * v7->function_arena.cell_size +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/pol/Downloads/Cross/v7/v7.c:11401:32: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return v7->owned_strings.size;
~~~~~~ ~~~~~~~~~~~~~~~~~~^~~~
/Users/pol/Downloads/Cross/v7/v7.c:11403:32: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return v7->owned_strings.len;
~~~~~~ ~~~~~~~~~~~~~~~~~~^~~
/Users/pol/Downloads/Cross/v7/v7.c:11405:14: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return gc_arena_size(&v7->object_arena);
~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11407:47: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
return gc_arena_size(&v7->object_arena) - v7->object_arena.alive;
~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11409:31: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return v7->object_arena.cell_size;
~~~~~~ ~~~~~~~~~~~~~~~~~^~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11411:14: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return gc_arena_size(&v7->function_arena);
~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11413:49: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
return gc_arena_size(&v7->function_arena) - v7->function_arena.alive;
~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11415:33: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return v7->function_arena.cell_size;
~~~~~~ ~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11417:14: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return gc_arena_size(&v7->property_arena);
~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11419:49: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
return gc_arena_size(&v7->property_arena) - v7->property_arena.alive;
~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11421:33: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return v7->property_arena.cell_size;
~~~~~~ ~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11423:18: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
return v7->function_arena_ast_size;
~~~~~~ ~~~~^~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11429:35: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
return v7->owned_values.len / sizeof(val_t *);
~~~~~~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11431:36: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
return v7->owned_values.size / sizeof(val_t *);
~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11625:13: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
len = decode_varint((unsigned char *) &h, &llen);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:11646:13: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
len = decode_varint((unsigned char *) p, &llen);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:15201:29: warning: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
funcp->ast_off = *pos - 1;
~ ~~~~~^~~
/Users/pol/Downloads/Cross/v7/v7.c:19920:21: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int i, num_args = v7_argc(v7);
~~~~~~~~ ^~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:20012:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
n = strtol(p, &end, base);
~~~~~~ ^~~~
/Users/pol/Downloads/Cross/v7/v7.c:20052:19: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
int exit_code = arg_long(v7, 0, 0);
~~~~~~~~~ ^~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:21575:23: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
int num = i;
~~~ ^
/Users/pol/Downloads/Cross/v7/v7.c:21702:34: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
sz = loot->caps[0].end - loot->caps[0].start;
~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:21724:36: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
sz = loot->caps[sbn].end - loot->caps[sbn].start;
~ ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:21730:36: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
sz = loot->caps[0].start - src;
~ ~~~~~~~~~~~~~~~~~~~~^~~~~
/Users/pol/Downloads/Cross/v7/v7.c:21736:30: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
sz = src + src_len - loot->caps[0].end;
~ ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:22297:37: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
_Obj_defineProperty(v7, obj, s, n, p->value);
~~~~~~~~~~~~~~~~~~~ ^
/Users/pol/Downloads/Cross/v7/v7.c:22787:16: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int i, len = v7_argc(v7);
~~~ ^~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:22900:20: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int i = 0, len = v7_array_length(v7, obj);
~~~ ^~~~~~~~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:23528:16: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int i, len = v7_argc(v7);
~~~ ^~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:23600:16: warning: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
srand(rand() ^ ((uintptr_t) v7));
~~~~~ ~~~~~~~^~~~~~~~~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:23805:21: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int i, num_args = v7_argc(v7);
~~~~~~~~ ^~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:23860:21: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int i, num_args = v7_argc(v7);
~~~~~~~~ ^~~~~~~~~~~
/Users/pol/Downloads/Cross/v7/v7.c:24156:18: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
int num_args = v7_argc(v7);
~~~~~~~~ ^~~~~~~~~~~
51 warnings generated.
BTW I always have this warning enabled on my projects as it can expose some tricky bugs.
@mmikulicic let's add this flag too!
These warnings are enabled by default in Xcode and Visual C++. For instance there are a number of implicit conversions from
long
toint
which results in truncation on Mac / iOS 64 bits platforms.Is v7 fully supported and tested on 64 bits platforms?