Skip to content
Snippets Groups Projects
Commit 7262cb87 authored by Jasper Lowell's avatar Jasper Lowell
Browse files

Treat optimize attribute as gcc specific

Clang doesn't provide support for __attribute__((optimize ...)). There
are alternatives to provide the same functionality but due to how rarely
the kernel is compiled without optimisations, this can be added on
demand.
parent d52341df
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,11 @@
#define UNUSED __attribute__((unused))
#define USED __attribute__((used))
#define FASTCALL __attribute__((fastcall))
#ifdef __clang__
#define FORCE_O2 /* nothing */
#else
#define FORCE_O2 __attribute__((optimize("O2")))
#endif
/** MODIFIES: */
void __builtin_unreachable(void);
#define UNREACHABLE() __builtin_unreachable()
......
......@@ -19,6 +19,8 @@
* - All nested function calls are inlined
* Note that GCC does not correctly implement optimisation annotations on nested
* functions, so FORCE_INLINE is required on the wfi declaration in this case.
* Note that Clang doesn't obey FORCE_O2 and relies on the kernel being compiled
* with optimisations enabled.
*/
void FORCE_O2 idle_thread(void)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment