-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Describe the bug
Include #include "ArduinoJson.hpp" header in a Zephyr RTOS project and you get :
kernel_structs.h:214:18: error: expected ';' at end of member declaration
- This is a duplicate of Change variable name so doesn't cause issues on Zephyr OS #1561
- This is a Zephyrs issue that won't be fixed: #define _current in kernel_structs.h leaks into global namespace zephyrproject-rtos/zephyr#22819
- This is a thread why starting an identifier with '_' is bad practice: https://stackoverflow.com/questions/9668947/reserved-names-in-the-global-namespace
As a work-around I added #undef _current
before including arduino-json and it at least compiles.
Troubleshooter report
?
Environment
gcc (GCC) 12.2.1 20230201
cat /etc/issue Manjaro Linux \r (\n) (\l)
Reproduction
#include "ArduinoJson.hpp"
Compiler output
[build] In file included from /home/iwasz/workspace/zephyrproject3.2-official/zephyr/include/zephyr/kernel_includes.h:28,
[build] from /home/iwasz/workspace/zephyrproject3.2-official/zephyr/include/zephyr/kernel.h:17,
[build] from /home/iwasz/workspace/zephyrproject3.2-official/zephyr/include/zephyr/init.h:11,
[build] from /home/iwasz/workspace/zephyrproject3.2-official/zephyr/include/zephyr/device.h:39,
[build] from /home/iwasz/workspace/zephyrproject3.2-official/zephyr/include/zephyr/drivers/flash.h:26,
[build] from /home/iwasz/workspace/x/y/src/device/config.h:20,
[build] from /home/iwasz/workspace/x/y/src/config.h:10,
[build] from /home/iwasz/workspace/x/y/src/main.cc:11:
[build] /home/iwasz/workspace/zephyrproject3.2-official/zephyr/include/zephyr/kernel_structs.h:214:18: error: expected ';' at end of member declaration
[build] 214 | #define _current _kernel.cpus[0].current
[build] | ^~~~~~~
[build] compilation terminated due to -fmax-errors=1.
[build] ninja: build stopped: subcommand failed.
[proc] The command: /usr/bin/cmake --build /home/iwasz/workspace/x/y/build --config MinSizeRel --target all -- exited with code: 1
[build] Build finished with exit code 1