Don't redefine uintptr_t

Add a call to check_type_size in ConfigureChecks.cmake and use it in
include/cmocka.h to avoid the following redefinition error on riscv64:

In file included from /data/buildroot/buildroot-test/instance-0/output/build/cmocka-1.1.5/src/cmocka.c:62:
/data/buildroot/buildroot-test/instance-0/output/build/cmocka-1.1.5/include/cmocka.h:132:28: error: conflicting types for 'uintptr_t'
       typedef unsigned int uintptr_t;
                            ^~~~~~~~~
In file included from /data/buildroot/buildroot-test/instance-0/output/host/riscv64-buildroot-linux-musl/sysroot/usr/include/stdint.h:20,
                 from /data/buildroot/buildroot-test/instance-0/output/host/riscv64-buildroot-linux-musl/sysroot/usr/include/inttypes.h:9,
                 from /data/buildroot/buildroot-test/instance-0/output/build/cmocka-1.1.5/src/cmocka.c:27:
/data/buildroot/buildroot-test/instance-0/output/host/riscv64-buildroot-linux-musl/sysroot/usr/include/bits/alltypes.h:104:24: note: previous declaration of 'uintptr_t' was here
 typedef unsigned _Addr uintptr_t;
                        ^~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/30922c18150ea62aefe123d1b7cd1444efab963f

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Fabrice Fontaine 2019-11-18 18:56:46 +01:00 committed by Andreas Schneider
parent 7cc94638ef
commit 28ce16b299
3 changed files with 8 additions and 1 deletions

View File

@ -70,6 +70,9 @@ if (HAVE_TIME_H)
check_struct_has_member("struct timespec" tv_sec "time.h" HAVE_STRUCT_TIMESPEC)
endif (HAVE_TIME_H)
# TYPES
check_type_size(uintptr_t UINTPTR_T)
# FUNCTIONS
check_function_exists(calloc HAVE_CALLOC)
check_function_exists(exit HAVE_EXIT)

View File

@ -75,6 +75,10 @@
#cmakedefine HAVE_STRUCT_TIMESPEC 1
/***************************** TYPES *****************************/
#cmakedefine HAVE_UINTPTR_T 1
/*************************** FUNCTIONS ***************************/
/* Define to 1 if you have the `calloc' function. */

View File

@ -120,7 +120,7 @@ typedef uintmax_t LargestIntegralType;
((LargestIntegralType)(value))
/* Smallest integral type capable of holding a pointer. */
#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED)
#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) && !defined(HAVE_UINTPTR_T)
# if defined(_WIN32)
/* WIN32 is an ILP32 platform */
typedef unsigned int uintptr_t;