diff options
| author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-23 16:24:08 +0100 | 
|---|---|---|
| committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-23 16:46:49 +0100 | 
| commit | 650b607f339cd0ffa32e205e4501ec3fcfa88fbf (patch) | |
| tree | c3ba2d5ac9709fa12e8d750a8bd82e727085c464 /include/util | |
| parent | b4226fbb569bd39fa0198c0e823400836dd6cc2d (diff) | |
Fix various data type problems
 - Make sure the mockup constant for AT_FDCWD is actualy an int
 - Don't use %lld printf format specified, mscrt doesn't have that
 - On 64 bit windows, use %I64u format specified for size_t
 - Seperate the overflow macro stuff from the form specifier stuff
 - Move the whole thing to compat.h and clean it up a little so
   it becomes readable.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/util')
| -rw-r--r-- | include/util/util.h | 28 | 
1 files changed, 0 insertions, 28 deletions
| diff --git a/include/util/util.h b/include/util/util.h index 095f02a..a133067 100644 --- a/include/util/util.h +++ b/include/util/util.h @@ -18,34 +18,6 @@  #define container_of(ptr, type, member) \  	((type *)((char *)ptr - offsetof(type, member))) -#if defined(__GNUC__) || defined(__clang__) -#define UI_ADD_OV __builtin_uadd_overflow -#define UL_ADD_OV __builtin_uaddl_overflow -#define ULL_ADD_OV __builtin_uaddll_overflow - -#define UI_MUL_OV __builtin_umul_overflow -#define UL_MUL_OV __builtin_umull_overflow -#define ULL_MUL_OV __builtin_umulll_overflow -#else -#error Sorry, I do not know how to trap integer overflows with this compiler -#endif - -#if SIZEOF_SIZE_T <= SIZEOF_INT -#define SZ_ADD_OV UI_ADD_OV -#define SZ_MUL_OV UI_MUL_OV -#define PRI_SZ "%u" -#elif SIZEOF_SIZE_T == SIZEOF_LONG -#define SZ_ADD_OV UL_ADD_OV -#define SZ_MUL_OV UL_MUL_OV -#define PRI_SZ "%lu" -#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG -#define SZ_ADD_OV ULL_ADD_OV -#define SZ_MUL_OV ULL_MUL_OV -#define PRI_SZ "%llu" -#else -#error Cannot determine maximum value of size_t -#endif -  /*    Helper for allocating data structures with flexible array members. | 
