diff options
Diffstat (limited to 'meta/recipes-kernel/kmod/kmod/0001-Fix-build-with-older-gcc-4.6.patch')
-rw-r--r-- | meta/recipes-kernel/kmod/kmod/0001-Fix-build-with-older-gcc-4.6.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/recipes-kernel/kmod/kmod/0001-Fix-build-with-older-gcc-4.6.patch b/meta/recipes-kernel/kmod/kmod/0001-Fix-build-with-older-gcc-4.6.patch new file mode 100644 index 0000000000..f8ff103087 --- /dev/null +++ b/meta/recipes-kernel/kmod/kmod/0001-Fix-build-with-older-gcc-4.6.patch | |||
@@ -0,0 +1,44 @@ | |||
1 | Upstream-Status: Inappropriate [kmod is new] | ||
2 | |||
3 | From 30e1839a46b0b9449f272765193a0da61bf85997 Mon Sep 17 00:00:00 2001 | ||
4 | From: Khem Raj <raj.khem@gmail.com> | ||
5 | Date: Mon, 26 Aug 2013 15:32:36 -0700 | ||
6 | Subject: [PATCH] Fix build with older gcc < 4.6 | ||
7 | |||
8 | Static_assert is new feature in C11 standards and older than gcc 4.6 | ||
9 | does not support it. So define it to make the old gcc happy | ||
10 | |||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | libkmod/macro.h | 14 ++++++++++++-- | ||
14 | 1 file changed, 12 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/libkmod/macro.h b/libkmod/macro.h | ||
17 | index c6ba855..5032f54 100644 | ||
18 | --- a/libkmod/macro.h | ||
19 | +++ b/libkmod/macro.h | ||
20 | @@ -20,9 +20,19 @@ | ||
21 | #pragma once | ||
22 | |||
23 | #include <stddef.h> | ||
24 | - | ||
25 | -#define assert_cc(expr) \ | ||
26 | +#if defined(__GNUC__) | ||
27 | +/* Determine which version of GNU C we're using */ | ||
28 | +#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) | ||
29 | +#endif | ||
30 | +#if (GCC_VERSION >= 40600) | ||
31 | +# define assert_cc(expr) \ | ||
32 | _Static_assert((expr), #expr) | ||
33 | +#else | ||
34 | +# define STATIC_ASSERT_GLUE1(x, y) x##y | ||
35 | +# define STATIC_ASSERT_GLUE(x, y) STATIC_ASSERT_GLUE1(x, y) | ||
36 | +# define assert_cc(expr) \ | ||
37 | +extern void STATIC_ASSERT_GLUE(static_assert, __LINE__)(int arg[(expr) ? 1 : -1]) __attribute__((unused)) | ||
38 | +#endif | ||
39 | |||
40 | #if HAVE_TYPEOF | ||
41 | #define check_types_match(expr1, expr2) \ | ||
42 | -- | ||
43 | 1.8.3.4 | ||
44 | |||