From 98c6113b414782eb5bfcb67c33d09950ed203f20 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 10 Oct 2018 22:25:54 -0400 Subject: [PATCH] Define __GNUC_PREREQ if necessary The __GNUC_PREREQ convenience macro is defined by glibc's header files. If it isn't available, make it available for us to use. Signed-off-by: Theodore Ts'o --- lib/ext2fs/ext2_fs.h | 9 +++++++++ lib/ext2fs/hashmap.h | 9 +++++++++ lib/uuid/uuidP.h | 8 ++++++++ 3 files changed, 26 insertions(+) diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index 4ad09f1..13c2c20 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -18,6 +18,15 @@ #include /* Changed from linux/types.h */ +#ifndef __GNUC_PREREQ +#if defined(__GNUC__) && defined(__GNUC_MINOR__) +#define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +#define __GNUC_PREREQ(maj, min) 0 +#endif +#endif + /* * The second extended filesystem constants/structures */ diff --git a/lib/ext2fs/hashmap.h b/lib/ext2fs/hashmap.h index 228f439..656d3d9 100644 --- a/lib/ext2fs/hashmap.h +++ b/lib/ext2fs/hashmap.h @@ -4,6 +4,15 @@ # include # include +#ifndef __GNUC_PREREQ +#if defined(__GNUC__) && defined(__GNUC_MINOR__) +#define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +#define __GNUC_PREREQ(maj, min) 0 +#endif +#endif + struct ext2fs_hashmap { uint32_t size; uint32_t(*hash)(const void *key, size_t len); diff --git a/lib/uuid/uuidP.h b/lib/uuid/uuidP.h index e897bbb..6c0fd80 100644 --- a/lib/uuid/uuidP.h +++ b/lib/uuid/uuidP.h @@ -55,6 +55,14 @@ struct uuid { uint8_t node[6]; }; +#ifndef __GNUC_PREREQ +#if defined(__GNUC__) && defined(__GNUC_MINOR__) +#define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +#define __GNUC_PREREQ(maj, min) 0 +#endif +#endif /* * prototypes -- 1.8.3.1