| 1 |
Origin: https://github.com/chunkeey/carl9170fw/pull/8 |
| 2 |
From: Bastian Germann <[email protected]> |
| 3 |
Date: Thu, 30 Jul 2026 19:51:08 +0200 |
| 4 |
Subject: [PATCH 5/7] Include GCC's stddef.h over newlib's cdefs.h |
| 5 |
|
| 6 |
Make up for some missing definitions by moving __attribute__ defines. |
| 7 |
|
| 8 |
Signed-off-by: Bastian Germann <[email protected]> |
| 9 |
--- |
| 10 |
include/linux/compiler.h | 3 +++ |
| 11 |
include/linux/types.h | 2 +- |
| 12 |
tools/lib/carlfw.h | 8 -------- |
| 13 |
3 files changed, 4 insertions(+), 9 deletions(-) |
| 14 |
|
| 15 |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h |
| 16 |
index 5d554d7..772e55e 100644 |
| 17 |
--- a/include/linux/compiler.h |
| 18 |
+++ b/include/linux/compiler.h |
| 19 |
@@ -30,6 +30,9 @@ |
| 20 |
#ifndef __attribute_const__ |
| 21 |
#define __attribute_const__ __attribute__((__const__)) |
| 22 |
#endif |
| 23 |
+#define __packed __attribute__((packed)) |
| 24 |
+#define __unused __attribute__((unused)) |
| 25 |
+#define __aligned(x) __attribute__((aligned(x))) |
| 26 |
|
| 27 |
#include "swab.h" |
| 28 |
#include "little_endian.h" |
| 29 |
diff --git a/include/linux/types.h b/include/linux/types.h |
| 30 |
index 42762c9..4cdd395 100644 |
| 31 |
--- a/include/linux/types.h |
| 32 |
+++ b/include/linux/types.h |
| 33 |
@@ -20,7 +20,7 @@ |
| 34 |
#include <stdint.h> |
| 35 |
#include <stdbool.h> |
| 36 |
#include <stdlib.h> |
| 37 |
-#include <sys/cdefs.h> |
| 38 |
+#include <stddef.h> |
| 39 |
|
| 40 |
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
| 41 |
#error "big endian is not supported by target" |
| 42 |
diff --git a/tools/lib/carlfw.h b/tools/lib/carlfw.h |
| 43 |
index 1207e70..6e722c9 100644 |
| 44 |
--- a/tools/lib/carlfw.h |
| 45 |
+++ b/tools/lib/carlfw.h |
| 46 |
@@ -18,14 +18,6 @@ |
| 47 |
#ifndef __CARLFW_H |
| 48 |
#define __CARLFW_H |
| 49 |
|
| 50 |
-/* These macros are already defined as part of newlib's sys/cdefs.h. |
| 51 |
- * However they are not part of standard libc which is used to compile |
| 52 |
- * the host tools. For now, simply add them here. |
| 53 |
- */ |
| 54 |
-#define __packed __attribute__((packed)) |
| 55 |
-#define __unused __attribute__((unused)) |
| 56 |
-#define __aligned(x) __attribute__((aligned(x))) |
| 57 |
- |
| 58 |
#include <linux/types.h> |
| 59 |
#include "compiler.h" |
| 60 |
#include "fwdesc.h" |