zed
zed copied to clipboard
C standard not recognized in CMake project, causing incorrect linting errors
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
I've encountered an issue when using the C23 standard in my CMake project. Specifically, the editor doesn't seem to recognize C23 features, which leads to incorrectly lint errors. In my case, the editor flags the use of raw string literals (i.e., R"()") as an error, even though they are valid in C23.
CMakeLists.txt contains the following lines.
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_STANDARD_REQUIRED ON)
I generate the compile_commands.json
file with cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
.
Inserting a raw string literal in the C code like R"(rawstringliteral)"
will generate an errors such as clang: Use of undeclared identifier 'R'
.
Environment
Zed: v0.149.5 (Zed) OS: Linux Wayland ubuntu 24.04 Memory: 6.7 GiB Architecture: x86_64 GPU: AMD Radeon Vega 8 Graphics (RADV RAVEN) || radv || Mesa 24.0.9-0ubuntu0.1
If applicable, add mockups / screenshots to help explain present your vision of the feature
If applicable, attach your Zed.log file to this issue.
No response