diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index 1dd51c86b8b..65cbce4e8d0 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -175,6 +175,14 @@ # define offsetof(a, b) __builtin_offsetof(a, b) # define return_address(x) __builtin_return_address(x) +# define PRAGMA(x) _Pragma(#x) + +# if defined(__clang__) +# define unroll_loop(n) PRAGMA(clang loop unroll_count(n)) +# else +# define unroll_loop(n) PRAGMA(GCC unroll n) +# endif + /* Attributes * * GCC supports weak symbols which can be used to reduce code size because @@ -814,6 +822,9 @@ # define offsetof(a, b) ((size_t)(&(((a *)(0))->b))) # define return_address(x) 0 +# define PRAGMA(x) +# define unroll_loop(n) + # define no_builtin(n) /* Warning about usage of deprecated features. */ @@ -979,6 +990,9 @@ # define offsetof(a, b) ((size_t)(&(((a *)(0))->b))) # define return_address(x) 0 +# define PRAGMA(x) +# define unroll_loop(n) + # define no_builtin(n) /* Warning about usage of deprecated features. */ @@ -1073,6 +1087,9 @@ # define offsetof(a, b) ((size_t)(&(((a *)(0))->b))) # define return_address(x) 0 +# define PRAGMA(x) +# define unroll_loop(n) + # define no_builtin(n) /* Warning about usage of deprecated features. */ @@ -1175,6 +1192,9 @@ # define offsetof(a, b) ((size_t)(&(((a *)(0))->b))) # define return_address(x) 0 +# define PRAGMA(x) +# define unroll_loop(n) + # define no_builtin(n) /* Warning about usage of deprecated features. */ @@ -1276,6 +1296,9 @@ # define offsetof(a, b) ((size_t)(&(((a *)(0))->b))) # define return_address(x) 0 +# define PRAGMA(x) +# define unroll_loop(n) + # define no_builtin(n) /* Warning about usage of deprecated features. */ @@ -1368,6 +1391,9 @@ # define offsetof(a, b) ((size_t)(&(((a *)(0))->b))) # define return_address(x) 0 +# define PRAGMA(x) +# define unroll_loop(n) + # define no_builtin(n) /* Warning about usage of deprecated features. */