From 7ffb59a71322feee0c29c6ba46e100cc2c90cb08 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 27 Apr 2019 16:23:15 +0200 Subject: [PATCH] Fix gcc warnings on 64-bit mode mingw. * lib/clean-temp.c: Include instead of defining uintptr_t. * lib/gl_array_list.c: Likewise. * lib/gl_array_map.c: Likewise. * lib/gl_array_set.c: Likewise. * lib/gl_carray_list.c: Likewise. * lib/gl_sublist.c: Likewise. * lib/gl_avltreehash_list.c (uintptr_t): Remove definition. * lib/gl_rbtreehash_list.c (uintptr_t): Likewise. * lib/gl_hash_map.c (uintptr_t): Likewise. * lib/gl_hash_set.c (uintptr_t): Likewise. * lib/gl_linkedhash_list.c (uintptr_t): Likewise. * lib/gl_linkedhash_map.c (uintptr_t): Likewise. * lib/gl_linkedhash_set.c (uintptr_t): Likewise. * lib/iconv.c (uintptr_t): Likewise. * lib/iconv_close.c (uintptr_t): Likewise. * tests/test-lock.c: Include . (once_contender_thread, test_once): Cast through 'intptr_t' instead of 'long'. * modules/clean-temp (Depends-on): Add stdint. * modules/array-list (Depends-on): Likewise. * modules/array-map (Depends-on): Likewise. * modules/array-set (Depends-on): Likewise. * modules/carray-list (Depends-on): Likewise. * modules/sublist (Depends-on): Likewise. * modules/lock-tests (Depends-on): Likewise. --- ChangeLog | 29 +++++++++++++++++++++++++++++ lib/clean-temp.c | 5 +---- lib/gl_array_list.c | 5 +---- lib/gl_array_map.c | 5 +---- lib/gl_array_set.c | 5 +---- lib/gl_avltreehash_list.c | 6 +----- lib/gl_carray_list.c | 5 +---- lib/gl_hash_map.c | 6 +----- lib/gl_hash_set.c | 6 +----- lib/gl_linkedhash_list.c | 6 +----- lib/gl_linkedhash_map.c | 6 +----- lib/gl_linkedhash_set.c | 6 +----- lib/gl_rbtreehash_list.c | 6 +----- lib/gl_sublist.c | 5 +---- lib/iconv.c | 3 --- lib/iconv_close.c | 3 --- modules/array-list | 1 + modules/array-map | 1 + modules/array-set | 1 + modules/carray-list | 1 + modules/clean-temp | 1 + modules/lock-tests | 1 + modules/sublist | 1 + tests/test-lock.c | 6 ++++-- 24 files changed, 53 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2af43e824d..2aeef2e7f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2019-04-27 Bruno Haible + + Fix gcc warnings on 64-bit mode mingw. + * lib/clean-temp.c: Include instead of defining uintptr_t. + * lib/gl_array_list.c: Likewise. + * lib/gl_array_map.c: Likewise. + * lib/gl_array_set.c: Likewise. + * lib/gl_carray_list.c: Likewise. + * lib/gl_sublist.c: Likewise. + * lib/gl_avltreehash_list.c (uintptr_t): Remove definition. + * lib/gl_rbtreehash_list.c (uintptr_t): Likewise. + * lib/gl_hash_map.c (uintptr_t): Likewise. + * lib/gl_hash_set.c (uintptr_t): Likewise. + * lib/gl_linkedhash_list.c (uintptr_t): Likewise. + * lib/gl_linkedhash_map.c (uintptr_t): Likewise. + * lib/gl_linkedhash_set.c (uintptr_t): Likewise. + * lib/iconv.c (uintptr_t): Likewise. + * lib/iconv_close.c (uintptr_t): Likewise. + * tests/test-lock.c: Include . + (once_contender_thread, test_once): Cast through 'intptr_t' instead of + 'long'. + * modules/clean-temp (Depends-on): Add stdint. + * modules/array-list (Depends-on): Likewise. + * modules/array-map (Depends-on): Likewise. + * modules/array-set (Depends-on): Likewise. + * modules/carray-list (Depends-on): Likewise. + * modules/sublist (Depends-on): Likewise. + * modules/lock-tests (Depends-on): Likewise. + 2019-04-27 Bruno Haible error: Tweak indentation. diff --git a/lib/clean-temp.c b/lib/clean-temp.c index d333f56c09..c3cc7da4d4 100644 --- a/lib/clean-temp.c +++ b/lib/clean-temp.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -65,10 +66,6 @@ # define PATH_MAX 1024 #endif -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - /* The use of 'volatile' in the types below (and ISO C 99 section 5.1.2.3.(5)) ensure that while constructing or modifying the data structures, the field diff --git a/lib/gl_array_list.c b/lib/gl_array_list.c index 4ac743fde4..fa8cf1eb73 100644 --- a/lib/gl_array_list.c +++ b/lib/gl_array_list.c @@ -20,6 +20,7 @@ /* Specification. */ #include "gl_array_list.h" +#include #include /* Get memcpy. */ #include @@ -27,10 +28,6 @@ /* Checked size_t computations. */ #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - /* -------------------------- gl_list_t Data Type -------------------------- */ /* Concrete gl_list_impl type, valid for this file only. */ diff --git a/lib/gl_array_map.c b/lib/gl_array_map.c index 33dc719da0..9302a00051 100644 --- a/lib/gl_array_map.c +++ b/lib/gl_array_map.c @@ -20,15 +20,12 @@ /* Specification. */ #include "gl_array_map.h" +#include #include /* Checked size_t computations. */ #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - /* --------------------------- gl_map_t Data Type --------------------------- */ struct pair diff --git a/lib/gl_array_set.c b/lib/gl_array_set.c index cb595fc221..d88f4952a8 100644 --- a/lib/gl_array_set.c +++ b/lib/gl_array_set.c @@ -20,15 +20,12 @@ /* Specification. */ #include "gl_array_set.h" +#include #include /* Checked size_t computations. */ #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - /* --------------------------- gl_set_t Data Type --------------------------- */ /* Concrete gl_set_impl type, valid for this file only. */ diff --git a/lib/gl_avltreehash_list.c b/lib/gl_avltreehash_list.c index d72f149361..21876bed9e 100644 --- a/lib/gl_avltreehash_list.c +++ b/lib/gl_avltreehash_list.c @@ -20,16 +20,12 @@ /* Specification. */ #include "gl_avltreehash_list.h" -#include /* for SIZE_MAX */ +#include /* for uintptr_t, SIZE_MAX */ #include #include "gl_avltree_oset.h" #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - #define WITH_HASHTABLE 1 /* Which kind of binary trees to use for ordered sets. Quite arbitrary. */ diff --git a/lib/gl_carray_list.c b/lib/gl_carray_list.c index 24aa466936..6a54689427 100644 --- a/lib/gl_carray_list.c +++ b/lib/gl_carray_list.c @@ -20,6 +20,7 @@ /* Specification. */ #include "gl_carray_list.h" +#include #include /* Get memcpy. */ #include @@ -27,10 +28,6 @@ /* Checked size_t computations. */ #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - /* -------------------------- gl_list_t Data Type -------------------------- */ /* Concrete gl_list_impl type, valid for this file only. */ diff --git a/lib/gl_hash_map.c b/lib/gl_hash_map.c index 534b472fa0..ef3224d67a 100644 --- a/lib/gl_hash_map.c +++ b/lib/gl_hash_map.c @@ -20,15 +20,11 @@ /* Specification. */ #include "gl_hash_map.h" -#include /* for SIZE_MAX */ +#include /* for uintptr_t, SIZE_MAX */ #include #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - /* --------------------------- gl_map_t Data Type --------------------------- */ #include "gl_anyhash1.h" diff --git a/lib/gl_hash_set.c b/lib/gl_hash_set.c index 303d137546..64356e1f86 100644 --- a/lib/gl_hash_set.c +++ b/lib/gl_hash_set.c @@ -20,15 +20,11 @@ /* Specification. */ #include "gl_hash_set.h" -#include /* for SIZE_MAX */ +#include /* for uintptr_t, SIZE_MAX */ #include #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - /* --------------------------- gl_set_t Data Type --------------------------- */ #include "gl_anyhash1.h" diff --git a/lib/gl_linkedhash_list.c b/lib/gl_linkedhash_list.c index efe4996b2b..d148d5b5a4 100644 --- a/lib/gl_linkedhash_list.c +++ b/lib/gl_linkedhash_list.c @@ -20,15 +20,11 @@ /* Specification. */ #include "gl_linkedhash_list.h" -#include /* for SIZE_MAX */ +#include /* for uintptr_t, SIZE_MAX */ #include #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - #define WITH_HASHTABLE 1 /* -------------------------- gl_list_t Data Type -------------------------- */ diff --git a/lib/gl_linkedhash_map.c b/lib/gl_linkedhash_map.c index 9e16971a00..c2697d0ba7 100644 --- a/lib/gl_linkedhash_map.c +++ b/lib/gl_linkedhash_map.c @@ -20,15 +20,11 @@ /* Specification. */ #include "gl_linkedhash_map.h" -#include /* for SIZE_MAX */ +#include /* for uintptr_t, SIZE_MAX */ #include #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - /* --------------------------- gl_map_t Data Type --------------------------- */ #include "gl_anyhash1.h" diff --git a/lib/gl_linkedhash_set.c b/lib/gl_linkedhash_set.c index fb1ca007d1..55fffc4e42 100644 --- a/lib/gl_linkedhash_set.c +++ b/lib/gl_linkedhash_set.c @@ -20,15 +20,11 @@ /* Specification. */ #include "gl_linkedhash_set.h" -#include /* for SIZE_MAX */ +#include /* for uintptr_t, SIZE_MAX */ #include #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - /* --------------------------- gl_set_t Data Type --------------------------- */ #include "gl_anyhash1.h" diff --git a/lib/gl_rbtreehash_list.c b/lib/gl_rbtreehash_list.c index dc86757a87..bc40345b01 100644 --- a/lib/gl_rbtreehash_list.c +++ b/lib/gl_rbtreehash_list.c @@ -20,16 +20,12 @@ /* Specification. */ #include "gl_rbtreehash_list.h" -#include /* for SIZE_MAX */ +#include /* for uintptr_t, SIZE_MAX */ #include #include "gl_rbtree_oset.h" #include "xsize.h" -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - #define WITH_HASHTABLE 1 /* Which kind of binary trees to use for ordered sets. Quite arbitrary. */ diff --git a/lib/gl_sublist.c b/lib/gl_sublist.c index 31ffcdc58d..9a1f2665f2 100644 --- a/lib/gl_sublist.c +++ b/lib/gl_sublist.c @@ -20,12 +20,9 @@ /* Specification. */ #include "gl_sublist.h" +#include #include -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif - /* -------------------------- gl_list_t Data Type -------------------------- */ /* Concrete gl_list_impl type, valid for this file only. */ diff --git a/lib/iconv.c b/lib/iconv.c index ebe56f61a6..9ac43bf60d 100644 --- a/lib/iconv.c +++ b/lib/iconv.c @@ -26,9 +26,6 @@ # include # include # include "unistr.h" -# ifndef uintptr_t -# define uintptr_t unsigned long -# endif #endif #if REPLACE_ICONV_UTF diff --git a/lib/iconv_close.c b/lib/iconv_close.c index 9a6da0185e..cc0e118afc 100644 --- a/lib/iconv_close.c +++ b/lib/iconv_close.c @@ -20,9 +20,6 @@ #include #include -#ifndef uintptr_t -# define uintptr_t unsigned long -#endif int rpl_iconv_close (iconv_t cd) diff --git a/modules/array-list b/modules/array-list index 340bb8f454..6064671470 100644 --- a/modules/array-list +++ b/modules/array-list @@ -7,6 +7,7 @@ lib/gl_array_list.c Depends-on: list +stdint xsize configure.ac: diff --git a/modules/array-map b/modules/array-map index abdef16869..46ae89aa44 100644 --- a/modules/array-map +++ b/modules/array-map @@ -7,6 +7,7 @@ lib/gl_array_map.c Depends-on: map +stdint xsize configure.ac: diff --git a/modules/array-set b/modules/array-set index bb03425fcd..a8eb33f671 100644 --- a/modules/array-set +++ b/modules/array-set @@ -7,6 +7,7 @@ lib/gl_array_set.c Depends-on: set +stdint xsize configure.ac: diff --git a/modules/carray-list b/modules/carray-list index 4a1f66fd21..da14c83550 100644 --- a/modules/carray-list +++ b/modules/carray-list @@ -7,6 +7,7 @@ lib/gl_carray_list.c Depends-on: list +stdint xsize configure.ac: diff --git a/modules/clean-temp b/modules/clean-temp index 951e0c5c11..d5c44ee294 100644 --- a/modules/clean-temp +++ b/modules/clean-temp @@ -7,6 +7,7 @@ lib/clean-temp.c Depends-on: stdbool +stdint unistd error fatal-signal diff --git a/modules/lock-tests b/modules/lock-tests index 52858f7b32..802471e0f1 100644 --- a/modules/lock-tests +++ b/modules/lock-tests @@ -5,6 +5,7 @@ tests/test-once.c Depends-on: thread +stdint usleep yield diff --git a/modules/sublist b/modules/sublist index 0691443041..6c856cb18a 100644 --- a/modules/sublist +++ b/modules/sublist @@ -7,6 +7,7 @@ lib/gl_sublist.c Depends-on: list +stdint configure.ac: diff --git a/tests/test-lock.c b/tests/test-lock.c index 081cbf72a4..1ad0c72dcb 100644 --- a/tests/test-lock.c +++ b/tests/test-lock.c @@ -83,6 +83,7 @@ an "OK" result even without ENABLE_LOCKING (on Linux/x86). */ #define REPEAT_COUNT 50000 +#include #include #include #include @@ -587,7 +588,7 @@ once_execute (void) static void * once_contender_thread (void *arg) { - int id = (int) (long) arg; + int id = (int) (intptr_t) arg; int repeat; for (repeat = 0; repeat <= REPEAT_COUNT; repeat++) @@ -647,7 +648,8 @@ test_once (void) /* Spawn the threads. */ for (i = 0; i < THREAD_COUNT; i++) - threads[i] = gl_thread_create (once_contender_thread, (void *) (long) i); + threads[i] = + gl_thread_create (once_contender_thread, (void *) (intptr_t) i); for (repeat = 0; repeat <= REPEAT_COUNT; repeat++) { -- 2.39.5