Commit fb8b926
committed
sys.h: Fix
Restructure `MLD_INLINE` and `MLD_ALWAYS_INLINE` into separate blocks,
each independently guarded:
`MLD_INLINE`:
- MSVC: `__inline`
- C99 or `inline` macro defined: `inline`
- GCC/Clang C90: `__attribute__((unused))` to silence warnings
- Other C90: empty
`MLD_ALWAYS_INLINE`:
- MSVC: `__forceinline`
- GCC/Clang C99+: `MLD_INLINE __attribute__((always_inline))`
- Other: `MLD_INLINE` (no forced inlining)
This fixes two issues:
1. If `inline` was defined as a macro before including sys.h, the MSVC
check was bypassed and `__attribute__` was used, causing MSVC failures.
2. For non-MSVC/GCC/Clang compilers like IAR, `__attribute__` was used
unconditionally, causing build failures.
Also fix typo: `defined(clang)` -> `defined(__clang__)`
Signed-off-by: Matthias J. Kannwischer <[email protected]>__attribute__ usage for non-GCC compilers1 parent 060fdbd commit fb8b926
1 file changed
+28
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
115 | 114 | | |
116 | | - | |
117 | | - | |
118 | 115 | | |
119 | | - | |
120 | 116 | | |
121 | 117 | | |
122 | | - | |
123 | | - | |
124 | | - | |
| 118 | + | |
| 119 | + | |
125 | 120 | | |
126 | | - | |
127 | | - | |
| 121 | + | |
128 | 122 | | |
129 | | - | |
| 123 | + | |
| 124 | + | |
130 | 125 | | |
| 126 | + | |
131 | 127 | | |
132 | | - | |
133 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
134 | 140 | | |
135 | | - | |
136 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
137 | 145 | | |
138 | 146 | | |
139 | 147 | | |
| |||
209 | 217 | | |
210 | 218 | | |
211 | 219 | | |
212 | | - | |
| 220 | + | |
213 | 221 | | |
214 | 222 | | |
215 | 223 | | |
| |||
0 commit comments