aboutsummaryrefslogtreecommitdiffstats
path: root/o3000_portable.h
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2022-03-24 13:38:31 +0100
committerNao Pross <np@0hm.ch>2022-03-24 13:38:31 +0100
commita8cdee9ee6dfce6a89d03acc1fbef859f3aa846c (patch)
treece1b5e9c3993c9b70e0eb05f49713f655de14b04 /o3000_portable.h
parentMerge branch 'firmware_upgrade' into 'master' (diff)
downloado3000-driver-a8cdee9ee6dfce6a89d03acc1fbef859f3aa846c.tar.gz
o3000-driver-a8cdee9ee6dfce6a89d03acc1fbef859f3aa846c.zip
Rename custom __packed__ attribute to __o3000_packed__macOS
Note: It is generally a bad idea to create identifier that start with an underscore [1]. In macOS the identifier __packed__ is already defined, because the packed attribute is written as __attribute__ ((__packed__)), which causes the code to fail to compile. To solve the problem this commit replaces __packed__ with __o3000_packed__. [1]: https://en.cppreference.com/w/c/language/identifier#Reserved_identifiers
Diffstat (limited to 'o3000_portable.h')
-rw-r--r--o3000_portable.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/o3000_portable.h b/o3000_portable.h
index 4e7da6a..5489699 100644
--- a/o3000_portable.h
+++ b/o3000_portable.h
@@ -96,12 +96,16 @@ typedef unsigned __int64 uint64_t;
#if defined(_MSC_VER)
#define __func__ __FUNCTION__
-#define __packed__ __packed
+#define __o3000_packed__ __packed
+
+#elif defined(__APPLE__)
+
+#define __o3000_packed__ __attribute__ ((__packed__))
#else
/* define nothing for __func__ because it's used as default macro at source code */
-#define __packed__ __attribute__ ((packed))
+#define __o3000_packed__ __attribute__ ((packed))
#endif // defined(_MSC_VER)