Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A ArduinoJson
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Benoît Blanchon
  • ArduinoJson
  • Issues
  • #1692
Closed
Open
Issue created Dec 23, 2021 by Administrator@rootContributor

#include "Arduino.h" is leaked everywhere that includes "ArduinoJson.h", even if all Arduino features are disabled

Created by: paulocsanz

Is your feature request related to a problem? Please describe.

We have a lower level layer that implements drivers for each device we support, esp8266/Arduino is one of these backends. When using this backend ARDUINO is always defined to the used version, but we do not use any Arduino types with ArduinoJson (we only use std::string_view).

The problem is that the higher level layer uses ArduinoJson and gets a #include "Arduino.h" with it. Causing conflicts in our platform agnostic code.

We use PlatformIO so we are kinda stuck with its ways of compiling dependencies, we don't want to fork the pio library, and it seems impractical to use this git as the source of truth while compiling the lib separately, zeroing ARDUINO, to then statically link it together with our code. But we are open to ideas.

Describe the solution you'd like

We hope for a simple way to remove the #include "Arduino.h" from src/ArduinoJson/Configuration.hpp#L119 without having to disable all Arduino features from the system.

Maybe if all of the three Arduino features are disabled it could automatically avoid the include. Or we could add an extra define, like ARDUINOJSON_DISABLE_ARDUINO (not necessarily the best name). Also I had a bit of a hard time finding where the include happened and the features that could be disabled. I wasn't able to find in a public doc, is there a link I'm missing?

I am willing to provide a PR.

Just a note, to disable all #include "Arduino.h" leaked from ArduinoJson: ARDUINOJSON_ENABLE_PROGMEM also needs to be set to 0. As src/ArduinoJson/Strings/Adapters/FlashString.hpp includes Arduino.h

Assignee
Assign to
Time tracking