diff options
| author | Alex Burmashev <alexander.burmashev@oracle.com> | 2021-03-10 08:49:54 -0500 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2021-03-10 16:41:32 -0500 |
| commit | 4033d1fd0f25196f9a35e944679676277cd51960 (patch) | |
| tree | 082dddb5dbb4f1bbb36fd84176a3de355995d332 /include | |
| parent | 9bfdf2dea93621c9231793e2ade6b56abf7f6b8d (diff) | |
| download | efi-boot-shim-4033d1fd0f25196f9a35e944679676277cd51960.tar.gz efi-boot-shim-4033d1fd0f25196f9a35e944679676277cd51960.zip | |
Fix compilation for older gcc
Signed-off-by: Alex Burmashev <alexander.burmashev@oracle.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/compiler.h | 4 | ||||
| -rw-r--r-- | include/str.h | 2 | ||||
| -rw-r--r-- | include/system/string.h | 6 |
3 files changed, 11 insertions, 1 deletions
diff --git a/include/compiler.h b/include/compiler.h index 40358a11..18576724 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -18,7 +18,11 @@ # define RETURNS_NONNULL #else # define NONNULL(first, args...) __attribute__((__nonnull__(first, ## args))) +#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9))) # define RETURNS_NONNULL __attribute__((__returns_nonnull__)) +#else +# define RETURNS_NONNULL +#endif #endif #ifndef UNUSED diff --git a/include/str.h b/include/str.h index 189aceff..d433e6ec 100644 --- a/include/str.h +++ b/include/str.h @@ -3,11 +3,13 @@ #ifndef SHIM_STR_H #define SHIM_STR_H +#if __GNUC__ > 6 #ifdef SHIM_UNIT_TEST #pragma GCC diagnostic error "-Wnonnull-compare" #else #pragma GCC diagnostic ignored "-Wnonnull-compare" #endif +#endif static inline UNUSED RETURNS_NONNULL NONNULL(1) char * diff --git a/include/system/string.h b/include/system/string.h index 66e7d93e..2b366df7 100644 --- a/include/system/string.h +++ b/include/system/string.h @@ -64,7 +64,11 @@ mkbi3_(int, strncasecmp, const char *, s1, const char *, s2, size_t, n) mkbi3_(char *, strncat, char *, dest, const char *, src, size_t, n) mkbi3_(int, strncmp, const char *, s1, const char *, s2, size_t, n) mkbi3_(char *, strncpy, char *, dest, const char *, src, size_t, n) -mkbi2_(int, strnlen, const char *, s1, size_t, n) +#if defined(__GNUC__) && __GNUC__ >= 9 +mkbi2_(size_t, strnlen, const char *, s1, size_t, n) +#else +size_t strnlen(const char * s1, size_t n); +#endif mkdepbi2_(char *, strpbrk, const char *, s, const char *, accept) mkdepbi2_(char *, strrchr, const char *, s, int, c) mkdepbi2_(size_t, strspn, const char *, s, const char *, accept) |
