microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.4k stars 1.51k forks source link

Macro incorrectly parsed #12326

Open mrx23dot opened 1 month ago

mrx23dot commented 1 month ago

Type: Bug

vscode parses this differently from GCC, both should be active image

#define XXBBX_ENABLED 1u
#define NRF_MODULE_ENABLED(module)   defined(module ## _ENABLED) 

#if XXBBX_ENABLED
active(); //ok
#endif

#if NRF_MODULE_ENABLED(XXBBX)
inactive(); //nok
#endif

Extension version: 1.17.5 VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T04:27:29.066Z) OS version: Windows_NT x64 10.0.19045 Modes: Unsupported Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz (8 x 2304)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|undefined| |Memory (System)|15.81GB (5.38GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
browntarik commented 1 month ago

Could explain what the expected behavior shood be? Are you saying that the below code should not be highlighted as inactive?

if NRF_MODULE_ENABLED(XXBBX)

inactive(); //nok

endif

mrx23dot commented 1 month ago

Could explain what the expected behavior shood be? Are you saying that the below code should not be highlighted as inactive?

if NRF_MODULE_ENABLED(XXBBX) inactive(); //nok #endif

Yes, it should be active based on gcc/clang.

browntarik commented 1 month ago

Thank you for reporting this issue, this has been reported to our internal team (VS: 2078589) and we will provide an update when it has been addressed. Please keep track of this issue to receive further updates.

mrx23dot commented 1 month ago

Please try to keep the fix compatible to 1.7x VScode if possible (it was the last version to some OSs).

sean-mcmanus commented 1 month ago

@mrx23dot Yes, the fix won't involve an increase in the VS Code min version, so Windows 7 support won't be dropped, but it's possible some other fix may eventually require us to need to drop Windows 7.