From: Vladimír Čunát Date: Thu, 22 Dec 2016 09:23:20 +0000 (+0100) Subject: uint: typedef globally but not more than once X-Git-Tag: v1.2.0-rc1~50^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb21450f9024bfb7b4f32e9099552fed7bcd4181;p=thirdparty%2Fknot-resolver.git uint: typedef globally but not more than once Before C11, repeating a typedef is forbidden, if taken strictly, and some compiler versions even reject it. On the other hand lru.h was missing it, which wasn't noticed due to glibc's defining it. Fixes https://gitlab.labs.nic.cz/knot/resolver/issues/114. --- diff --git a/contrib/ucw/config.h b/contrib/ucw/config.h index 11234f56f..5d3cb4fe2 100644 --- a/contrib/ucw/config.h +++ b/contrib/ucw/config.h @@ -38,7 +38,12 @@ typedef int32_t s32; /** Exactly 32 bits, signed **/ typedef uint64_t u64; /** Exactly 64 bits, unsigned **/ typedef int64_t s64; /** Exactly 64 bits, signed **/ + +#ifndef uint /* Redefining typedef is a C11 feature. */ typedef unsigned int uint; /** A better pronounceable alias for `unsigned int` **/ +#define uint uint +#endif + typedef s64 timestamp_t; /** Milliseconds since an unknown epoch **/ // FIXME: This should be removed soon diff --git a/lib/defines.h b/lib/defines.h index 0be6b2d20..40c5bcd9b 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -36,6 +36,11 @@ #define KR_COLD #endif +#ifndef uint /* Redefining typedef is a C11 feature. */ +typedef unsigned int uint; +#define uint uint +#endif + /* * Error codes. */