diff options
author | Joel Stanley <joel@jms.id.au> | 2015-07-21 12:53:15 +0930 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-08-13 16:52:34 +1000 |
commit | 9090f1aa75db0dfa91c2cc0fde6aa5a8078a5b89 (patch) | |
tree | cd69d42f9ae8cd66a55daa2eff326687c7c7b1a9 /ccan | |
parent | b4769a78327e3216c741b1edd556e1e9265f1109 (diff) | |
download | skiboot-9090f1aa75db0dfa91c2cc0fde6aa5a8078a5b89.zip skiboot-9090f1aa75db0dfa91c2cc0fde6aa5a8078a5b89.tar.gz skiboot-9090f1aa75db0dfa91c2cc0fde6aa5a8078a5b89.tar.bz2 |
ccan: Update short_types module to fix warning
Back in 9f64cb2028f8612daa8556cc4831b9b7ce91b171 the ccan/endian module
was updated. Unknown at the time, there were changes made to both the
endian and short_types modules that depnded on each other, or certain
types would be redefined.
skiboot/ccan/endian/endian.h:336:19: error: redefinition of typedef 'be32' is a
C11 feature [-Werror,-Wtypedef-redefinition]
typedef beint32_t be32;
^
skiboot/ccan/short_types/short_types.h:22:18: note: previous definition is here
typedef uint32_t be32;
^
By updating the short_types to the latest, we no longer redefine these
types when a module uses both short_types and endian.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'ccan')
-rw-r--r-- | ccan/short_types/_info | 12 | ||||
-rw-r--r-- | ccan/short_types/short_types.h | 15 | ||||
-rw-r--r-- | ccan/short_types/test/run-endian.c | 20 | ||||
-rw-r--r-- | ccan/short_types/test/run.c | 15 |
4 files changed, 40 insertions, 22 deletions
diff --git a/ccan/short_types/_info b/ccan/short_types/_info index cfd439e..909e4e3 100644 --- a/ccan/short_types/_info +++ b/ccan/short_types/_info @@ -1,6 +1,6 @@ +#include "config.h" #include <stdio.h> #include <string.h> -#include "config.h" /** * short_types - shorter names for standard integer types @@ -9,8 +9,9 @@ * -- Linus Torvalds * * The short_types header provides for convenient abbreviations for the - * posixly-damned uint32_t types. It also provides be32/le32 for explicitly - * annotating types of specific endian. + * posixly-damned uint32_t types. If ccan/endian/endian.h is included, + * it also provides be32/le32 for explicitly annotating types of specific + * endian. * * Include this header, if only to stop people using these identifiers * for other things! @@ -77,5 +78,10 @@ int main(int argc, char *argv[]) return 0; } + if (strcmp(argv[1], "testdepends") == 0) { + printf("ccan/endian\n"); + return 0; + } + return 1; } diff --git a/ccan/short_types/short_types.h b/ccan/short_types/short_types.h index f94ec09..175377e 100644 --- a/ccan/short_types/short_types.h +++ b/ccan/short_types/short_types.h @@ -15,18 +15,21 @@ typedef int16_t s16; typedef uint8_t u8; typedef int8_t s8; +/* Whichever they include first, they get these definitions. */ +#ifdef CCAN_ENDIAN_H /** * be64/be32/be16 - 64/32/16 bit big-endian representation. */ -typedef uint64_t be64; -typedef uint32_t be32; -typedef uint16_t be16; +typedef beint64_t be64; +typedef beint32_t be32; +typedef beint16_t be16; /** * le64/le32/le16 - 64/32/16 bit little-endian representation. */ -typedef uint64_t le64; -typedef uint32_t le32; -typedef uint16_t le16; +typedef leint64_t le64; +typedef leint32_t le32; +typedef leint16_t le16; +#endif #endif /* CCAN_SHORT_TYPES_H */ diff --git a/ccan/short_types/test/run-endian.c b/ccan/short_types/test/run-endian.c new file mode 100644 index 0000000..108e3ab --- /dev/null +++ b/ccan/short_types/test/run-endian.c @@ -0,0 +1,20 @@ +#include <ccan/endian/endian.h> +#include <ccan/short_types/short_types.h> +#include <ccan/tap/tap.h> +#include <stdlib.h> +#include <err.h> + +int main(void) +{ + plan_tests(6); + + ok1(sizeof(be64) == 8); + ok1(sizeof(be32) == 4); + ok1(sizeof(be16) == 2); + + ok1(sizeof(le64) == 8); + ok1(sizeof(le32) == 4); + ok1(sizeof(le16) == 2); + + return exit_status(); +} diff --git a/ccan/short_types/test/run.c b/ccan/short_types/test/run.c index 99f2138..2bff4b7 100644 --- a/ccan/short_types/test/run.c +++ b/ccan/short_types/test/run.c @@ -3,12 +3,9 @@ #include <stdlib.h> #include <err.h> -int main(int argc, char *argv[]) +int main(void) { - (void)argc; - (void)argv; - - plan_tests(22); + plan_tests(16); ok1(sizeof(u64) == 8); ok1(sizeof(s64) == 8); @@ -19,14 +16,6 @@ int main(int argc, char *argv[]) ok1(sizeof(u8) == 1); ok1(sizeof(s8) == 1); - ok1(sizeof(be64) == 8); - ok1(sizeof(be32) == 4); - ok1(sizeof(be16) == 2); - - ok1(sizeof(le64) == 8); - ok1(sizeof(le32) == 4); - ok1(sizeof(le16) == 2); - /* Signedness tests. */ ok1((u64)-1 > 0); ok1((u32)-1 > 0); |