microsoft / microsoft/vscode-cpptools
cpptools does not respect freestanding environment
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
- OS and Version: Windows 11 Build 26020
- VS Code Version: 1.86.0-insider
- C/C++ Extension Version: v1.18.5
- If using SSH remote, specify OS of remote machine: Local machine, windows
Project is being managed through CMake with a custom toolchain using clang.exe for freestanding environment.
Bug Summary and Steps to Reproduce
Bug Summary:
Using intelliSenseMode windows-clang-x64, __STDC_HOSTED__ remains 1 despite -ffreestanding
Steps to reproduce:
- Add
-ffreestandingtocompilerArgs - Set
intelliSenseModetowindows-clang-x64orclang-x64 - Include <stdint.h> and open it
- Hover on
#if __STDC_HOSTED__and notice it is set to1
Expected behavior:
__STDC_HOSTED__ is 0
Configuration and Logs
https://pastebin.com/9bhUN0jb (Too big for github)
Other Extensions
cmake tools v1.16.32
Additional context
Freestanding project.
Efi program & standalone os kernel
Using msabi-x64, clang
Projects build and run fine, but intellisense is broken.
Clangd works out of the box (compile_commands.json)
But even after setting "compileCommands": "${workspaceFolder}/.build/compile_commands.json", cpptools extensions dont work
CMakeToolchain.txt: https://pastebin.com/ngQxWhCB
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported compilerArgs and intelliSenseMode settings, then inspect the linked CMakeToolchain.txt and compile_commands.json context. Reproduce with -ffreestanding, windows-clang-x64 or clang-x64, and <stdint.h>; done means IntelliSense reports STDC_HOSTED as 0 under the freestanding configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100