X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=compiler%2Fcompiler.h;h=fefadeaa89fc5e4043d3024a98488f07fe9cbdb9;hp=8a784b9269b6a66419fc7f51cb453f047309653f;hb=9dc528b1638b625b5e167983a74de4e85c5859ea;hpb=f0ed01ed095cf1ca7c1945a5a0267e8f73b7b4a9 diff --git a/compiler/compiler.h b/compiler/compiler.h index 8a784b92..fefadeaa 100644 --- a/compiler/compiler.h +++ b/compiler/compiler.h @@ -62,8 +62,19 @@ #endif #ifdef FIO_INTERNAL -#define ARRAY_SIZE(x) (sizeof((x)) / (sizeof((x)[0]))) -#define FIELD_SIZE(s, f) (sizeof(((__typeof__(s))0)->f)) +#define FIO_ARRAY_SIZE(x) (sizeof((x)) / (sizeof((x)[0]))) +#define FIO_FIELD_SIZE(s, f) (sizeof(((__typeof__(s))0)->f)) +#endif + +#ifndef __has_attribute +#define __has_attribute(x) __GCC4_has_attribute_##x +#define __GCC4_has_attribute___fallthrough__ 0 +#endif + +#if __has_attribute(__fallthrough__) +#define fio_fallthrough __attribute__((__fallthrough__)) +#else +#define fio_fallthrough do {} while (0) /* fallthrough */ #endif #endif