diff --git a/tests/aniso.c b/tests/aniso.c index 1aa9e5f2095fc..7b100cff34bb9 100644 --- a/tests/aniso.c +++ b/tests/aniso.c @@ -222,9 +222,9 @@ int main(int argc, char *argv[]) glBegin( GL_TRIANGLE_STRIP ); void (*f)(int, int) = glVertex2i; - if ((int)f % 16 == 4) f(5, 7); + if ((long)f % 16 == 4) f(5, 7); void (*g)(int, int) = glVertex3f; - if ((int)g % 16 == 4) g(5, 7); - return (int)f + (int)g; + if ((long)g % 16 == 4) g(5, 7); + return (int)((long)f + (long)g); } diff --git a/tests/browser/async_virtual_2.cpp b/tests/browser/async_virtual_2.cpp index c9ab6fecc9126..8c7543347f41c 100644 --- a/tests/browser/async_virtual_2.cpp +++ b/tests/browser/async_virtual_2.cpp @@ -16,7 +16,7 @@ class DOS_Device { DOS_Device *Devices[10]; bool __attribute__((noinline)) DOS_Device::Read(unsigned char * data,unsigned short * size) { - printf("DOS_Device::Read (this = %i)\n", (int)this); + printf("DOS_Device::Read (this = %ld)\n", (long)this); return Devices[devnum]->Read(data,size); } @@ -26,7 +26,7 @@ class device_CON : public DOS_Device { }; bool device_CON::Read(unsigned char * data,unsigned short * size) { - printf("device_CON::Read (this = %i) Sleep--> \n", (int)this); + printf("device_CON::Read (this = %ld) Sleep--> \n", (long)this); EM_ASM({ Module.the_this = $0; out('first this ' + Module.the_this); @@ -36,7 +36,7 @@ bool device_CON::Read(unsigned char * data,unsigned short * size) { out('second this ' + $0); assert(Module.the_this === $0, 'this must be unchanged'); }, this); - printf("<--Sleep (this = %i)\n", (int)this); + printf("<--Sleep (this = %ld)\n", (long)this); return true; } diff --git a/tests/browser_gc.cpp b/tests/browser_gc.cpp index 12f23443f13b8..410057988b2b9 100644 --- a/tests/browser_gc.cpp +++ b/tests/browser_gc.cpp @@ -13,7 +13,7 @@ void *global; int freed = 0; void finalizer(void *ptr, void *arg) { - printf("finalizing %d (global == %d)\n", (int)arg, ptr == global); + printf("finalizing %ld (global == %d)\n", (long)arg, ptr == global); freed++; if (ptr == global) global = 0; } diff --git a/tests/core/pthread/create.cpp b/tests/core/pthread/create.cpp index e663ae78246be..8ff112f6b5878 100644 --- a/tests/core/pthread/create.cpp +++ b/tests/core/pthread/create.cpp @@ -27,7 +27,7 @@ void *ThreadMain(void *arg) { pthread_t thread[NUM_THREADS]; -void CreateThread(int i) +void CreateThread(long i) { int rc = pthread_create(&thread[i], nullptr, ThreadMain, (void*)i); assert(rc == 0); @@ -48,7 +48,7 @@ void mainn() { int main() { // Create initial threads. - for(int i = 0; i < NUM_THREADS; ++i) { + for(long i = 0; i < NUM_THREADS; ++i) { CreateThread(i); } diff --git a/tests/core/stack_overflow.cpp b/tests/core/stack_overflow.cpp index 1e0a6f2591aa5..3117045a617d0 100644 --- a/tests/core/stack_overflow.cpp +++ b/tests/core/stack_overflow.cpp @@ -8,18 +8,18 @@ #include #include -void recurse(unsigned int x); +void recurse(unsigned long x); -void act(volatile unsigned int *a) { - printf("act %d\n", *a); - unsigned int b = (int)(intptr_t)(alloca(*a)); +void act(volatile unsigned long *a) { + printf("act %ld\n", *a); + unsigned long b = (long)(intptr_t)(alloca(*a)); if (b < *a) *a--; recurse(*a); } -void recurse(volatile unsigned int x) { - printf("recurse %d\n", x); - volatile unsigned int a = x; +void recurse(volatile unsigned long x) { + printf("recurse %ld\n", x); + volatile unsigned long a = x; volatile char buffer[1000*1000]; buffer[x/2] = 0; buffer[(x-1)/2] = 0; diff --git a/tests/core/test_alloca.c b/tests/core/test_alloca.c index cd090be9459d3..94f449cdcd56f 100644 --- a/tests/core/test_alloca.c +++ b/tests/core/test_alloca.c @@ -13,9 +13,9 @@ int main(int argc, char **argv) { char *pc, *pc2; assert(argc == 1); pc = (char *)alloca(4+argc); - assert(((int)pc) % 4 == 0); + assert(((long)pc) % 4 == 0); pc2 = (char *)alloca(4+argc); - assert(((int)pc2) % 4 == 0); - printf("z:%d*%d*%d*\n", (int)pc > 0, (int)pc, (int)pc2); + assert(((long)pc2) % 4 == 0); + printf("z:%d*%p*%p*\n", (long)pc > 0, pc, pc2); return 0; } diff --git a/tests/core/test_asan_memchr.c b/tests/core/test_asan_memchr.c index 57dcd37d0294d..90c614242a887 100644 --- a/tests/core/test_asan_memchr.c +++ b/tests/core/test_asan_memchr.c @@ -1,5 +1,6 @@ #include +#include int main() { - return (int)memchr("hello", 'z', 7); + return (int)(intptr_t)memchr("hello", 'z', 7); } diff --git a/tests/core/test_atexit_threads.c b/tests/core/test_atexit_threads.c index 186e89a16b286..63a1e960aa435 100644 --- a/tests/core/test_atexit_threads.c +++ b/tests/core/test_atexit_threads.c @@ -13,7 +13,7 @@ extern int __cxa_thread_atexit_impl(void (*dtor)(void *), void *obj, void *dso_s static void cleanA() { printf("A\n"); } static void cleanB() { printf("B\n"); } -static void cleanCarg(void* x) { printf("C %d\n", (int)x); } +static void cleanCarg(void* x) { printf("C %ld\n", (long)x); } int main() { atexit(cleanA); diff --git a/tests/core/test_ccall.cpp b/tests/core/test_ccall.cpp index 03f1d4cd7c16c..5d1761f9c1c20 100644 --- a/tests/core/test_ccall.cpp +++ b/tests/core/test_ccall.cpp @@ -16,8 +16,8 @@ const char *get_string() { return "hello world"; } void print_int(int x) { printf("%d\n", x); } void print_float(float x) { printf("%.2f\n", x); } void print_string(char *x) { printf("%s\n", x); } -void print_bool(bool x) { - if (x) printf("true\n"); +void print_bool(bool x) { + if (x) printf("true\n"); else if (!x) printf("false\n"); } int multi(int x, float y, int z, char *str) { @@ -36,11 +36,11 @@ int *pointer(int *in) { struct test_struct { int arg1, arg2, arg3; }; -static int* stackChecker = 0; +static intptr_t* stackChecker = 0; __attribute__((noinline)) -int get_stack() { int i; return (int)&i; } +intptr_t get_stack() { int i; return (intptr_t)&i; } int uses_stack(test_struct* t1) { - if (stackChecker == 0) stackChecker = (int*)malloc(sizeof(int)); + if (stackChecker == 0) stackChecker = (intptr_t*)malloc(sizeof(intptr_t)); *stackChecker = get_stack(); EM_ASM(Module['ccall']('get_int', 'number')); printf("stack is %s.\n", *stackChecker == get_stack() ? "ok" : "messed up"); diff --git a/tests/core/test_emmalloc_memory_statistics.cpp b/tests/core/test_emmalloc_memory_statistics.cpp index 4de5a5d0f5de4..b098cf1cf235f 100644 --- a/tests/core/test_emmalloc_memory_statistics.cpp +++ b/tests/core/test_emmalloc_memory_statistics.cpp @@ -13,7 +13,7 @@ int main() void *ptr3 = malloc(64*1024*1024); void *ptr4 = malloc(16*1024); void *ptr5 = malloc(2*1024*1024); - printf("%d\n", (int)(ptr && ptr2 && ptr3 && ptr4 && ptr5)); + printf("%ld\n", (long)(ptr && ptr2 && ptr3 && ptr4 && ptr5)); free(ptr2); free(ptr4); printf("%d\n", emmalloc_validate_memory_regions()); diff --git a/tests/core/test_emscripten_async_call.c b/tests/core/test_emscripten_async_call.c index 483d7d598f959..cda272a05dec6 100644 --- a/tests/core/test_emscripten_async_call.c +++ b/tests/core/test_emscripten_async_call.c @@ -14,7 +14,7 @@ void myatexit() { void callback(void *arg) { printf("callback\n"); doneCallback = true; - assert((int)arg == 42); + assert(arg == (void *)42); // Runtime should exit after this callback returns } diff --git a/tests/core/test_funcptr_namecollide.c b/tests/core/test_funcptr_namecollide.c index 2a20c3e0f8b28..a2858176f87d9 100644 --- a/tests/core/test_funcptr_namecollide.c +++ b/tests/core/test_funcptr_namecollide.c @@ -11,7 +11,7 @@ void do_call(void (*puts)(const char *), const char *str); void do_print(const char *str) { if (!str) do_call(NULL, "delusion"); - if ((int)str == -1) do_print(str + 10); + if ((long)str == -1) do_print(str + 10); puts("===="); puts(str); puts("===="); @@ -19,7 +19,7 @@ void do_print(const char *str) { void do_call(void (*puts)(const char *), const char *str) { if (!str) do_print("confusion"); - if ((int)str == -1) do_call(NULL, str - 10); + if ((long)str == -1) do_call(NULL, str - 10); (*puts)(str); } diff --git a/tests/core/test_i64_2.cpp b/tests/core/test_i64_2.cpp index 8889555744c8f..714fe2bf70b79 100644 --- a/tests/core/test_i64_2.cpp +++ b/tests/core/test_i64_2.cpp @@ -98,7 +98,7 @@ int main(int argc, char **argv) uint64_t a = 5; double b = 6.8; uint64_t c = a * b; - if (truthy()) printf("*%d,%d,%d*\n", (int)&a, (int)&b, (int)&c); // printing addresses prevents optimizations + if (truthy()) printf("*%ld,%ld,%ld*\n", (long)&a, (long)&b, (long)&c); // printing addresses prevents optimizations printf("*prod:%llu*\n", c); } diff --git a/tests/core/test_longjmp_stacked.c b/tests/core/test_longjmp_stacked.c index cae85cb01f7d2..6e8f41ffe9118 100644 --- a/tests/core/test_longjmp_stacked.c +++ b/tests/core/test_longjmp_stacked.c @@ -10,7 +10,7 @@ #include #include -int bottom, top; +intptr_t bottom, top; int run(int y) { // confuse stack @@ -19,7 +19,7 @@ int run(int y) { s[y] = y; s[y / 2] = y * 2; volatile int x = s[y]; - top = (int)alloca(4); + top = (intptr_t)alloca(4); if (x <= 2) return x; jmp_buf buf; printf("setjmp of %d\n", x); @@ -35,7 +35,7 @@ int run(int y) { int main(int argc, char **argv) { int sum = 0; for (int i = 0; i < argc * 2; i++) { - bottom = (int)alloca(4); + bottom = (intptr_t)alloca(4); sum += run(10); // scorch the earth if (bottom < top) { diff --git a/tests/core/test_longjmp_unwind.c b/tests/core/test_longjmp_unwind.c index ddd11a250ead3..8035d8a9c9a56 100644 --- a/tests/core/test_longjmp_unwind.c +++ b/tests/core/test_longjmp_unwind.c @@ -32,8 +32,8 @@ volatile void* temp; __attribute__((noinline)) void foo() { temp = alloca(MAJOR); - printf("major allocation at: %d\n", (int)temp); - assert(abs(emscripten_stack_get_current() - (int)temp) >= MAJOR); + printf("major allocation at: %ld\n", (long)temp); + assert(abs(emscripten_stack_get_current() - (long)temp) >= MAJOR); bar(); } diff --git a/tests/core/test_memorygrowth.c b/tests/core/test_memorygrowth.c index b16855beedf10..4e941c7341112 100644 --- a/tests/core/test_memorygrowth.c +++ b/tests/core/test_memorygrowth.c @@ -25,12 +25,12 @@ int main(int argc, char **argv) int totalMemory = EM_ASM_INT({ return HEAP8.length }); char *buf3 = (char*)malloc(totalMemory+1); - buf3[argc] = (int)buf2; - if (argc % 7 == 6) printf("%d\n", (int)memcpy(buf3, buf1, argc)); + buf3[argc] = (long)buf2; + if (argc % 7 == 6) printf("%ld\n", (long)memcpy(buf3, buf1, argc)); char *buf4 = (char*)malloc(100); float *buf5 = (float*)malloc(100); //printf("totalMemory: %d bufs: %d,%d,%d,%d,%d\n", totalMemory, buf1, buf2, buf3, buf4, buf5); - assert((int)buf4 > (int)totalMemory && (int)buf5 > (int)totalMemory); + assert((long)buf4 > (long)totalMemory && (long)buf5 > (long)totalMemory); printf("*%s,%.3f*\n", buf1, buf2[0]); // the old heap data should still be there diff --git a/tests/core/test_memorygrowth_2.c b/tests/core/test_memorygrowth_2.c index 1975adb905861..4cd1404bf2ad3 100644 --- a/tests/core/test_memorygrowth_2.c +++ b/tests/core/test_memorygrowth_2.c @@ -28,13 +28,13 @@ int main(int argc, char **argv) char *buf3; for (int i = 0; i < (totalMemory/chunk)+1; i++) { buf3 = (char*)malloc(chunk); - buf3[argc] = (int)buf2; + buf3[argc] = (long)buf2; } if (argc % 7 == 6) printf("%p\n", memcpy(buf3, buf1, argc)); char *buf4 = (char*)malloc(100); float *buf5 = (float*)malloc(100); //printf("totalMemory: %d bufs: %d,%d,%d,%d,%d\n", totalMemory, buf1, buf2, buf3, buf4, buf5); - assert((int)buf4 > (int)totalMemory && (int)buf5 > (int)totalMemory); + assert((long)buf4 > (long)totalMemory && (long)buf5 > (long)totalMemory); printf("*%s,%.3f*\n", buf1, buf2[0]); // the old heap data should still be there diff --git a/tests/core/test_memorygrowth_memory_growth_step.c b/tests/core/test_memorygrowth_memory_growth_step.c index d4d71d168e81a..492e60132246d 100644 --- a/tests/core/test_memorygrowth_memory_growth_step.c +++ b/tests/core/test_memorygrowth_memory_growth_step.c @@ -35,7 +35,7 @@ int main() { for (int i = 0; 1; i++) { printf("%d %d %d\n", i, get_memory_size(), get_memory_size() / MB); - volatile int sink = (int)malloc(MB); + volatile long sink = (long)malloc(MB); if (!sink) { printf("failed at %d %d %d\n", i, get_memory_size(), get_memory_size() / MB); diff --git a/tests/core/test_memorygrowth_wasm_mem_max.c b/tests/core/test_memorygrowth_wasm_mem_max.c index 7f8a30cb558e3..94ad49af7d4f0 100644 --- a/tests/core/test_memorygrowth_wasm_mem_max.c +++ b/tests/core/test_memorygrowth_wasm_mem_max.c @@ -16,7 +16,7 @@ int main() { // higher can prove we stop at the right point. for (int i = 0; 1; i++) { printf("%d\n", i); - volatile int sink = (int)malloc(MB); + volatile long sink = (long)malloc(MB); if (!sink) { printf("failed at %d\n", i); assert(i > 70); diff --git a/tests/core/test_mmap.c b/tests/core/test_mmap.c index 35ab61c4af513..e091892537e70 100644 --- a/tests/core/test_mmap.c +++ b/tests/core/test_mmap.c @@ -21,7 +21,7 @@ int main(int argc, char* argv[]) { int* map = (int*)mmap(0, 5000, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); assert(map != MAP_FAILED); - assert(((int)map) % 65536 == 0); // aligned + assert(((long)map) % 65536 == 0); // aligned assert(munmap(map, 5000) == 0); } diff --git a/tests/core/test_set_align.c b/tests/core/test_set_align.c index e985d459652f6..dc5ab1053541c 100644 --- a/tests/core/test_set_align.c +++ b/tests/core/test_set_align.c @@ -7,49 +7,49 @@ #include #include - + volatile char data[16]; - + __attribute__((noinline)) void *get_aligned(int align) { - char *ptr = (char*)(((int)(data + 7)) & ~7); // Make 8-byte aligned + char *ptr = (char*)(((long)(data + 7)) & ~7); // Make 8-byte aligned ptr += align; // Now 'align' aligned return (void*)ptr; } - + int main() { emscripten_align4_double *d4 = (emscripten_align4_double*)get_aligned(4); *d4 = 17.0; - printf("addr: %d, value: %f\n", ((int)d4) % 8, *d4); + printf("addr: %ld, value: %f\n", ((long)d4) % 8, *d4); emscripten_align2_double *d2 = (emscripten_align2_double*)get_aligned(2); *d2 = 18.0; - printf("addr: %d, value: %f\n", ((int)d2) % 8, *d2); + printf("addr: %ld, value: %f\n", ((long)d2) % 8, *d2); emscripten_align1_double *d1 = (emscripten_align1_double*)get_aligned(1); *d1 = 19.0; - printf("addr: %d, value: %f\n", ((int)d1) % 8, *d1); + printf("addr: %ld, value: %f\n", ((long)d1) % 8, *d1); emscripten_align2_float *f2 = (emscripten_align2_float*)get_aligned(2); *f2 = 20.0; - printf("addr: %d, value: %f\n", ((int)f2) % 4, *f2); + printf("addr: %ld, value: %f\n", ((long)f2) % 4, *f2); emscripten_align1_float *f1 = (emscripten_align1_float*)get_aligned(1); *f1 = 21.0; - printf("addr: %d, value: %f\n", ((int)f1) % 4, *f1); + printf("addr: %ld, value: %f\n", ((long)f1) % 4, *f1); emscripten_align2_int *i2 = (emscripten_align2_int*)get_aligned(2); *i2 = 22; - printf("addr: %d, value: %d\n", ((int)i2) % 4, *i2); + printf("addr: %ld, value: %d\n", ((long)i2) % 4, *i2); emscripten_align1_int *i1 = (emscripten_align1_int*)get_aligned(1); *i1 = 23; - printf("addr: %d, value: %d\n", ((int)i1) % 4, *i1); + printf("addr: %ld, value: %d\n", ((long)i1) % 4, *i1); emscripten_align1_short *s1 = (emscripten_align1_short*)get_aligned(1); *s1 = 24; - printf("addr: %d, value: %d\n", ((int)s1) % 4, (int)*s1); + printf("addr: %ld, value: %d\n", ((long)s1) % 4, (int)*s1); return 0; } diff --git a/tests/core/test_sintvars.c b/tests/core/test_sintvars.c index 10e2c414be6e3..b8a38d4f0ca5a 100644 --- a/tests/core/test_sintvars.c +++ b/tests/core/test_sintvars.c @@ -17,15 +17,15 @@ int main() { s->match_start = (char *)32522; s->strstart = (char *)(32780); - printf("*%d,%d,%d*\n", (int)s->strstart, (int)s->match_start, - (int)(s->strstart - s->match_start)); + printf("*%ld,%ld,%ld*\n", (long)s->strstart, (long)s->match_start, + (long)(s->strstart - s->match_start)); sh = s->strstart - s->match_start; printf("*%d,%d*\n", sh, sh >> 7); s->match_start = (char *)32999; s->strstart = (char *)(32780); - printf("*%d,%d,%d*\n", (int)s->strstart, (int)s->match_start, - (int)(s->strstart - s->match_start)); + printf("*%ld,%ld,%ld*\n", (long)s->strstart, (long)s->match_start, + (long)(s->strstart - s->match_start)); sh = s->strstart - s->match_start; printf("*%d,%d*\n", sh, sh >> 7); } diff --git a/tests/core/test_sup.cpp b/tests/core/test_sup.cpp index 4469483984160..ed619d4c2e5af 100644 --- a/tests/core/test_sup.cpp +++ b/tests/core/test_sup.cpp @@ -21,12 +21,12 @@ int main() #define TEST(struc) \ { \ struc *s = 0; \ - printf("*%s: %d,%d,%d,%d<%zu*\n", #struc, (int)&(s->a), (int)&(s->b), (int)&(s->c), (int)&(s->later), sizeof(struc)); \ + printf("*%s: %ld,%ld,%ld,%ld<%zu*\n", #struc, (long)&(s->a), (long)&(s->b), (long)&(s->c), (long)&(s->later), sizeof(struc)); \ } #define TEST_ARR(struc) \ { \ struc *s = 0; \ - printf("*%s: %d,%d,%d,%d<%zu*\n", #struc, (int)&(s->a[0]), (int)&(s->a[1]), (int)&(s->a[2]), (int)&(s->later), sizeof(struc)); \ + printf("*%s: %ld,%ld,%ld,%ld<%zu*\n", #struc, (long)&(s->a[0]), (long)&(s->a[1]), (long)&(s->a[2]), (long)&(s->later), sizeof(struc)); \ } printf("sizeofs:%zu,%zu\n", sizeof(S6), sizeof(S6z)); TEST(C___); diff --git a/tests/emscripten_api_browser.c b/tests/emscripten_api_browser.c index 7728e1e6bf668..c3b7118c2b637 100644 --- a/tests/emscripten_api_browser.c +++ b/tests/emscripten_api_browser.c @@ -19,26 +19,26 @@ bool pre2ed = false; void pre1(void *arg) { assert(!pre1ed); assert(!pre2ed); - assert((int)arg == 123); + assert((long)arg == 123); pre1ed = true; } void pre2(void *arg) { assert(pre1ed); assert(!pre2ed); - assert((int)arg == 98); + assert((long)arg == 98); pre2ed = true; } bool fived = false; void five(void *arg) { - assert((int)arg == 55); + assert((long)arg == 55); fived = true; emscripten_resume_main_loop(); } void argey(void* arg) { static int counter = 0; - assert((int)arg == 17); + assert((long)arg == 17); counter++; printf("argey: %d\n", counter); if (counter == 5) { @@ -69,7 +69,7 @@ void mainey() { } void four(void *arg) { - assert((int)arg == 43); + assert((long)arg == 43); printf("four!\n"); emscripten_set_main_loop(mainey, 0, 0); } diff --git a/tests/emscripten_fs_api_browser.c b/tests/emscripten_fs_api_browser.c index e1f152152054f..daf68e6ad292f 100644 --- a/tests/emscripten_fs_api_browser.c +++ b/tests/emscripten_fs_api_browser.c @@ -20,10 +20,10 @@ int data_ok = 0; int data_bad = 0; void onLoadedData(void *arg, void *buffer, int size) { - printf("onLoadedData %d\n", (int)arg); + printf("onLoadedData %ld\n", (long)arg); get_count++; assert(size == 329895); - assert((int)arg == 135); + assert((long)arg == 135); unsigned char *b = (unsigned char*)buffer; assert(b[0] == 137); assert(b[1122] == 128); @@ -33,9 +33,9 @@ void onLoadedData(void *arg, void *buffer, int size) { } void onErrorData(void *arg) { - printf("onErrorData %d\n", (int)arg); + printf("onErrorData %ld\n", (long)arg); get_count++; - assert((int)arg == 246); + assert((long)arg == 246); data_bad = 1; } diff --git a/tests/emscripten_request_animation_frame.c b/tests/emscripten_request_animation_frame.c index 13cf4e85be94a..3944f098761b0 100644 --- a/tests/emscripten_request_animation_frame.c +++ b/tests/emscripten_request_animation_frame.c @@ -8,7 +8,7 @@ EM_BOOL func1(double time, void *userData); EM_BOOL func2(double time, void *userData) { - assert((int)userData == 2); + assert((long)userData == 2); assert(time > 0); ++func2Executed; @@ -32,7 +32,7 @@ EM_BOOL func2(double time, void *userData) EM_BOOL func1(double time, void *userData) { - assert((int)userData == 1); + assert((long)userData == 1); assert(time > 0); ++func1Executed; diff --git a/tests/emscripten_request_animation_frame_loop.c b/tests/emscripten_request_animation_frame_loop.c index 01ef93c222301..607c1c9c2e5a4 100644 --- a/tests/emscripten_request_animation_frame_loop.c +++ b/tests/emscripten_request_animation_frame_loop.c @@ -6,7 +6,7 @@ int funcExecuted = 0; void testDone(void *userData) { - assert((int)userData == 2); + assert((long)userData == 2); assert(funcExecuted == 10); #ifdef REPORT_RESULT REPORT_RESULT(0); @@ -17,7 +17,7 @@ EM_BOOL tick(double time, void *userData) { assert(time > previousRafTime); previousRafTime = time; - assert((int)userData == 1); + assert((long)userData == 1); ++funcExecuted; if (funcExecuted == 10) { diff --git a/tests/emscripten_set_immediate.c b/tests/emscripten_set_immediate.c index 8138e909eb35e..a07bed1cd52ad 100644 --- a/tests/emscripten_set_immediate.c +++ b/tests/emscripten_set_immediate.c @@ -8,7 +8,7 @@ int func2Executed = 0; void func1(void *userData); void func2(void *userData) { - assert((int)userData == 2); + assert((long)userData == 2); ++func2Executed; if (func2Executed == 1) { @@ -25,7 +25,7 @@ void func2(void *userData) { } void func1(void *userData) { - assert((int)userData == 1); + assert((long)userData == 1); ++func1Executed; assert(func1Executed == 1); emscripten_set_immediate(func2, (void*)2); diff --git a/tests/emscripten_set_immediate_loop.c b/tests/emscripten_set_immediate_loop.c index 6693329d9ca4e..5f27e0e6eb4e5 100644 --- a/tests/emscripten_set_immediate_loop.c +++ b/tests/emscripten_set_immediate_loop.c @@ -5,13 +5,13 @@ int funcExecuted = 0; void testDone(void *userData) { - assert((int)userData == 2); + assert((long)userData == 2); assert(funcExecuted == 10); exit(0); } EM_BOOL tick(void *userData) { - assert((int)userData == 1); + assert((long)userData == 1); ++funcExecuted; if (funcExecuted == 10) { emscripten_set_timeout(testDone, 300, (void*)2); diff --git a/tests/emscripten_set_interval.c b/tests/emscripten_set_interval.c index 2d6e5b0fe0144..103877c6eca43 100644 --- a/tests/emscripten_set_interval.c +++ b/tests/emscripten_set_interval.c @@ -7,7 +7,7 @@ int funcExecuted = 0; void testDone(void *userData) { - assert((int)userData == 2); + assert((long)userData == 2); assert(funcExecuted == 10); exit(0); } @@ -15,7 +15,7 @@ void testDone(void *userData) { long intervalId = 0; void tick(void *userData) { - assert((int)userData == 1); + assert((long)userData == 1); ++funcExecuted; if (funcExecuted == 10) { emscripten_set_timeout(testDone, 300, (void*)2); diff --git a/tests/emscripten_set_timeout.c b/tests/emscripten_set_timeout.c index e6a8f7257477e..cf1e8521df68d 100644 --- a/tests/emscripten_set_timeout.c +++ b/tests/emscripten_set_timeout.c @@ -10,7 +10,7 @@ int func2Executed = 0; void func1(void *userData); void func2(void *userData) { - assert((int)userData == 2); + assert((long)userData == 2); ++func2Executed; if (func2Executed == 1) @@ -29,7 +29,7 @@ void func2(void *userData) { } void func1(void *userData) { - assert((int)userData == 1); + assert((long)userData == 1); ++func1Executed; assert(func1Executed == 1); diff --git a/tests/emscripten_set_timeout_loop.c b/tests/emscripten_set_timeout_loop.c index 8a45349436b8d..0ce1837a17404 100644 --- a/tests/emscripten_set_timeout_loop.c +++ b/tests/emscripten_set_timeout_loop.c @@ -8,7 +8,7 @@ double previousSetTimeouTime = 0; int funcExecuted = 0; void testDone(void *userData) { - assert((int)userData == 2); + assert((long)userData == 2); assert(funcExecuted == 10); exit(0); } @@ -16,7 +16,7 @@ void testDone(void *userData) { EM_BOOL tick(double time, void *userData) { assert(time >= previousSetTimeouTime); previousSetTimeouTime = time; - assert((int)userData == 1); + assert((long)userData == 1); ++funcExecuted; if (funcExecuted == 10) { diff --git a/tests/fuzz/23.cpp b/tests/fuzz/23.cpp index 414fa0f8a0d65..f20cc722cacce 100644 --- a/tests/fuzz/23.cpp +++ b/tests/fuzz/23.cpp @@ -106,7 +106,7 @@ static int32_t * func_53(uint16_t p_54, int32_t * p_55, const int32_t * p_56); /* --- FUNCTIONS --- */ /* ------------------------------------------ */ -/* +/* * reads : g_15 g_59 g_62 g_63 g_82 g_89 g_103 g_90 g_145 g_282 g_303 g_285 g_389 g_390 g_391 g_392 g_348 g_523 g_215 g_424 g_508 g_423 g_286 g_362 g_723 g_774 g_784 g_880 g_952 g_962 g_967 g_994 g_422 g_1098 g_1103 g_1151 g_1183 g_1343 g_1275 g_1276 g_1277 g_1184 g_1274 g_1478 g_1538 g_1580 g_1581 g_1747 g_1823 g_1824 g_1825 g_1846 g_1878 g_1879 g_1104 * writes: g_63 g_82 g_103 g_215 g_145 g_282 g_286 g_90 g_303 g_285 g_523 g_348 g_62 g_392 g_508 g_676 g_731 g_424 g_779 g_59 g_362 g_911 g_913 g_1274 g_962 g_1406 g_1184 g_89 g_1478 g_1151 g_784 g_422 g_1343 g_15 g_1823 g_1846 g_994 g_1962 g_1965 g_1183 */ @@ -239,7 +239,7 @@ static const int32_t func_1(void) #include /* ------------------------------------------ */ -/* +/* * reads : g_508 g_389 g_390 g_391 g_392 g_784 g_63 g_994 g_423 g_774 g_59 g_362 g_82 g_89 g_103 g_15 g_303 g_145 g_286 g_348 g_880 g_723 g_952 g_424 g_962 g_967 g_285 g_282 g_422 g_1098 g_1103 g_1151 g_1183 g_90 g_215 g_1343 g_1275 g_1276 g_1277 g_1184 g_1274 * writes: g_508 g_962 g_145 g_215 g_424 g_82 g_62 g_779 g_59 g_90 g_286 g_362 g_282 g_103 g_63 g_348 g_303 g_911 g_913 g_285 g_1274 g_676 g_1406 g_1184 g_89 g_784 g_422 */ @@ -252,18 +252,18 @@ static uint16_t func_6(const uint8_t p_7, uint8_t p_8, uint16_t p_9, uint8_t const int16_t l_1573 = 0x08CDL; int32_t *TEMP; int32_t **SAVE = l_1565; - printf("will store %d, %d, %d\n", (int)l_1565, (int)&l_1565, SAVE); // waka + printf("will store %ld, %ld, %d\n", (long)l_1565, (long)&l_1565, SAVE); // waka TEMP = func_34(l_1557, 0, p_10, g_994); - printf("almost store %d, %d, %d\n", (int)l_1565, (int)&l_1565, SAVE); // waka + printf("almost store %ld, %ld, %d\n", (long)l_1565, (long)&l_1565, SAVE); // waka assert(SAVE == l_1565); (*l_1565) = TEMP; - printf("now store %d, %d, %d\n", (int)l_1565, (int)&l_1565, SAVE); // waka + printf("now store %ld, %ld, %d\n", (long)l_1565, (long)&l_1565, SAVE); // waka return 0; } /* ------------------------------------------ */ -/* +/* * reads : g_15 g_59 g_62 g_63 g_82 g_89 g_103 g_90 g_145 g_282 g_303 g_285 g_389 g_390 g_391 g_392 g_348 g_523 g_215 g_424 g_508 g_423 g_286 g_362 g_723 g_774 g_784 g_880 g_952 g_962 g_967 g_994 g_422 g_1098 g_1103 g_1151 g_1183 g_1343 g_1275 g_1276 g_1277 g_1184 g_1274 g_1478 g_1538 * writes: g_63 g_82 g_103 g_215 g_145 g_282 g_286 g_90 g_303 g_285 g_523 g_348 g_62 g_392 g_508 g_676 g_731 g_424 g_779 g_59 g_362 g_911 g_913 g_1274 g_962 g_1406 g_1184 g_89 g_1478 g_1151 */ @@ -280,7 +280,7 @@ static int32_t func_22(int32_t p_23) /* ------------------------------------------ */ -/* +/* * reads : g_282 g_82 g_1538 g_1098 g_423 * writes: g_282 g_508 g_1151 g_285 g_62 */ @@ -291,7 +291,7 @@ static int32_t * func_24(int32_t * p_25, int16_t p_26, int32_t p_27, int32_t * /* ------------------------------------------ */ -/* +/* * reads : g_145 g_303 g_423 g_1478 g_1098 g_1151 g_103 g_952 g_390 g_391 g_392 g_389 g_424 g_723 g_508 g_774 g_59 g_784 g_362 g_82 g_89 g_15 g_63 g_286 g_348 g_880 g_962 g_967 g_285 g_994 g_282 g_422 g_1103 g_1183 g_90 g_215 g_1343 g_1275 g_1276 g_1277 g_1184 g_1274 * writes: g_145 g_303 g_62 g_1478 g_285 g_1151 g_103 g_215 g_424 g_82 g_779 g_59 g_90 g_286 g_362 g_282 g_63 g_348 g_508 g_911 g_913 g_1274 g_962 g_676 g_1406 g_1184 g_89 */ @@ -302,7 +302,7 @@ static int32_t * func_30(int32_t * p_31, uint32_t p_32, int8_t p_33) /* ------------------------------------------ */ -/* +/* * reads : g_215 g_508 g_392 g_82 g_423 g_774 g_59 g_784 g_90 g_362 g_89 g_103 g_15 g_63 g_389 g_390 g_391 g_303 g_145 g_286 g_348 g_880 g_723 g_952 g_424 g_962 g_967 g_285 g_994 g_282 g_422 g_1098 g_1103 g_1151 g_1183 g_1343 g_1275 g_1276 g_1277 g_1184 g_1274 * writes: g_215 g_424 g_145 g_82 g_62 g_779 g_59 g_90 g_286 g_362 g_282 g_103 g_63 g_348 g_508 g_303 g_911 g_913 g_285 g_1274 g_962 g_676 g_1406 g_1184 g_89 */ @@ -369,7 +369,7 @@ printf("func 34 out6 last\n");//storing to %d, %d, %d, %d\n", (int)l_1565, (int) /* ------------------------------------------ */ -/* +/* * reads : g_103 g_63 g_282 g_15 g_59 g_303 g_82 g_285 g_90 g_389 g_390 g_391 g_392 g_145 g_348 g_523 g_215 g_424 g_62 g_508 g_423 g_286 g_362 g_723 g_89 * writes: g_63 g_282 g_286 g_90 g_303 g_82 g_285 g_523 g_348 g_62 g_392 g_145 g_508 g_676 g_731 g_103 */ @@ -380,7 +380,7 @@ static uint16_t func_40(int32_t * const p_41, uint32_t p_42, const int16_t p /* ------------------------------------------ */ -/* +/* * reads : g_145 g_82 g_59 g_63 * writes: g_145 g_82 g_103 g_63 */ @@ -391,7 +391,7 @@ static int32_t * func_44(uint8_t p_45) /* ------------------------------------------ */ -/* +/* * reads : g_63 g_90 g_82 g_103 g_59 g_15 g_145 g_89 * writes: g_63 g_103 g_215 g_82 */ @@ -402,7 +402,7 @@ static uint8_t func_46(int32_t p_47, uint8_t p_48, int32_t * p_49, int8_t p_ /* ------------------------------------------ */ -/* +/* * reads : g_82 g_89 g_59 g_103 g_63 g_15 g_285 * writes: g_82 g_103 g_63 */ diff --git a/tests/gl_in_two_pthreads.cpp b/tests/gl_in_two_pthreads.cpp index b78257a8bb683..cb9ae44ffcbfa 100644 --- a/tests/gl_in_two_pthreads.cpp +++ b/tests/gl_in_two_pthreads.cpp @@ -16,9 +16,9 @@ void fill(int color) { switch(color) { - case 1: glClearColor(1, 0, 0, 1); printf("On thread %d: you should see a red canvas.\n", (int)pthread_self()); break; - case 2: glClearColor(0, 1, 0, 1); printf("On thread %d: you should see a green canvas.\n", (int)pthread_self()); break; - case 3: glClearColor(0, 0, 1, 1); printf("On thread %d: you should see a blue canvas.\n", (int)pthread_self()); break; + case 1: glClearColor(1, 0, 0, 1); printf("On thread %ld: you should see a red canvas.\n", (long)pthread_self()); break; + case 2: glClearColor(0, 1, 0, 1); printf("On thread %ld: you should see a green canvas.\n", (long)pthread_self()); break; + case 3: glClearColor(0, 0, 1, 1); printf("On thread %ld: you should see a blue canvas.\n", (long)pthread_self()); break; } glClear(GL_COLOR_BUFFER_BIT); EMSCRIPTEN_RESULT r = emscripten_webgl_commit_frame(); @@ -38,7 +38,7 @@ void *thread_main(void *param) EMSCRIPTEN_RESULT r = emscripten_webgl_make_context_current(ctx); assert(r == EMSCRIPTEN_RESULT_SUCCESS); - fill((int)param); + fill((int)(intptr_t)param); r = emscripten_webgl_make_context_current(0); assert(r == EMSCRIPTEN_RESULT_SUCCESS); diff --git a/tests/hello_world_loop.cpp b/tests/hello_world_loop.cpp index 0779a829f8793..b421e036b7953 100644 --- a/tests/hello_world_loop.cpp +++ b/tests/hello_world_loop.cpp @@ -19,7 +19,7 @@ int main() { for (int i = 0; i < strlen(original); i += 2) { copy[i/2] = original[i]; } - copy[strlen(copy)+1] = (int)&original; // force original to be on the stack + copy[strlen(copy)+1] = (long)&original; // force original to be on the stack dump(copy); return 0; } diff --git a/tests/hello_world_loop_malloc.cpp b/tests/hello_world_loop_malloc.cpp index 4716f42101077..702aad8381591 100644 --- a/tests/hello_world_loop_malloc.cpp +++ b/tests/hello_world_loop_malloc.cpp @@ -19,7 +19,7 @@ int main() { for (int i = 0; i < strlen(original); i += 2) { copy[i/2] = original[i]; } - copy[strlen(copy)+1] = (int)&original; // force original to be on the stack + copy[strlen(copy)+1] = (long)&original; // force original to be on the stack dump(copy); return 0; } diff --git a/tests/idbstore.c b/tests/idbstore.c index 1f90d0fccc8bf..9a4b409d84f0a 100644 --- a/tests/idbstore.c +++ b/tests/idbstore.c @@ -15,24 +15,24 @@ #define DB "THE_DB" -int expected; +long expected; int result; void ok(void* arg) { - assert(expected == (int)arg); + assert(expected == (long)arg); REPORT_RESULT(result); } void onerror(void* arg) { - assert(expected == (int)arg); + assert(expected == (long)arg); REPORT_RESULT(999); } void onload(void* arg, void* ptr, int num) { - assert(expected == (int)arg); + assert(expected == (long)arg); printf("loaded %s\n", (char*)ptr); assert(num == strlen(SECRET)+1); assert(strcmp(ptr, SECRET) == 0); @@ -47,7 +47,7 @@ void onbadload(void* arg, void* ptr, int num) void oncheck(void* arg, int exists) { - assert(expected == (int)arg); + assert(expected == (long)arg); printf("exists? %d\n", exists); assert(exists); REPORT_RESULT(result); @@ -55,7 +55,7 @@ void oncheck(void* arg, int exists) void onchecknope(void* arg, int exists) { - assert(expected == (int)arg); + assert(expected == (long)arg); printf("exists (hopefully not)? %d\n", exists); assert(!exists); REPORT_RESULT(result); diff --git a/tests/malloc_none.c b/tests/malloc_none.c index dc06965b485a8..6dd5116f72ffe 100644 --- a/tests/malloc_none.c +++ b/tests/malloc_none.c @@ -2,5 +2,5 @@ int main() { - return (int)malloc(4); + return (int)(long)malloc(4); } diff --git a/tests/other/metadce/mem.c b/tests/other/metadce/mem.c index edfbba1038ea1..852ec62f88c06 100644 --- a/tests/other/metadce/mem.c +++ b/tests/other/metadce/mem.c @@ -1,5 +1,5 @@ #include int main(int argc, char** argv) { - return (int)malloc(argc); + return (int)(long)malloc(argc); } diff --git a/tests/other/metadce/mem_no_argv.c b/tests/other/metadce/mem_no_argv.c index 74836bba98822..3c98fdff4082d 100644 --- a/tests/other/metadce/mem_no_argv.c +++ b/tests/other/metadce/mem_no_argv.c @@ -3,5 +3,5 @@ int some_arg; int main() { - return (int)malloc(some_arg); + return (int)(long)malloc(some_arg); } diff --git a/tests/other/metadce/mem_no_main.c b/tests/other/metadce/mem_no_main.c index 9640494eacc72..05b22cb343711 100644 --- a/tests/other/metadce/mem_no_main.c +++ b/tests/other/metadce/mem_no_main.c @@ -5,5 +5,5 @@ int some_arg; EMSCRIPTEN_KEEPALIVE int foo() { - return (int)malloc(some_arg); + return (int)(long)malloc(some_arg); } diff --git a/tests/other/test_explict_gl_linking.c b/tests/other/test_explict_gl_linking.c index ebcfaae2c88b5..a446aba129cf6 100644 --- a/tests/other/test_explict_gl_linking.c +++ b/tests/other/test_explict_gl_linking.c @@ -1,5 +1,5 @@ #include int main() { - return (int)eglGetProcAddress("foo"); + return (int)(long)eglGetProcAddress("foo"); } diff --git a/tests/pthread/test_futex_wake_all.cpp b/tests/pthread/test_futex_wake_all.cpp index 2c140175f0b8c..ae758a68f5ae1 100644 --- a/tests/pthread/test_futex_wake_all.cpp +++ b/tests/pthread/test_futex_wake_all.cpp @@ -29,7 +29,7 @@ void *WakingThread(void *arg) void *WaitingThread(void *arg) { // Last waiting thread creates the waking thread - this simplifies mutual synchronization needs - if ((int)arg == NUM_THREADS-1) + if ((long)arg == NUM_THREADS-1) { pthread_t wakingThread; pthread_create(&wakingThread, 0, WakingThread, 0); diff --git a/tests/pthread/test_pthread_64bit_atomics.cpp b/tests/pthread/test_pthread_64bit_atomics.cpp index e17774ae6a879..bca978f20d544 100644 --- a/tests/pthread/test_pthread_64bit_atomics.cpp +++ b/tests/pthread/test_pthread_64bit_atomics.cpp @@ -88,12 +88,12 @@ struct Test t[NUM_THREADS] = {}; pthread_t thread[NUM_THREADS]; void RunTest(int test) -{ +{ pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 4*1024); - printf("Main thread has thread ID %d\n", (int)pthread_self()); + printf("Main thread has thread ID %ld\n", pthread_self()); assert(pthread_self() != 0); switch(test) diff --git a/tests/pthread/test_pthread_barrier.cpp b/tests/pthread/test_pthread_barrier.cpp index aedc818a6d1aa..71c14244285c3 100644 --- a/tests/pthread/test_pthread_barrier.cpp +++ b/tests/pthread/test_pthread_barrier.cpp @@ -21,7 +21,7 @@ int intermediate[N] = {}; pthread_barrier_t barr; // Sums a single row of a matrix. -int sum_row(int r) +int sum_row(long r) { int sum = 0; for(int i = 0; i < N; ++i) @@ -32,8 +32,8 @@ int sum_row(int r) void *thread_main(void *arg) { // Each thread sums individual rows. - int id = (int)arg; - for(int i = id; i < N; i += THREADS) + long id = (long)arg; + for(long i = id; i < N; i += THREADS) intermediate[i] = sum_row(i); // Synchronization point @@ -69,7 +69,7 @@ int main(int argc, char **argv) // Barrier initialization int ret = pthread_barrier_init(&barr, NULL, THREADS); - assert(ret == 0); + assert(ret == 0); for(int i = 0; i < THREADS; ++i) pthread_create(&thr[i], NULL, &thread_main, (void*)i); if (emscripten_has_threading_support()) diff --git a/tests/pthread/test_pthread_cancel.cpp b/tests/pthread/test_pthread_cancel.cpp index 69725f88b79f4..eb9128704e11c 100644 --- a/tests/pthread/test_pthread_cancel.cpp +++ b/tests/pthread/test_pthread_cancel.cpp @@ -13,11 +13,11 @@ #include #include -volatile int res = 43; +volatile long res = 43; static void cleanup_handler(void *arg) { EM_ASM(out('Called clean-up handler with arg ' + $0), arg); - int a = (int)arg; + long a = (long)arg; res -= a; } diff --git a/tests/pthread/test_pthread_cleanup.cpp b/tests/pthread/test_pthread_cleanup.cpp index 9b693f295ae45..8dc671a5ac67d 100644 --- a/tests/pthread/test_pthread_cleanup.cpp +++ b/tests/pthread/test_pthread_cleanup.cpp @@ -14,29 +14,29 @@ #include // Stores/encodes the results of calling to cleanup handlers. -int cleanupState = 1; +long cleanupState = 1; static void cleanup_handler1(void *arg) { cleanupState <<= 2; // Perform non-commutative arithmetic to a global var that encodes the cleanup stack order ops. - cleanupState *= (int)arg; + cleanupState *= (long)arg; EM_ASM(console.log('Called clean-up handler 1 with arg ' + $0), arg); - //printf("Called clean-up handler 1 with arg %d\n", (int)arg); + //printf("Called clean-up handler 1 with arg %d\n", (long)arg); } static void cleanup_handler2(void *arg) { cleanupState <<= 3; // Perform non-commutative arithmetic to a global var that encodes the cleanup stack order ops. - cleanupState *= (int)arg; + cleanupState *= (long)arg; EM_ASM(console.log('Called clean-up handler 2 with arg ' + $0), arg); - //printf("Called clean-up handler 2 with arg %d\n", (int)arg); + //printf("Called clean-up handler 2 with arg %d\n", (long)arg); } static void *thread_start1(void *arg) { - pthread_cleanup_push(cleanup_handler1, (void*)(42 + (int)arg*100)); - pthread_cleanup_push(cleanup_handler2, (void*)(69 + (int)arg*100)); - pthread_cleanup_pop((int)arg); - pthread_cleanup_pop((int)arg); + pthread_cleanup_push(cleanup_handler1, (void*)(42 + (long)arg*100)); + pthread_cleanup_push(cleanup_handler2, (void*)(69 + (long)arg*100)); + pthread_cleanup_pop((int)(intptr_t)arg); + pthread_cleanup_pop((int)(intptr_t)arg); pthread_exit(0); } @@ -89,7 +89,7 @@ int main() { // s = pthread_cancel(thr[3]); // assert(s == 0); pthread_cleanup_pop(1); - printf("Cleanup state variable: %d", cleanupState); + printf("Cleanup state variable: %ld", cleanupState); assert(cleanupState == 907640832); pthread_cleanup_pop(1); diff --git a/tests/pthread/test_pthread_create.cpp b/tests/pthread/test_pthread_create.cpp index f0953581c8c55..f71e58dffb944 100644 --- a/tests/pthread/test_pthread_create.cpp +++ b/tests/pthread/test_pthread_create.cpp @@ -23,7 +23,7 @@ unsigned int global_shared_data[NUM_THREADS]; void *ThreadMain(void *arg) { - int idx = (int)arg; + long idx = (long)arg; unsigned int param = global_shared_data[idx]; #define N 100 diff --git a/tests/pthread/test_pthread_gcc_64bit_atomic_fetch_and_op.cpp b/tests/pthread/test_pthread_gcc_64bit_atomic_fetch_and_op.cpp index e3c169676513c..40f2786148893 100644 --- a/tests/pthread/test_pthread_gcc_64bit_atomic_fetch_and_op.cpp +++ b/tests/pthread/test_pthread_gcc_64bit_atomic_fetch_and_op.cpp @@ -73,11 +73,11 @@ void *thread_fetch_and_xor(void *arg) // XXX NAND support does not exist in Atomics API. #if 0 -volatile int fetch_and_nand_data = 0; +volatile long fetch_and_nand_data = 0; void *thread_fetch_and_nand(void *arg) { for(int i = 0; i < 9999; ++i) // Odd number of times so that the operation doesn't cancel itself out. - __sync_fetch_and_nand((int*)&fetch_and_nand_data, (int)arg); + __sync_fetch_and_nand((long*)&fetch_and_nand_data, (long)arg); pthread_exit(0); } #endif diff --git a/tests/pthread/test_pthread_gcc_64bit_atomic_op_and_fetch.cpp b/tests/pthread/test_pthread_gcc_64bit_atomic_op_and_fetch.cpp index 1c60b7c65a331..e6600354a01af 100644 --- a/tests/pthread/test_pthread_gcc_64bit_atomic_op_and_fetch.cpp +++ b/tests/pthread/test_pthread_gcc_64bit_atomic_op_and_fetch.cpp @@ -73,11 +73,11 @@ void *thread_xor_and_fetch(void *arg) // XXX NAND support does not exist in Atomics API. #if 0 -volatile int nand_and_fetch_data = 0; +volatile long nand_and_fetch_data = 0; void *thread_nand_and_fetch(void *arg) { for(int i = 0; i < 9999; ++i) // Odd number of times so that the operation doesn't cancel itself out. - __sync_nand_and_fetch((int*)&nand_and_fetch_data, (int)arg); + __sync_nand_and_fetch((long*)&nand_and_fetch_data, (long)arg); pthread_exit(0); } #endif diff --git a/tests/pthread/test_pthread_gcc_atomic_fetch_and_op.cpp b/tests/pthread/test_pthread_gcc_atomic_fetch_and_op.cpp index 75da3ae58fbc1..73192a64733cb 100644 --- a/tests/pthread/test_pthread_gcc_atomic_fetch_and_op.cpp +++ b/tests/pthread/test_pthread_gcc_atomic_fetch_and_op.cpp @@ -47,37 +47,37 @@ void *thread_fetch_and_sub(void *arg) pthread_exit(0); } -volatile int fetch_and_or_data = 0; +volatile long fetch_and_or_data = 0; void *thread_fetch_and_or(void *arg) { for(int i = 0; i < 10000; ++i) - __sync_fetch_and_or((int*)&fetch_and_or_data, (int)arg); + __sync_fetch_and_or(&fetch_and_or_data, (long)arg); pthread_exit(0); } -volatile int fetch_and_and_data = 0; +volatile long fetch_and_and_data = 0; void *thread_fetch_and_and(void *arg) { for(int i = 0; i < 10000; ++i) - __sync_fetch_and_and((int*)&fetch_and_and_data, (int)arg); + __sync_fetch_and_and(&fetch_and_and_data, (long)arg); pthread_exit(0); } -volatile int fetch_and_xor_data = 0; +volatile long fetch_and_xor_data = 0; void *thread_fetch_and_xor(void *arg) { for(int i = 0; i < 9999; ++i) // Odd number of times so that the operation doesn't cancel itself out. - __sync_fetch_and_xor((int*)&fetch_and_xor_data, (int)arg); + __sync_fetch_and_xor(&fetch_and_xor_data, (long)arg); pthread_exit(0); } // XXX NAND support does not exist in Atomics API. #if 0 -volatile int fetch_and_nand_data = 0; +volatile long fetch_and_nand_data = 0; void *thread_fetch_and_nand(void *arg) { for(int i = 0; i < 9999; ++i) // Odd number of times so that the operation doesn't cancel itself out. - __sync_fetch_and_nand((int*)&fetch_and_nand_data, (int)arg); + __sync_fetch_and_nand(&fetch_and_nand_data, (long)arg); pthread_exit(0); } #endif diff --git a/tests/pthread/test_pthread_gcc_atomic_op_and_fetch.cpp b/tests/pthread/test_pthread_gcc_atomic_op_and_fetch.cpp index 6aee13babe963..05d5760c1fe4c 100644 --- a/tests/pthread/test_pthread_gcc_atomic_op_and_fetch.cpp +++ b/tests/pthread/test_pthread_gcc_atomic_op_and_fetch.cpp @@ -47,37 +47,37 @@ void *thread_sub_and_fetch(void *arg) pthread_exit(0); } -volatile int or_and_fetch_data = 0; +volatile long or_and_fetch_data = 0; void *thread_or_and_fetch(void *arg) { for(int i = 0; i < 10000; ++i) - __sync_or_and_fetch((int*)&or_and_fetch_data, (int)arg); + __sync_or_and_fetch((long*)&or_and_fetch_data, (long)arg); pthread_exit(0); } -volatile int and_and_fetch_data = 0; +volatile long and_and_fetch_data = 0; void *thread_and_and_fetch(void *arg) { for(int i = 0; i < 10000; ++i) - __sync_and_and_fetch((int*)&and_and_fetch_data, (int)arg); + __sync_and_and_fetch((long*)&and_and_fetch_data, (long)arg); pthread_exit(0); } -volatile int xor_and_fetch_data = 0; +volatile long xor_and_fetch_data = 0; void *thread_xor_and_fetch(void *arg) { for(int i = 0; i < 9999; ++i) // Odd number of times so that the operation doesn't cancel itself out. - __sync_xor_and_fetch((int*)&xor_and_fetch_data, (int)arg); + __sync_xor_and_fetch((long*)&xor_and_fetch_data, (long)arg); pthread_exit(0); } // XXX NAND support does not exist in Atomics API. #if 0 -volatile int nand_and_fetch_data = 0; +volatile long nand_and_fetch_data = 0; void *thread_nand_and_fetch(void *arg) { for(int i = 0; i < 9999; ++i) // Odd number of times so that the operation doesn't cancel itself out. - __sync_nand_and_fetch((int*)&nand_and_fetch_data, (int)arg); + __sync_nand_and_fetch((long*)&nand_and_fetch_data, (long)arg); pthread_exit(0); } #endif diff --git a/tests/pthread/test_pthread_gcc_atomics.cpp b/tests/pthread/test_pthread_gcc_atomics.cpp index bdae4e05f48f4..2e1ef061f9e3d 100644 --- a/tests/pthread/test_pthread_gcc_atomics.cpp +++ b/tests/pthread/test_pthread_gcc_atomics.cpp @@ -57,14 +57,14 @@ volatile int nand_and_fetch_data = 0; void *thread_nand_and_fetch(void *arg) { for(int i = 0; i < 999; ++i) // Odd number of times so that the operation doesn't cancel itself out. - nand_and_fetch((int*)&nand_and_fetch_data, (int)arg); + nand_and_fetch((int*)&nand_and_fetch_data, (int)(long)arg); pthread_exit(0); } void *thread_nand_and_fetch_bool(void *arg) { for(int i = 0; i < 999; ++i) // Odd number of times so that the operation doesn't cancel itself out. - nand_and_fetch_bool((int*)&nand_and_fetch_data, (int)arg); + nand_and_fetch_bool((int*)&nand_and_fetch_data, (int)(long)arg); pthread_exit(0); } diff --git a/tests/pthread/test_pthread_hardware_concurrency.cpp b/tests/pthread/test_pthread_hardware_concurrency.cpp index 29d02f255baae..34ddb81cf7bcc 100644 --- a/tests/pthread/test_pthread_hardware_concurrency.cpp +++ b/tests/pthread/test_pthread_hardware_concurrency.cpp @@ -38,7 +38,7 @@ void RunTest(int test) pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 4*1024); - printf("Main thread has thread ID %d\n", (int)pthread_self()); + printf("Main thread has thread ID %ld\n", (long)pthread_self()); assert(pthread_self() != 0); EM_ASM(out('Main: Starting test ' + $0), test); diff --git a/tests/pthread/test_pthread_join.cpp b/tests/pthread/test_pthread_join.cpp index 75f1a678e2781..33b7d3765b411 100644 --- a/tests/pthread/test_pthread_join.cpp +++ b/tests/pthread/test_pthread_join.cpp @@ -13,7 +13,7 @@ #include #include -int fib(int n) +long fib(long n) { if (n <= 0) return 0; if (n == 1) return 1; @@ -22,9 +22,9 @@ int fib(int n) static void *thread_start(void *arg) { - int n = (int)arg; + long n = (long)arg; EM_ASM(out('Thread: Computing fib('+$0+')...'), n); - int fibn = fib(n); + long fibn = fib(n); EM_ASM(out('Thread: Computation done. fib('+$0+') = '+$1+'.'), n, fibn); pthread_exit((void*)fibn); } diff --git a/tests/pthread/test_pthread_malloc.cpp b/tests/pthread/test_pthread_malloc.cpp index 7060323b4e389..0245cad88956b 100644 --- a/tests/pthread/test_pthread_malloc.cpp +++ b/tests/pthread/test_pthread_malloc.cpp @@ -15,16 +15,16 @@ static void *thread_start(void *arg) { - int n = (int)arg; - int *mem[N] = {}; - for(int i = 0; i < N; ++i) + long n = (long)arg; + long *mem[N] = {}; + for(long i = 0; i < N; ++i) { - mem[i] = (int*)malloc(4); + mem[i] = (long*)malloc(4); *mem[i] = n+i; } - for(int i = 0; i < N; ++i) + for(long i = 0; i < N; ++i) { - int k = *mem[i]; + long k = *mem[i]; if (k != n+i) { EM_ASM(console.error('Memory corrupted! mem[i]: ' + $0 + ', i: ' + $1 + ', n: ' + $2), k, i, n); diff --git a/tests/pthread/test_pthread_mandelbrot.cpp b/tests/pthread/test_pthread_mandelbrot.cpp index 8d75de2247473..2ad9168108b8a 100644 --- a/tests/pthread/test_pthread_mandelbrot.cpp +++ b/tests/pthread/test_pthread_mandelbrot.cpp @@ -226,7 +226,7 @@ unsigned long long ComputeMandelbrot_SSE(float *srcReal, float *srcImag, uint32_ __m128 diverged = _mm_cmpgt_ps(len, four); __m128 divergedNow = _mm_and_ps(diverged, oldIterating); oldIterating = _mm_andnot_ps(divergedNow, oldIterating); - //__m128 diverged = _mm_cmpge_ps(len, _mm_set1_ps(0)); + //__m128 diverged = _mm_cmpge_ps(len, _mm_set1_ps(0)); //__m128 old = _mm_loadu_ps((float*)d+X); if (any_ps(divergedNow)) @@ -298,11 +298,11 @@ _Atomic uint32_t tasksPending[MAX_NUM_THREADS] = {}; #ifndef SINGLETHREADED void *mandelbrot_thread(void *arg) { - int idx = (int)arg; + long idx = (long)arg; numThreadsRunning++; char threadName[32]; - sprintf(threadName, "Worker %d", idx); + sprintf(threadName, "Worker %ld", idx); emscripten_set_thread_name(pthread_self(), threadName); for(;;) @@ -321,10 +321,10 @@ void *mandelbrot_thread(void *arg) #endif #ifdef __SSE__ if (use_sse) - ni = ComputeMandelbrot_SSE(mandelReal, mandelImag, outputImage, sizeof(float)*W, sizeof(uint32_t)*W, 0, idx, numTasks, W, H, left, top, incrX, incrY, numItersDoneOnCanvas, numItersPerFrame); + ni = ComputeMandelbrot_SSE(mandelReal, mandelImag, outputImage, sizeof(float)*W, sizeof(uint32_t)*W, 0, (int)idx, numTasks, W, H, left, top, incrX, incrY, numItersDoneOnCanvas, numItersPerFrame); else #endif - ni = ComputeMandelbrot(mandelReal, mandelImag, outputImage, sizeof(float)*W, sizeof(uint32_t)*W, 0, idx, numTasks, W, H, left, top, incrX, incrY, numItersDoneOnCanvas, numItersPerFrame); + ni = ComputeMandelbrot(mandelReal, mandelImag, outputImage, sizeof(float)*W, sizeof(uint32_t)*W, 0, (int)idx, numTasks, W, H, left, top, incrX, incrY, numItersDoneOnCanvas, numItersPerFrame); double t1 = emscripten_get_now(); numIters[idx] += ni; timeSpentInMandelbrot[idx] += t1-t0; @@ -432,9 +432,9 @@ void main_tick() break; case SDL_KEYUP: switch (event.key.keysym.sym) { - case SDLK_RIGHT: + case SDLK_RIGHT: case SDLK_LEFT: hScroll = 0.f; break; - case SDLK_DOWN: + case SDLK_DOWN: case SDLK_UP: vScroll = 0.f; break; case SDLK_a: case SDLK_z: zoom = 0.f; break; diff --git a/tests/pthread/test_pthread_preallocates_workers.cpp b/tests/pthread/test_pthread_preallocates_workers.cpp index e284ef93c5bf6..c311d5b13a98b 100644 --- a/tests/pthread/test_pthread_preallocates_workers.cpp +++ b/tests/pthread/test_pthread_preallocates_workers.cpp @@ -19,12 +19,12 @@ pthread_t threads[5]; static void *thread_start(void *arg) { // This should be long enough for threads to pile up. - int idx = (int)arg; - printf("Starting thread %d\n", idx); + long idx = (long)arg; + printf("Starting thread %ld\n", idx); while (true) { sleep(1); } - printf("Finishing thread %d\n", idx); + printf("Finishing thread %ld\n", idx); pthread_exit((void*)0); } diff --git a/tests/pthread/test_pthread_sbrk.cpp b/tests/pthread/test_pthread_sbrk.cpp index 634dd17a025e5..0963ee18872e9 100644 --- a/tests/pthread/test_pthread_sbrk.cpp +++ b/tests/pthread/test_pthread_sbrk.cpp @@ -40,7 +40,7 @@ static void *thread_start(void *arg) pthread_mutex_unlock( &mutex ); #endif - int id = (int)(arg)+1; + int id = (int)(intptr_t)(arg)+1; int return_code = RESULT_OK; uint8_t *allocated_buffers[NUM_ALLOCATIONS] = {}; diff --git a/tests/pthread/test_pthread_setspecific_mainthread.c b/tests/pthread/test_pthread_setspecific_mainthread.c index 6cb4e78cba436..bd6bf9f813b32 100644 --- a/tests/pthread/test_pthread_setspecific_mainthread.c +++ b/tests/pthread/test_pthread_setspecific_mainthread.c @@ -8,7 +8,7 @@ #include void destructor(void* arg) { - printf("destructor: %d\n", (int)arg); + printf("destructor: %ld\n", (long)arg); assert(arg == (void*)42); } diff --git a/tests/pthread/test_pthread_thread_local_storage.cpp b/tests/pthread/test_pthread_thread_local_storage.cpp index cefd91ec04dc0..01734de7f0dff 100644 --- a/tests/pthread/test_pthread_thread_local_storage.cpp +++ b/tests/pthread/test_pthread_thread_local_storage.cpp @@ -50,9 +50,9 @@ int numThreadsToCreate = 32; int threadCounter = 0; _Atomic int destructorCounter = 0; -void CreateThread(int i) +void CreateThread(long i) { - printf("CreateThread %d\n", i); + printf("CreateThread %ld\n", i); threadCounter++; int rc = pthread_create(&thread[i], NULL, ThreadMain, (void*)i); if (emscripten_has_threading_support()) assert(rc == 0); @@ -73,20 +73,20 @@ int main() } // Create initial threads. - for(int i = 0; i < NUM_THREADS; ++i) + for(long i = 0; i < NUM_THREADS; ++i) CreateThread(i); // Join all threads and create more. if (emscripten_has_threading_support()) { - for(int i = 0; i < NUM_THREADS; ++i) + for(long i = 0; i < NUM_THREADS; ++i) { if (thread[i]) { int status; int rc = pthread_join(thread[i], (void**)&status); assert(rc == 0); - printf("Main: Joined thread idx %d with status %d\n", i, status); + printf("Main: Joined thread idx %ld with status %d\n", i, status); assert(status == 0); thread[i] = 0; if (numThreadsToCreate > 0) diff --git a/tests/runtime_misuse.cpp b/tests/runtime_misuse.cpp index fabdebb42a556..75a13eeb1f2e1 100644 --- a/tests/runtime_misuse.cpp +++ b/tests/runtime_misuse.cpp @@ -11,7 +11,7 @@ extern "C" { int noted = 0; char* EMSCRIPTEN_KEEPALIVE note(int n) { - EM_ASM({ Module.noted = $0 }, (int)¬ed); + EM_ASM({ Module.noted = $0 }, (long)¬ed); EM_ASM({ out([$0, $1]) }, n, noted); noted += n; EM_ASM({ out(['noted is now', $0]) }, noted); diff --git a/tests/runtime_misuse_2.cpp b/tests/runtime_misuse_2.cpp index a9b3af0f81bcf..7e82cde9c20cb 100644 --- a/tests/runtime_misuse_2.cpp +++ b/tests/runtime_misuse_2.cpp @@ -11,7 +11,7 @@ extern "C" { int noted = 0; char* EMSCRIPTEN_KEEPALIVE note(int n) { - EM_ASM({ Module.noted = $0 }, (int)¬ed); + EM_ASM({ Module.noted = $0 }, (long)¬ed); EM_ASM({ out([$0, $1]) }, n, noted); noted += n; EM_ASM({ out(['noted is now', $0]) }, noted); diff --git a/tests/sdl2_image_prepare_data.c b/tests/sdl2_image_prepare_data.c index 2ab38a4f100f3..f74ad3a391e32 100644 --- a/tests/sdl2_image_prepare_data.c +++ b/tests/sdl2_image_prepare_data.c @@ -36,7 +36,7 @@ int testImage(const char* fileName) { } void ready(void *arg, const char *fileName) { - printf("ready! %s (%d)\n", fileName, (int)arg); + printf("ready! %s (%ld)\n", fileName, (long)arg); static int first = 1; static const char *seenName; diff --git a/tests/sdl_image_prepare_data.c b/tests/sdl_image_prepare_data.c index e879b00b33ead..2af1b528078c3 100644 --- a/tests/sdl_image_prepare_data.c +++ b/tests/sdl_image_prepare_data.c @@ -35,7 +35,7 @@ int testImage(const char* fileName) { } void ready(void *arg, const char *fileName) { - printf("ready! %s (%d)\n", fileName, (int)arg); + printf("ready! %s (%ld)\n", fileName, (long)arg); static int first = 1; static const char *seenName; diff --git a/tests/test_core.py b/tests/test_core.py index 210c7aa73af0d..bd60536fe0ee1 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -511,7 +511,7 @@ def test_unaligned(self): p++; short *q = (short*)p; *q = 300; - printf("*%d:%d*\n", *q, ((int)q)%2); + printf("*%d:%ld*\n", *q, ((long)q)%2); int *r = (int*)p; *r = 515559; printf("*%d*\n", *r); @@ -558,8 +558,8 @@ def test_align64(self): int base = argc-1; Object *o = NULL; printf("%zu,%zu\n", sizeof(Object), sizeof(Principal)); - printf("%d,%d,%d,%d\n", (int)&o[base].type, (int)&o[base].intg, (int)&o[base].real, (int)&o[base].name); - printf("%d,%d,%d,%d\n", (int)&o[base+1].type, (int)&o[base+1].intg, (int)&o[base+1].real, (int)&o[base+1].name); + printf("%ld,%ld,%ld,%ld\n", (long)&o[base].type, (long)&o[base].intg, (long)&o[base].real, (long)&o[base].name); + printf("%ld,%ld,%ld,%ld\n", (long)&o[base+1].type, (long)&o[base+1].intg, (long)&o[base+1].real, (long)&o[base+1].name); Principal p, q; p.x = p.y = q.x = q.y = 0; p.a.type = A; @@ -2033,10 +2033,10 @@ def test_ssr(self): # struct self-ref }; int main() { - printf("*%d*\\n", (int)(mqc_states+1)-(int)mqc_states); + printf("*%ld*\\n", (long)(mqc_states+1)-(long)mqc_states); for (int i = 0; i < 2; i++) - printf("%d:%d,%d,%d,%d\\n", i, mqc_states[i].qeval, mqc_states[i].mps, - (int)mqc_states[i].nmps-(int)mqc_states, (int)mqc_states[i].nlps-(int)mqc_states); + printf("%d:%d,%d,%ld,%ld\\n", i, mqc_states[i].qeval, mqc_states[i].mps, + (long)mqc_states[i].nmps-(long)mqc_states, (long)mqc_states[i].nlps-(long)mqc_states); return 0; } ''' @@ -2108,8 +2108,8 @@ def test_pack(self): int main( int argc, const char *argv[] ) { header h, *ph = 0; fatheader fh, *pfh = 0; - printf("*%zu,%d,%d*\\n", sizeof(header), (int)((int)&h.desc - (int)&h.id), (int)(&ph[1])-(int)(&ph[0])); - printf("*%zu,%d,%d*\\n", sizeof(fatheader), (int)((int)&fh.desc - (int)&fh.id), (int)(&pfh[1])-(int)(&pfh[0])); + printf("*%zu,%ld,%ld*\\n", sizeof(header), (long)((long)&h.desc - (long)&h.id), (long)(&ph[1])-(long)(&ph[0])); + printf("*%zu,%ld,%ld*\\n", sizeof(fatheader), (long)((long)&fh.desc - (long)&fh.id), (long)(&pfh[1])-(long)(&pfh[0])); return 0; } ''' @@ -2472,13 +2472,13 @@ def test_nestedstructs(self): base *b = NULL; entry *e = NULL; chain *c = NULL; - printf("*%zu,%d,%d,%d,%d,%d|%zu,%d,%d,%d,%d,%d,%d,%d|%zu,%d,%d,%d,%d,%d,%d,%d,%d,%d*\\n", + printf("*%zu,%ld,%ld,%ld,%ld,%ld|%zu,%ld,%ld,%ld,%ld,%ld,%ld,%ld|%zu,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld*\\n", sizeof(base), - int(&(b->x)), int(&(b->y)), int(&(b->a)), int(&(b->b)), int(&(b->c)), + long(&(b->x)), long(&(b->y)), long(&(b->a)), long(&(b->b)), long(&(b->c)), sizeof(hashtableentry), - int(&(e->key)), int(&(e->data)), int(&(e->data.x)), int(&(e->data.y)), int(&(e->data.a)), int(&(e->data.b)), int(&(e->data.c)), + long(&(e->key)), long(&(e->data)), long(&(e->data.x)), long(&(e->data.y)), long(&(e->data.a)), long(&(e->data.b)), long(&(e->data.c)), sizeof(hashset::chain), - int(&(c->elem)), int(&(c->next)), int(&(c->elem.key)), int(&(c->elem.data)), int(&(c->elem.data.x)), int(&(c->elem.data.y)), int(&(c->elem.data.a)), int(&(c->elem.data.b)), int(&(c->elem.data.c)) + long(&(c->elem)), long(&(c->next)), long(&(c->elem.key)), long(&(c->elem.data)), long(&(c->elem.data.x)), long(&(c->elem.data.y)), long(&(c->elem.data.a)), long(&(c->elem.data.b)), long(&(c->elem.data.c)) ); } }; @@ -2502,8 +2502,8 @@ def test_nestedstructs(self): // Part 2 - the char[] should be compressed, BUT have a padding space at the end so the next // one is aligned properly. Also handle char; char; etc. properly. B *b = NULL; - printf("*%d,%d,%d,%d,%d,%d,%d,%d,%zu*\\n", int(b), int(&(b->buffer)), int(&(b->buffer[0])), int(&(b->buffer[1])), int(&(b->buffer[2])), - int(&(b->last)), int(&(b->laster)), int(&(b->laster2)), sizeof(B)); + printf("*%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%zu*\\n", long(b), long(&(b->buffer)), long(&(b->buffer[0])), long(&(b->buffer[1])), long(&(b->buffer[2])), + long(&(b->last)), long(&(b->laster)), long(&(b->laster2)), sizeof(B)); // Part 3 - bitfields, and small structures Bits *b2 = NULL; @@ -2916,7 +2916,7 @@ def test_dlfcn_alignment_and_zeroing(self): int num = 120 * 1024 * 1024; // total is 128; we'll use 5*5 = 25 at least, so allocate pretty much all of it void* mem = malloc(num); assert(mem); - printf("setting this range to non-zero: %d - %d\n", (int)mem, ((int)mem) + num); + printf("setting this range to non-zero: %ld - %ld\n", (long)mem, ((long)mem) + num); memset(mem, 1, num); EM_ASM({ var value = HEAP8[64*1024*1024]; @@ -2936,7 +2936,7 @@ def test_dlfcn_alignment_and_zeroing(self): printf("getting superAligned\n"); int* superAligned = (int*)dlsym(lib_handle, "superAligned"); assert(superAligned); - assert(((int)superAligned) % 1024 == 0); // alignment + assert(((long)superAligned) % 1024 == 0); // alignment printf("checking value of superAligned, at %p\n", superAligned); assert(*superAligned == 12345); // value printf("getting prezero\n"); @@ -3754,8 +3754,8 @@ def test_dylink_static_funcpointer_float(self): def test_missing_signatures(self): create_file('test_sig.c', r'''#include int main() { - return 0 == ( (int)&emscripten_run_script_string + - (int)&emscripten_run_script ); + return 0 == ( (long)&emscripten_run_script_string + + (long)&emscripten_run_script ); }''') self.set_setting('MAIN_MODULE', 1) # also test main module with 4GB of memory. we need to emit a "maximum" @@ -8204,12 +8204,12 @@ def test_safe_stack_dylink(self): ''', ''' #include - static int accumulator = 0; + static long accumulator = 0; int f(int *b) { // Infinite recursion while recording stack pointer locations // so that compiler can't eliminate the stack allocs. - accumulator += (int)b; + accumulator += (long)b; int a[1024]; return f(a); } @@ -8504,7 +8504,7 @@ def test_main_module_js_symbol(self): self.do_runf(test_file('core/test_main_module_js_symbol.c')) def test_REVERSE_DEPS(self): - create_file('connect.c', '#include \nint main() { return (int)&connect; }') + create_file('connect.c', '#include \nint main() { return (int)(long)&connect; }') self.run_process([EMCC, 'connect.c']) base_size = os.path.getsize('a.out.wasm') diff --git a/tests/test_html5_fullscreen.c b/tests/test_html5_fullscreen.c index 1f1601fdc6a64..a2a0b1086f648 100644 --- a/tests/test_html5_fullscreen.c +++ b/tests/test_html5_fullscreen.c @@ -25,9 +25,9 @@ void report_result(int result) } static inline const char *emscripten_event_type_to_string(int eventType) { - const char *events[] = { "(invalid)", "(none)", "keypress", "keydown", "keyup", "click", "mousedown", "mouseup", "dblclick", "mousemove", "wheel", "resize", - "scroll", "blur", "focus", "focusin", "focusout", "deviceorientation", "devicemotion", "orientationchange", "fullscreenchange", "pointerlockchange", - "visibilitychange", "touchstart", "touchend", "touchmove", "touchcancel", "gamepadconnected", "gamepaddisconnected", "beforeunload", + const char *events[] = { "(invalid)", "(none)", "keypress", "keydown", "keyup", "click", "mousedown", "mouseup", "dblclick", "mousemove", "wheel", "resize", + "scroll", "blur", "focus", "focusin", "focusout", "deviceorientation", "devicemotion", "orientationchange", "fullscreenchange", "pointerlockchange", + "visibilitychange", "touchstart", "touchend", "touchmove", "touchcancel", "gamepadconnected", "gamepaddisconnected", "beforeunload", "batterychargingchange", "batterylevelchange", "webglcontextlost", "webglcontextrestored", "(invalid)" }; ++eventType; if (eventType < 0) eventType = 0; @@ -158,7 +158,7 @@ void enterSoftFullscreen(int scaleMode, int canvasResolutionScaleMode, int filte int on_button_click(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) { - switch((int)userData) + switch((long)userData) { case 0: requestFullscreen(EMSCRIPTEN_FULLSCREEN_SCALE_DEFAULT, EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE, EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT); break; case 1: requestFullscreen(EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH, EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF, EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT); break; diff --git a/tests/test_other.py b/tests/test_other.py index db7a326de8e74..8ac7487405125 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -5305,7 +5305,7 @@ def test_massive_alloc(self, wasm): #include int main() { - volatile int x = (int)malloc(1024 * 1024 * 1400); + volatile long x = (long)malloc(1024 * 1024 * 1400); return x == 0; // can't alloc it, but don't fail catastrophically, expect null } ''') @@ -7511,7 +7511,7 @@ def test_clear_error_on_massive_static_data(self): f.write(''' char muchData[128 * 1024]; int main() { - return (int)&muchData; + return (int)(long)&muchData; } ''') err = self.expect_fail([EMXX, 'src.cpp', '-s', 'TOTAL_STACK=1KB', '-s', 'INITIAL_MEMORY=64KB']) @@ -10465,7 +10465,7 @@ def test_deps_info(self): create_file(function + '.c', ''' void %s(); int main() { - return (int)&%s; + return (int)(long)&%s; } ''' % (function, function)) # Compile with -O2 so we get JSDCE run to remove any false positives. This @@ -10721,7 +10721,7 @@ def test_archive_bad_extension(self): create_file('main.c', ''' #include int main() { - return (int)&accept; + return (int)(long)&accept; } ''') diff --git a/tests/websocket/tcp_in_two_threads.cpp b/tests/websocket/tcp_in_two_threads.cpp index 5ed59b2aa3b9c..a7818bd1a3630 100644 --- a/tests/websocket/tcp_in_two_threads.cpp +++ b/tests/websocket/tcp_in_two_threads.cpp @@ -12,7 +12,7 @@ #include #include #include - + EMSCRIPTEN_WEBSOCKET_T bridgeSocket = 0; extern "C" { @@ -65,7 +65,7 @@ _Atomic uint32_t pendingMessages = 0; void *send_thread(void *arg) { - int sock = (int)arg; + int sock = (int)(intptr_t)arg; for(int i = 0; i < 10; ++i) { @@ -89,7 +89,7 @@ void *send_thread(void *arg) void *recv_thread(void *arg) { - int sock = (int)arg; + int sock = (int)(intptr_t)arg; for(int i = 0; i < 10; ++i) { @@ -101,7 +101,7 @@ void *recv_thread(void *arg) pthread_exit((void*)1); } printf("Recv() done\n"); - + puts("Server reply: "); puts(server_reply); pendingMessages--; @@ -156,7 +156,7 @@ int main(int argc , char *argv[]) pthread_join(recvThread, &recvRet); printf("Send thread and recv thread finished\n"); close(sock); - if ((int)sendRet != 0) fprintf(stderr, "pthread send failed!\n"); - if ((int)recvRet != 0) fprintf(stderr, "pthread recv failed!\n"); + if ((long)sendRet != 0) fprintf(stderr, "pthread send failed!\n"); + if ((long)recvRet != 0) fprintf(stderr, "pthread recv failed!\n"); return 0; } diff --git a/tests/websocket/test_websocket_send.c b/tests/websocket/test_websocket_send.c index dd5f5228781c6..133def5557e65 100644 --- a/tests/websocket/test_websocket_send.c +++ b/tests/websocket/test_websocket_send.c @@ -5,7 +5,7 @@ EM_BOOL WebSocketOpen(int eventType, const EmscriptenWebSocketOpenEvent *e, void *userData) { - printf("open(eventType=%d, userData=%d)\n", eventType, (int)userData); + printf("open(eventType=%d, userData=%ld)\n", eventType, (long)userData); emscripten_websocket_send_utf8_text(e->socket, "hello on the other side"); @@ -17,13 +17,13 @@ EM_BOOL WebSocketOpen(int eventType, const EmscriptenWebSocketOpenEvent *e, void EM_BOOL WebSocketClose(int eventType, const EmscriptenWebSocketCloseEvent *e, void *userData) { - printf("close(eventType=%d, wasClean=%d, code=%d, reason=%s, userData=%d)\n", eventType, e->wasClean, e->code, e->reason, (int)userData); + printf("close(eventType=%d, wasClean=%d, code=%d, reason=%s, userData=%ld)\n", eventType, e->wasClean, e->code, e->reason, (long)userData); return 0; } EM_BOOL WebSocketError(int eventType, const EmscriptenWebSocketErrorEvent *e, void *userData) { - printf("error(eventType=%d, userData=%d)\n", eventType, (int)userData); + printf("error(eventType=%d, userData=%ld)\n", eventType, (long)userData); return 0; } @@ -31,7 +31,7 @@ static int passed = 0; EM_BOOL WebSocketMessage(int eventType, const EmscriptenWebSocketMessageEvent *e, void *userData) { - printf("message(eventType=%d, userData=%d, data=%p, numBytes=%d, isText=%d)\n", eventType, (int)userData, e->data, e->numBytes, e->isText); + printf("message(eventType=%d, userData=%ld, data=%p, numBytes=%d, isText=%d)\n", eventType, (long)userData, e->data, e->numBytes, e->isText); if (e->isText) { printf("text data: \"%s\"\n", e->data); diff --git a/tests/websocket/websocket.c b/tests/websocket/websocket.c index e7cebc36b3b68..96f08bc2dd6b2 100644 --- a/tests/websocket/websocket.c +++ b/tests/websocket/websocket.c @@ -4,7 +4,7 @@ EM_BOOL WebSocketOpen(int eventType, const EmscriptenWebSocketOpenEvent *e, void *userData) { - printf("open(eventType=%d, userData=%d)\n", eventType, (int)userData); + printf("open(eventType=%d, userData=%ld)\n", eventType, (long)userData); emscripten_websocket_send_utf8_text(e->socket, "hello on the other side"); @@ -17,19 +17,19 @@ EM_BOOL WebSocketOpen(int eventType, const EmscriptenWebSocketOpenEvent *e, void EM_BOOL WebSocketClose(int eventType, const EmscriptenWebSocketCloseEvent *e, void *userData) { - printf("close(eventType=%d, wasClean=%d, code=%d, reason=%s, userData=%d)\n", eventType, e->wasClean, e->code, e->reason, (int)userData); + printf("close(eventType=%d, wasClean=%d, code=%d, reason=%s, userData=%ld)\n", eventType, e->wasClean, e->code, e->reason, (long)userData); return 0; } EM_BOOL WebSocketError(int eventType, const EmscriptenWebSocketErrorEvent *e, void *userData) { - printf("error(eventType=%d, userData=%d)\n", eventType, (int)userData); + printf("error(eventType=%d, userData=%ld)\n", eventType, (long)userData); return 0; } EM_BOOL WebSocketMessage(int eventType, const EmscriptenWebSocketMessageEvent *e, void *userData) { - printf("message(eventType=%d, userData=%d, data=%p, numBytes=%d, isText=%d)\n", eventType, (int)userData, e->data, e->numBytes, e->isText); + printf("message(eventType=%d, userData=%ld, data=%p, numBytes=%d, isText=%d)\n", eventType, (long)userData, e->data, e->numBytes, e->isText); if (e->isText) printf("text data: \"%s\"\n", e->data); else diff --git a/tests/worker_api_2_main.cpp b/tests/worker_api_2_main.cpp index 7424aaffb56ec..ed1af19b3a696 100644 --- a/tests/worker_api_2_main.cpp +++ b/tests/worker_api_2_main.cpp @@ -26,13 +26,13 @@ int c3_7 = 0, c3_8 = 0; void c3(char *data, int size, void *arg) { // tests calls different in different workers. int calls = *((int*)data); - printf("%d: %d\n", (int)arg, calls); - if ((int)arg == 7) { + printf("%ld: %d\n", (long)arg, calls); + if ((long)arg == 7) { assert(c3_7 == 0); c3_7++; assert(calls == 5); } else { - assert((int)arg == 8); + assert((long)arg == 8); assert(c3_8 == 0); c3_8++; assert(calls == 1); @@ -45,7 +45,7 @@ void c3(char *data, int size, void *arg) { // tests calls different in different } void c2(char *data, int size, void *arg) { // tests queuing up several messages, each with different data - assert((int)arg == stage); + assert((long)arg == stage); Info *x2 = (Info*)data; int i = stage - 3; @@ -68,7 +68,7 @@ void c2(char *data, int size, void *arg) { // tests queuing up several messages, } void c1(char *data, int size, void *arg) { // tests copying + buffer enlargement - assert((int)arg == stage); + assert((long)arg == stage); if (stage == 1) { printf("wait 0? %d\n", emscripten_get_worker_queue_size(w1)); assert(emscripten_get_worker_queue_size(w1) == 0); diff --git a/tests/worker_api_3_main.cpp b/tests/worker_api_3_main.cpp index 064328609b36f..4006cc4167548 100644 --- a/tests/worker_api_3_main.cpp +++ b/tests/worker_api_3_main.cpp @@ -12,7 +12,7 @@ int w1; bool sawCalls[] = { false, false, false, false }; void c1(char *data, int size, void *arg) { - assert((int)arg == 97); + assert((long)arg == 97); assert(size >= sizeof(int)); int *x = (int*)data; diff --git a/tests/worker_api_main.cpp b/tests/worker_api_main.cpp index de25766475bc3..07085463ea693 100644 --- a/tests/worker_api_main.cpp +++ b/tests/worker_api_main.cpp @@ -10,7 +10,7 @@ int w1; void c1(char *data, int size, void *arg) { - assert((int)arg == 93); + assert((long)arg == 93); int *x = (int*)data; printf("c1: %d,%d\n", x[0], x[1]);