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

   depends-on: apache/nuttx/pull/21778
   
   ## Summary
   
   Before C23, `<stdbool.h>` defines `bool`, `true` and `false` as macros. The 
C standard does not let the other standard headers define them, but in NuttX 
`<stdio.h>`, `<pthread.h>`, `<sched.h>`, `<sys/ioctl.h>`, `<poll.h>`, 
`<syslog.h>` and others include `<stdbool.h>`. Some apps code uses `bool`, 
`true` or `false` and gets them only through these headers. A NuttX change that 
stops the standard headers from giving the macros (a later PR) would break that 
code.
   
   **apps: Include <stdbool.h> where bool, true and false are used.** Add 
`#include <stdbool.h>` to each file that uses them:
   
   - ostest: `pthread_cleanup.c`, `pthread_rwlock.c`, `pthread_rwlock_cancel.c` 
and `sporadic2.c`;
   - the headers `dhcpd_daemon.h`, `mdnsd_daemon.h`, `nxcodec_context.h`, 
`logging/nxscope/nxscope.h`, `netutils/ptpd.h`, `nshlib/nshlib.h` and 
`system/settings.h`;
   - 28 other programs in benchmarks, examples, fsutils, interpreters, 
netutils, system and testing.
   
   **apps: Fix the nxstyle and spelling errors in files that use bool.** The 
check of a change looks at the whole of each file that it touches, and 12 of 
these files had older errors: alignment, braces and blank lines after 
declarations (nxstyle), and "writting" and "responde" in `uart_lorawan_layer.c` 
(codespell). Apart from the two words, the commit changes the layout only.
   
   ## Impact
   
   None at run time: an include line per file, and layout. The apps build with 
NuttX master as before, and also with the NuttX change.
   
   ## Testing
   
   Kernel build apps import (qemu-armv8a:knsh export, `make import` with 
`-Werror`; Linux host, NuttX CI image):
   
   | NuttX | apps | Result |
   |---|---|---|
   | master | master | OK |
   | master | this PR | OK |
   | NuttX change (header PR) | this PR | OK |
   | NuttX change (header PR) | master | FAIL: 
`testing/ostest/pthread_rwlock.c`, `pthread_rwlock_cancel.c`: `'false' 
undeclared` |
   
   qemu-armv8a:knsh with this PR and the NuttX change, QEMU with HVF: ostest 
exits with status 0.
   
   Source scan: every C file of nuttx-apps that uses `bool`, `true` or `false` 
without including `<stdbool.h>` (459 on master), preprocessed against the 
kernel build export headers of the NuttX change (`gcc -E -H`): on master 45 of 
them do not reach `<stdbool.h>` and use it in code that is compiled; with this 
PR 11, and each of these gets it from a header that the scan does not have: the 
headers of packages that are downloaded at build time (lvgl, NimBLE, WAMR, 
S2OPC), the kernel's `mm/mm_heap/mm.h` (heaptest), or `bas.c`, which includes 
`bas_statement.c` after `<stdbool.h>`.
   
   Builds with `-Werror` (Linux host, NuttX CI image), with the NuttX change, 
each OK: sim:nsh, sim:citest, sim:nettest, sim:usrsocktest, qemu-armv8a:nsh, 
qemu-armv8a:knsh, qemu-armv8a:nsh_smp, qemu-armv8a:citest, qemu-armv8a:netnsh, 
mps2-an500:nsh, mps3-an547:nsh, lm3s6965-ek:qemu-protected, rv-virt:nsh, 
rv-virt:knsh64, rv-virt:pnsh64, rv-virt:citest, rv-virt:netnsh, 
esp32s3-devkit:nsh, esp32s3-devkit:knsh, qemu-intel64:nsh, 
qemu-intel64:knsh_romfs, qemu-armv7a:nsh, qemu-armv7a:knsh, nucleo-f072rb:nsh, 
stm32f4discovery:nsh, stm32f746g-disco:nsh, nrf52840-dk:nsh, 
raspberrypi-pico:nsh, imxrt1064-evk:nsh, sabre-6quad:nsh.
   
   `tools/checkpatch.sh -c -u -m -g` (of the latest NuttX master) 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