jingfei195887 commented on code in PR #20668:
URL: https://github.com/apache/nuttx/pull/20668#discussion_r4630298125


##########
include/spawn.h:
##########
@@ -176,41 +176,95 @@ int posix_spawn_file_actions_addopen(
 
 int posix_spawnattr_init(FAR posix_spawnattr_t *attr);
 
-int posix_spawnattr_destroy(FAR posix_spawnattr_t *attr);
+static inline

Review Comment:
   Thanks, fixed in 75becff4823: the eleven functions are back in libc (`nm 
libc.a` lists all of them as `T`), and `spawn.h` maps the public names to the 
fast path with function-like macros.
   
   The macros forward to `static inline` helpers instead of using a comma 
expression such as `(*(flags) = (attr)->flags, 0)`. The comma form fails as 
soon as a caller ignores the return value, which is the usual way these are 
called (`posix_spawnattr_destroy(&attr);` in `sched/init/nx_bringup.c`, 
`posix_spawnattr_setflags()` in several apps):
   
   ```
   error: right-hand operand of comma expression has no effect 
[-Werror=unused-value]
   ```
   
   I checked this with gcc 13.1 and arm-none-eabi-gcc 10.3.1 at `-Wall 
-Werror`. An inline function returning 0 has no such warning, and the generated 
code is the same single load or store.
   
   Each libc source `#undef`s its macro before the definition, so the 
out-of-line versions and their `DEBUGASSERT()` checks are unchanged. 
`stm32f103-minimum:nsh` is still 56 bytes smaller than master.
   



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