Skip to content

Using the library with Zephyr results in compilation error due to _current indentifier problem. #1905

@iwasz

Description

@iwasz

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions