Move _GNU_SOURCE from CCFLAGS to CPPDEFINES #8579
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For more than 2 years people were complaining that in VSCode, certain functions were not recognized as existing, but compiled just fine. For example,
tzset()
,setenv
or strlcpy.The cause of building fine but not intellisense visible in regards to these functions is because they're GNU / BSD functions whose declaration is only enabled in headers if e.g.
__BSD_VISBLE
is defined, which gets activated through one possible chain through_GNU_SOURCE
. PlatlformIO gives the-D_GNU_SOURCE
flag viaCCFLAGS
(like Arduino platform.txt does), which causes that flag to be given in compilation correctly, but not showing up in Intellisense (.vscode/c_cpp_properties
), which only showsCPPDEFINES
. The usage of-D...
in CCFLAGS or the macro itself in CPPDEFINES is equivalent.This PR fixes that
_GNU_SOURCE
is given viaCPPDEFINES
instead and is thus visible in intellisense and fixes all these "Intellisense can't find function but it still compiles" errors. Compilation is logically unaffected. Tested fine on my local machine.