Fix-Point commented on code in PR #17773:
URL: https://github.com/apache/nuttx/pull/17773#discussion_r2664235934


##########
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)

Review Comment:
   We should expand macro argument `n` to the real constant value. E.g. 
`unroll_loop(CONFIG_SMP_NCPUS)` should be expanded to `_Pragma("clang loop 
unroll_count(8)")` for clang if `CONFIG_SMP_NCPUS` is `8`. 
   If we use `_Pragma` directly, then the `unroll_loop` definition will be:
   ```c
   #    define unroll_loop(n)  _Pragma("clang loop unroll_count(" #n ")")
   ```
   in which the `unroll_loop(8)` will be expanded with error.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to