casaroli opened a new pull request, #21128:
URL: https://github.com/apache/nuttx/pull/21128

   ## Summary
   
   `<syslog.h>` defined `openlog()` as a macro that is a block of statements 
and `closelog()` as an empty macro. Programs that write `(void) openlog(...);` 
or `(void) closelog();` did not compile (tcp-wrappers' `tcpd.c`, for example), 
and a program that declares them itself, takes their address, or a configure 
link test did not find them.
   
   The first commit makes them functions of libc 
(`libs/libc/syslog/lib_openlog.c`, built in every configuration, and listed in 
`libc.csv`) with the same behavior: NuttX does not use the arguments of 
`openlog()`, and `closelog()` does nothing. The second commit marks them as 
supported in `Documentation/standards/posix.rst` and changes the note on the 
logging page, which said that they are not supported.
   
   ## Impact
   
   Two new libc functions; the two macros are gone. The same in flat, protected 
and kernel builds; nothing per architecture. A file that defines its own 
`openlog()` or `closelog()` macro before `<syslog.h>` does not compile any 
more, because the macro now expands inside the declaration. nuttx-apps' 
`interpreters/luamodules/luasyslog` did that (on the command line); 
apache/nuttx-apps#@@APPSPR@@ removes those macros and works with both the old 
and the new `<syslog.h>`, so it must merge first (sim:lua builds luasyslog).
   
   ## Testing
   
   Test program `openlog.c` (`expr`: `(void) openlog(...)` and `(void) 
closelog()` compile; `decl`: the program declares both itself and takes the 
address of `openlog()`; `log`: `syslog()` after `openlog()` and after 
`closelog()`), compiled against the export of qemu-armv8a:knsh (kernel build) 
and run under QEMU (HVF):
   
   | | master aeab6fbf989 | this PR |
   |---|---|---|
   | `openlog` | does not compile (macro "closelog" passed 1 arguments, 
expected identifier before '{') | expr PASS, decl PASS, log PASS |
   
   ostest exits with status 0 on qemu-armv8a:knsh (kernel) and qemu-armv8a:nsh 
(flat).
   
   Builds, each without new warnings: stm32f4discovery:nsh (flat, Cortex-M4), 
lm3s6965-ek:qemu-protected (protected, Cortex-M3) and sim:lua (macOS host, with 
luasyslog and the nuttx-apps change). A file with the old luasyslog macros and 
`openlog()`/`closelog()` calls, compiled against the knsh export: master 
compiles it, this PR fails ("macro \"closelog\" passed 1 arguments"); without 
the macros both compile.
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


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