-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
Language Servicebuginvestigate: reproThis issue's repro steps needs to be investigated/confirmedThis issue's repro steps needs to be investigated/confirmedverifiedBug has been reproducedBug has been reproduced
Milestone
Description
Environment
- OS and Version: macOS 11.7
- VS Code Version: 1.77.3
- C/C++ Extension Version: 1.14.5
- If using SSH remote, specify OS of remote machine:
Bug Summary and Steps to Reproduce
Bug Summary:
#include <CoreFoundation/CFString.h>
works fine. Also #if __has_include(<unistd.h>)
works well.
But #if __has_include(<CoreFoundation/CFString.h>)
does not.
Steps to reproduce:
- Set "cppStandard": "c++17"
- Put the code below:
#if !__has_include(<CoreFoundation/CFString.h>) #error CFString.h not found! #endif
- See error on vscode editor pane.
Expected behavior:
No error shows.
Actual behavior:
VS Code shows the error. But it compiles with Xcode clang++ successfully.
Configuration and Logs
c_cpp_properties.json
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-x64"
}
],
"version": 4
}
Diagnostics log:
-------- Diagnostics - 4/19/2023, 5:07:01 PM
Version: 1.14.5
Current Configuration:
{
"name": "Mac",
"includePath": [
"/private/tmp/vscode-issue/**"
],
"defines": [],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-x64",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"mergeConfigurations": false,
"browse": {
"path": [
"${workspaceFolder}/**"
],
"limitSymbolsToIncludedHeaders": true
}
}
Translation Unit Mappings:
[ /private/tmp/vscode-issue/main.cc ]:
/private/tmp/vscode-issue/main.cc
Translation Unit Configurations:
[ /private/tmp/vscode-issue/main.cc ]:
Process ID: 34806
Memory Usage: 70 MB
Compiler Path: /usr/bin/clang
Includes:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
Frameworks:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
Standard Version: c++17
IntelliSense Mode: macos-clang-x64
Other Flags:
--clang
--clang_version=110000
Total Memory Usage: 70 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 26339
Other Extensions
No response
Additional context
example code:
main.cc
#if !__has_include(<iostream>)
#error <iostream> not found
#endif
#if !__has_include(<CoreFoundation/CFString.h>)
#error <CoreFoundation/CFString.h> not found
#endif
#include <iostream>
#include <CoreFoundation/CFString.h>
int main()
{
std::cout << "CFString Type ID: " << ::CFStringGetTypeID() << std::endl;
return 0;
}
command:
clang++ -framework CoreFoundation main.cc
Metadata
Metadata
Assignees
Labels
Language Servicebuginvestigate: reproThis issue's repro steps needs to be investigated/confirmedThis issue's repro steps needs to be investigated/confirmedverifiedBug has been reproducedBug has been reproduced