Move _GNU_SOURCE from CCFLAGS to CPPDEFINES#8579
Conversation
Makes _GNU_SOURCE visible in VSCode Intellisense and other IDEs.
|
Doesn't it also mean |
|
PlatformIO generates the Indeed, the But of course PlatformIO still gives that To be clear again, the |
|
The function referenced in the STRICT ANSI comment displays nicely with my PR. What I am noticing though is that maybe a more general fix in the PlatformIO could would be better, so that if |
|
Let's wait a bit so that we might resolve this issue in the core ^. |
Makes _GNU_SOURCE visible in VSCode Intellisense and other IDEs. Co-authored-by: Ivan Kravets <[email protected]>

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(),setenvor 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_VISBLEis defined, which gets activated through one possible chain through_GNU_SOURCE. PlatlformIO gives the-D_GNU_SOURCEflag 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_SOURCEis given viaCPPDEFINESinstead 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.