microsoft / vscode-cpptools

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

__attribute__((packed)) breaks intellisense #12248

Closed TracerDS closed 1 day ago

TracerDS commented 2 months ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary: __attribute__((packed)) causes syntax errors, but the code compiles just fine. It also causes typedef struct to not be recognized. image image image

Steps to reproduce:

  1. Create C file
  2. Paste this:
    typedef struct {
    int abc;
    } __attribute__((packed)) MyFile;
  3. Watch the intellisense getting crazy

Expected behavior:

Configuration and Logs

`c_cpp_properties.json`:

{
    "configurations": [
        {
            "name": "CrossCompiler",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/libc/include"
            ],
            "defines": [],
            "cppStandard": "c++23",
            "cStandard": "c23",
            "intelliSenseMode": "linux-gcc-x64",
            "compilerPath": "D:\\Users\\Tracer\\Desktop\\CrossCompiler\\bin\\cross\\bin\\x86_64-elf-g++"
        }
    ],
    "version": 4
}

Log Diagnostics:

-------- Diagnostics - 4/23/2024, 10:13:17 PM
Version: 1.19.9
Current Configuration:
{
    "name": "CrossCompiler",
    "includePath": [
        "d:/Users/Tracer/Desktop/NOS/**",
        "d:/Users/Tracer/Desktop/NOS/libc/include"
    ],
    "defines": [],
    "cppStandard": "c++23",
    "cStandard": "c23",
    "intelliSenseMode": "linux-gcc-x64",
    "compilerPath": "D:\\Users\\Tracer\\Desktop\\CrossCompiler\\bin\\cross\\bin\\x86_64-elf-g++",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "D:\\Users\\Tracer\\Desktop\\CrossCompiler\\bin\\cross\\bin\\x86_64-elf-g++",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "d:/Users/Tracer/Desktop/NOS/**",
            "d:/Users/Tracer/Desktop/NOS/libc/include",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.19.9.0
Translation Unit Mappings:
[ D:\Users\Tracer\Desktop\NOS\kernel\src\main.cpp - source TU]:
    D:\Users\Tracer\Desktop\NOS\kernel\include\gdt.h
Translation Unit Configurations:
[ D:\Users\Tracer\Desktop\NOS\kernel\src\main.cpp ]:
    Process ID: 12848
    Memory Usage: 52 MB
    Compiler Path: D:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe
    Includes:
        D:\Users\Tracer\Desktop\NOS\libc\include
        D:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include
        D:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\atlmfc\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
        D:\Users\Tracer\Desktop\NOS\kernel\include
    Standard Version: ms_c++latest
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 52 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5334

LSP logs:

Unable to resolve configuration with compilerPath "D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++".  Using "cl.exe" instead.

Other Extensions

No response

Additional context

Related: #4787

I have WSL, VS2022 and MinGW installed. I also have a crosscompiler installed that Im using in this project.

sean-mcmanus commented 2 months ago

@TracerDS The problem is caused by a failure to query your compiler, the logging Unable to resolve configuration with compilerPath "D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++". Using "cl.exe" instead..

Is that file supposed to end with an .exe? If you set C_Cpp.loggingLevel to "Debug", does the C/C++ pane logging show any more info on why querying the compiler is failing?

TracerDS commented 2 months ago

@TracerDS The problem is caused by a failure to query your compiler, the logging Unable to resolve configuration with compilerPath "D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++". Using "cl.exe" instead..

Is that file supposed to end with an .exe?

Nope. The compiler doesnt have an extension (unix file type). How would that matter though? Does the extension take defs from the compiler directly and not from included headers/C versions/internal stuff?

sean-mcmanus commented 2 months ago

@TracerDS Yes, we query the compiler for system defines and includes. Is the file executable on Windows?

TracerDS commented 2 months ago

@TracerDS Yes, we query the compiler for system defines and includes. Is the file executable on Windows?

Nope. The compiler is not windows compatible. It is however fully WSL (unix) compatible (ELF executable)

If you set C_Cpp.loggingLevel to "Debug", does the C/C++ pane logging show any more info on why querying the compiler is failing?

I'll send info in a moment

TracerDS commented 2 months ago

With "C_Cpp.loggingLevel": "Debug":

[4/24/2024, 12:37:40 PM] Unable to resolve configuration with compilerPath "D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++".  Using "cl.exe" instead.
[4/24/2024, 12:37:40 PM] Unable to resolve configuration with compilerPath "D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++".  Using "cl.exe" instead.

Diagnostics:

-------- Diagnostics - 4/24/2024, 12:38:39 PM
Version: 1.19.9
Current Configuration:
{
    "name": "CrossCompiler",
    "includePath": [
        "d:/Users/Tracer/Desktop/NOS/**",
        "d:/Users/Tracer/Desktop/NOS/libc/include"
    ],
    "defines": [],
    "cppStandard": "c++23",
    "cStandard": "c23",
    "intelliSenseMode": "linux-gcc-x64",
    "compilerPath": "D:\\Users\\Tracer\\Desktop\\CrossCompiler\\bin\\cross\\bin\\x86_64-elf-g++",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "D:\\Users\\Tracer\\Desktop\\CrossCompiler\\bin\\cross\\bin\\x86_64-elf-g++",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "d:/Users/Tracer/Desktop/NOS/**",
            "d:/Users/Tracer/Desktop/NOS/libc/include",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.19.9.0
Translation Unit Mappings:
[ D:\Users\Tracer\Desktop\NOS\kernel\src\main.cpp - source TU]:
    D:\Users\Tracer\Desktop\NOS\kernel\include\gdt.h
Translation Unit Configurations:
[ D:\Users\Tracer\Desktop\NOS\kernel\src\main.cpp ]:
    Process ID: 14080
    Memory Usage: 53 MB
    Compiler Path: D:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe
    Includes:
        D:\Users\Tracer\Desktop\NOS\libc\include
        D:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include
        D:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\atlmfc\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
        D:\Users\Tracer\Desktop\NOS\kernel\include
    Standard Version: ms_c++latest
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 53 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5334
sean-mcmanus commented 2 months ago

@TracerDS We're looking for the logging from the pane with name "C/C++". In particular, the logs related to the compiler querying that is failing.

TracerDS commented 2 months ago

@TracerDS We're looking for the logging from the pane with name "C/C++". In particular, the logs related to the compiler querying that is failing.

Okay, how to get the logs from it?

sean-mcmanus commented 2 months ago

@TracerDS The same way you got the other logging:

image

TracerDS commented 2 months ago

@TracerDS The same way you got the other logging:

image

loggingLevel: Debug
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.9
cpptools version (native): 1.19.9.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: Sending response (id: 1)
LSP: (received) cpptools/queryCompilerDefaults (id: 2)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 2)
LSP: (received) cpptools/didChangeCppProperties (id: 3)
LSP: (received) cpptools/queryCompilerDefaults (id: 4)
Querying compiler for default C++ language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c -E -dM nul
Querying compiler for default C language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c -E -dM /dev/null
LSP: Sending response (id: 2)
LSP: (invoked) cpptools/didChangeCppProperties (id: 3)
enabling full-text triggers
Code browsing service initialized
Querying compiler for default C++ language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c -E -dM nul
Querying compiler for default C language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c -E -dM /dev/null
Compiler query command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -std=c++23 -m64 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -std=c++23 -m32 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -std=c++23 -Wp,-v -E -dM -x c++ nul
Attempting to get defaults from C++ compiler in "compilerPath" property: 'D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++'
Querying compiler for default C++ language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c -E -dM nul
Querying compiler for default C language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c -E -dM /dev/null
Compiler query command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -std=c23 -m64 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.
Compiler query command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -std=c23 -m32 -Wp,-v -E -dM -x c nul
Failed to query compiler. Falling back to no bitness.
Compiler query command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -std=c23 -Wp,-v -E -dM -x c nul
Attempting to get defaults from C compiler in "compilerPath" property: 'D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++'
  Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.22621.0/CPPWINRT/ will be indexed
  Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.22621.0/SHARED/ will be indexed
  Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.22621.0/UCRT/ will be indexed
  Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.22621.0/UM/ will be indexed
  Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.22621.0/WINRT/ will be indexed
  Folder: D:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2022/COMMUNITY/VC/TOOLS/MSVC/14.39.33519/ATLMFC/INCLUDE/* will be indexed
  Folder: D:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2022/COMMUNITY/VC/TOOLS/MSVC/14.39.33519/INCLUDE/* will be indexed
  Folder: D:/USERS/TRACER/DESKTOP/NOS/ will be indexed
LSP: Sending response (id: 3)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 4)
Discovering files...
Querying compiler for default C++ language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c++ -E -dM nul
Querying compiler for default C++ language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c++ -E -dM /dev/null
Querying compiler for default C language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c -E -dM nul
Querying compiler for default C language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c -E -dM /dev/null
LSP: Sending response (id: 4)
  Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.22621.0/CPPWINRT/
  Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.22621.0/SHARED/
  Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.22621.0/UCRT/
  Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.22621.0/UM/
  Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.22621.0/WINRT/
  Processing folder (non-recursive): D:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2022/COMMUNITY/VC/TOOLS/MSVC/14.39.33519/ATLMFC/INCLUDE
  Processing folder (non-recursive): D:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2022/COMMUNITY/VC/TOOLS/MSVC/14.39.33519/INCLUDE
  Processing folder (recursive): D:/USERS/TRACER/DESKTOP/NOS/
  Discovering files: 5336 file(s) processed
LSP: (received) cpptools/didChangeCppProperties (id: 5)
LSP: (invoked) cpptools/didChangeCppProperties (id: 5)
LSP: Sending response (id: 5)
  1 file(s) removed from database
Done discovering files.
Populating include completion cache.
Parsing remaining files...
  Parsing: 0 files(s) processed
Done parsing remaining files.
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/19532-17
LSP: (invoked) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/19532-17
LSP: (received) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/19532-18
LSP: (invoked) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/19532-18
LSP: (received) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/19532-19
LSP: (invoked) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/19532-19
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/didOpen: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: (invoked) textDocument/didOpen: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: (received) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 6)
LSP: (invoked) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 6)
LSP: (received) cpptools/didChangeTextEditorSelection
Intellisense update pending for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: (invoked) cpptools/didChangeActiveEditor: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: Sending response (id: 6)
IntelliSense update scheduled and TU acquisition started for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
Populating file name cache...
Done populating filename cache. Elapsed time: 5 ms
Resolving recursive includes...
  tag parsing file: D:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\CodeAnalysis\sourceannotations.h
Done resolving recursive includes.
sending compilation args for D:\Users\Tracer\Desktop\NOS\kernel\src\gdt.cpp
  include: D:\USERS\TRACER\DESKTOP\NOS\LIBC\INCLUDE
  include: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE
  include: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\ATLMFC\INCLUDE
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UM
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UCRT
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\WINRT
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\CPPWINRT
  include: D:\USERS\TRACER\DESKTOP\NOS\KERNEL\INCLUDE
  define: a__VSC_LINTER__
  stdver: ms_c++latest
  intelliSenseMode: windows-msvc-x64
LSP: (received) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 7)
LSP: (invoked) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 7)
Update IntelliSense time (sec): 0.136
LSP: Sending response (id: 7)
LSP: (received) cpptools/getFoldingRanges: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 8)
LSP: (invoked) cpptools/getFoldingRanges: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 8)
LSP: (received) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 9)
LSP: (invoked) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 9)
LSP: Sending response (id: 8)
LSP: $/cancelRequest (cpptools/getDocumentSymbols, id: 9)
  tag parsing file: D:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\CodeAnalysis\sourceannotations.h
LSP: (received) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/19532-20
LSP: (invoked) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/19532-20
LSP: (received) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/19532-21
LSP: (invoked) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/19532-21
LSP: (received) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 10)
LSP: (invoked) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 10)
LSP: Sending response (id: 10)
LSP: (received) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 11)
LSP: (invoked) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 11)
LSP: Sending response (id: 11)
Database safe to open.
sean-mcmanus commented 2 months ago

@TracerDS The logging shows

D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -std=c++23 -m64 -Wp,-v -E -dM -x c++ nul
Failed to query compiler. Falling back to 32-bit intelliSenseMode.

Does your compiler support -std=c++23 and -std=c++2x? Does it support -m64 or are you using a different target argument? Can you try with 1.20.2 -- we made various fixed that could apply and the logging might be better.

TracerDS commented 2 months ago

Does your compiler support -std=c++23 and -std=c++2x? Setting -std=c++23 in my CrossCompiler will set #define __cplusplus 202100L. Setting it to -std=c++2x will error (unrecognized command-line option). Setting it to -std=c++2b will set #define __cplusplus 202100L.

I changed it from c++23 to c++20 for my project. Hope it will make a difference

Does it support -m64

yes

or are you using a different target argument?

When I compile my C++ files, this is the command I call in the Makefile: i686-elf-g++ -ffreestanding -Wall -Wextra -fno-exceptions -fno-rtti -I./hpp -I../libc/include -g3 -std=c++20

Can you try with 1.20.2 -- we made various fixed that could apply and the logging might be better.

Will try that later.

I have changed my configuration a little bit, but it shouldnt matter much since the compiler doesnt change. Arch doesnt matter in this case; __attribute__ is supported in both versions of gcc, especially in newest versions

sean-mcmanus commented 2 months ago

@TracerDS Sorry, earlier reference to -std=c++2x was meant to be -std=c2x (in reference to the usage of c23).

Is there a reason you're using a compilerPath with x86_64-elf-g++ if you're compiling with i686-elf-g++? You might try changing that. You might also try running the logged command lines to see if you're getting errors from g++ too.

The __attribute__ is broken because it's failing to query your g++ compiler and is switching over to cl.exe.

TracerDS commented 2 months ago

You might also try running the logged command lines to see if you're getting errors from g++ too.

The files itself compile. There is no issue with the compilation process. Only intellisense is broken.

Is there a reason you're using a compilerPath with x86_64-elf-g++ if you're compiling with i686-elf-g++? You might try changing that.

Yeah I will change that to i686 and try again.

Sorry, earlier reference to -std=c++2x was meant to be -std=c2x (in reference to the usage of c23).

Yeah it is supported.

sean-mcmanus commented 2 months ago

@TracerDS Our extension adds from flags to query the compiler that aren't used during normal building. It's possible your compiler might not support those flags or may output unexpected text, i.e. the args -Wp,-v -E -dM -x c++ nul.

TracerDS commented 2 months ago

@TracerDS Our extension adds from flags to query the compiler that aren't used during normal building. It's possible your compiler might not support those flags or may output unexpected text, i.e. the args -Wp,-v -E -dM -x c++ nul.

Some cannot be supported due to the nature of bare crosscompiler. Other than that, most flags are supported image

sean-mcmanus commented 2 months ago

@TracerDS Can you try with i686-elf-gcc -Wp,-v -E -dM -x c nul (or whatever args can make it query correctly?). Your logging above shows some errors as if you don't have the C++ libraries installed? The system include paths shown doesn't appear correct and is missing the c++ includes.

sean-mcmanus commented 2 months ago

@TracerDS Your use of "-ffreestanding" to compile might also be hitting https://github.com/microsoft/vscode-cpptools/issues/11837 . Well, it might if you need that for the code to compile correctly, it wouldn't cause compiler querying to fail.

TracerDS commented 2 months ago

@TracerDS Your use of "-ffreestanding" to compile might also be hitting #11837 . Well, it might if you need that for the code to compile correctly, it wouldn't cause compiler querying to fail.

Yes, it probably qualifies for that issue. Its a ffreestanding env after all, so yeah. No standard C++ libs are installed in the compiler

TracerDS commented 2 months ago

In any case @sean-mcmanus is there a workaround for this issue yet?

sean-mcmanus commented 2 months ago

@TracerDS I'm not sure yet why the compiler query is failing. Does the compiler query not return any defines?

sean-mcmanus commented 2 months ago

@TracerDS Temporarily setting the C_Cpp.loggingLevel to the hidden value of "7" may show more compiler querying logging (ignore the warnings about it not being a valid value), i.e. the entire query output.

TracerDS commented 2 months ago

@TracerDS I'm not sure yet why the compiler query is failing. Does the compiler query not return any defines?

if you mean #define then no, the compiler returns a valid list of defines.

Temporarily setting the C_Cpp.loggingLevel to the hidden value of "7" may show more compiler querying logging (ignore the warnings about it not being a valid value), i.e. the entire query output.

Sure

TracerDS commented 2 months ago

@TracerDS Temporarily setting the C_Cpp.loggingLevel to the hidden value of "7" may show more compiler querying logging (ignore the warnings about it not being a valid value), i.e. the entire query output.

Sorry, its quite long

LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/2188-14
LSP: (invoked) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/2188-14
LSP: (received) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/2188-15
LSP: (invoked) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/2188-15
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/didOpen: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: (invoked) textDocument/didOpen: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: (invoked) cpptools/didChangeVisibleTextEditors
update_file_if_needed: D:\Users\Tracer\Desktop\NOS\kernel\include\gdt.h
  Same time stamp: 1714046279
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\STDINT.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VCRUNTIME.H
  Same time stamp: 1709152985
update_file_if_needed: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED\SAL.H
  Same time stamp: 1708535846
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\SAL.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VADEFS.H
  Same time stamp: 1709152985
update_file_if_needed: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED\CONCURRENCYSAL.H
  Same time stamp: 1708535838
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\CONCURRENCYSAL.H
  Same time stamp: 1709152984
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: Sending server -> client notification: cpptools/IntelliSenseSetup
LSP: (received) cpptools/didChangeActiveEditor: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: (received) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 7)
LSP: (received) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 8)
LSP: (invoked) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 8)
LSP: Sending server -> client notification: cpptools/reportStatus
update_file_if_needed: D:\USERS\TRACER\DESKTOP\NOS\KERNEL\INCLUDE\GDT.H
  Same time stamp: 1714046279
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: Sending server -> client notification: cpptools/logTelemetry
Intellisense update pending for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: (invoked) cpptools/didChangeActiveEditor: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: (invoked) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 7)
LSP: Sending response (id: 7)
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: Sending server -> client notification: cpptools/publishRefactorDiagnostics
LSP: Sending response (id: 8)
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\STDINT.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VCRUNTIME.H
  Same time stamp: 1709152985
update_file_if_needed: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED\SAL.H
  Same time stamp: 1708535846
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\SAL.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VADEFS.H
  Same time stamp: 1709152985
update_file_if_needed: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED\CONCURRENCYSAL.H
  Same time stamp: 1708535838
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\CONCURRENCYSAL.H
  Same time stamp: 1709152984
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: Sending server -> client notification: cpptools/publishRefactorDiagnostics
IntelliSense update scheduled and TU acquisition started for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
LSP: Sending server -> client notification: cpptools/reportStatus
Populating file name cache...
Files in filename cache: 35
Done populating filename cache. Elapsed time: 5 ms
    Memory usage delta: 1 MB
    Number of files: 35
    Number of parent/child relationships: 9
Resolving recursive includes...
LSP: Sending server -> client notification: cpptools/reportStatus
update_file_if_needed: D:\USERS\TRACER\DESKTOP\NOS\KERNEL\SRC\GDT.CPP
  Same time stamp: 1714044157
    Resolving include: gdt.h -> D:\USERS\TRACER\DESKTOP\NOS\KERNEL\INCLUDE\GDT.H
update_file_if_needed: D:\USERS\TRACER\DESKTOP\NOS\KERNEL\INCLUDE\GDT.H
  Same time stamp: 1714046279
    Resolving include: stdint.h -> D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\STDINT.H
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\STDINT.H
  Same time stamp: 1709152985
    Resolving include: vcruntime.h -> D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VCRUNTIME.H
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VCRUNTIME.H
  Same time stamp: 1709152985
    Resolving include: sal.h -> D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\SAL.H
    Resolving include: vadefs.h -> D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VADEFS.H
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\SAL.H
  Same time stamp: 1709152985
    Resolving include: CodeAnalysis/sourceannotations.h -> D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\CODEANALYSIS\SOURCEANNOTATIONS.H
    Resolving include: concurrencysal.h -> D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\CONCURRENCYSAL.H
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VADEFS.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\CODEANALYSIS\SOURCEANNOTATIONS.H
  File added. Time stamp: 1709152984
  tag parsing file: D:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\CodeAnalysis\sourceannotations.h
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\CONCURRENCYSAL.H
  Same time stamp: 1709152984
LSP: Sending server -> client notification: cpptools/logTelemetry
LSP: Sending server -> client notification: cpptools/reportStatus
Done resolving recursive includes.
LSP: Sending server -> client notification: cpptools/logTelemetry
sending compilation args for D:\Users\Tracer\Desktop\NOS\kernel\src\gdt.cpp
  include: D:\USERS\TRACER\DESKTOP\NOS\LIBC\INCLUDE
  include: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE
  include: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\ATLMFC\INCLUDE
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UM
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UCRT
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\WINRT
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\CPPWINRT
  include: D:\USERS\TRACER\DESKTOP\NOS\KERNEL\INCLUDE
  define: a__VSC_LINTER__
  stdver: ms_c++20
  intelliSenseMode: windows-msvc-x86
IntelliSense TU acquired for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h
Starting IntelliSense update for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (needs_reparse==true)
Processing partial IntelliSense update for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h [1443-1832]
LSP: Sending server -> client notification: cpptools/logTelemetry
Reporting partial IntelliSense results for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h [1438-2036]
LSP: Sending server -> client notification: cpptools/intelliSenseResult
LSP: Sending server -> client notification: cpptools/logTelemetry
Starting IntelliSense update for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (needs_reparse==false)
Processing partial IntelliSense update for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h [0-1437]
Reporting partial IntelliSense results for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h [0-1437]
LSP: Sending server -> client notification: cpptools/intelliSenseResult
Starting IntelliSense update for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (needs_reparse==false)
Processing partial IntelliSense update for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h [2037-8037]
Reporting partial IntelliSense results for: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h [2037-2000000000]
LSP: Sending server -> client notification: cpptools/intelliSenseResult
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: Sending server -> client notification: cpptools/logTelemetry
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: (received) cpptools/getFoldingRanges: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 9)
LSP: (invoked) cpptools/getFoldingRanges: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 9)
LSP: Sending response (id: 9)
LSP: (received) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 10)
LSP: (invoked) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 10)
LSP: (received) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 11)
LSP: Sending response (id: 10)
LSP: (invoked) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 11)
LSP: Sending server -> client notification: cpptools/reportStatus
update_file_if_needed: D:\USERS\TRACER\DESKTOP\NOS\KERNEL\INCLUDE\GDT.H
  Same time stamp: 1714046279
LSP: Sending server -> client notification: cpptools/logTelemetry
LSP: Sending response (id: 11)
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\STDINT.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VCRUNTIME.H
  Same time stamp: 1709152985
update_file_if_needed: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED\SAL.H
  Same time stamp: 1708535846
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\SAL.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VADEFS.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\CODEANALYSIS\SOURCEANNOTATIONS.H
  Update time stamp. Old: 0, New: 1709152984
  tag parsing file: D:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\CodeAnalysis\sourceannotations.h
update_file_if_needed: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED\CONCURRENCYSAL.H
  Same time stamp: 1708535838
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\CONCURRENCYSAL.H
  Same time stamp: 1709152984
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: Sending server -> client notification: cpptools/publishRefactorDiagnostics
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: (received) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/2188-16
LSP: (invoked) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/2188-16
LSP: (received) cpptools/getFoldingRanges: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 12)
LSP: (invoked) cpptools/getFoldingRanges: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 12)
LSP: Sending response (id: 12)
LSP: (received) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/2188-17
LSP: (invoked) cpptools/fileDeleted: file:///d%3A/Users/Tracer/Desktop/NOS/.git/fsmonitor--daemon/cookies/2188-17
LSP: (received) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 13)
LSP: (invoked) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 13)
LSP: Sending response (id: 13)
LSP: (received) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 14)
LSP: (invoked) cpptools/getDocumentSymbols: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 14)
LSP: Sending server -> client notification: cpptools/reportStatus
update_file_if_needed: D:\USERS\TRACER\DESKTOP\NOS\KERNEL\INCLUDE\GDT.H
  Same time stamp: 1714046279
LSP: Sending response (id: 14)
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\STDINT.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VCRUNTIME.H
  Same time stamp: 1709152985
update_file_if_needed: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED\SAL.H
  Same time stamp: 1708535846
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\SAL.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\VADEFS.H
  Same time stamp: 1709152985
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\CODEANALYSIS\SOURCEANNOTATIONS.H
  Same time stamp: 1709152984
update_file_if_needed: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED\CONCURRENCYSAL.H
  Same time stamp: 1708535838
update_file_if_needed: D:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\VC\TOOLS\MSVC\14.39.33519\INCLUDE\CONCURRENCYSAL.H
  Same time stamp: 1709152984
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: Sending server -> client notification: cpptools/publishRefactorDiagnostics
LSP: Sending server -> client notification: cpptools/reportStatus
LSP: (received) textDocument/hover: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 15)
LSP: (invoked) textDocument/hover: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 15)
LSP: Sending server -> client notification: cpptools/setTemporaryTextDocumentLanguage
LSP: Sending server -> client notification: cpptools/setTemporaryTextDocumentLanguage
LSP: Sending response (id: 15)
LSP: (received) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 16)
LSP: (invoked) cpptools/getCodeActions: file:///d%3A/Users/Tracer/Desktop/NOS/kernel/include/gdt.h (id: 16)
LSP: Sending response (id: 16)
sean-mcmanus commented 2 months ago

@TracerDS I'm looking for the compiler query logging. It looks like the logging you provided is after the compiler querying has already run. I'm also looking into if the lack of #defines is the cause.

The logging would include stuff like Querying compiler for default C language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c -E -dM /dev/null Compiler query command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -std=c++23 -m64 -Wp,-v -E -dM -x c++ nul Failed to query compiler. Falling back to 32-bit intelliSenseMode.

but show more info.

TracerDS commented 2 months ago

@TracerDS I'm looking for the compiler query logging. It looks like the logging you provided is after the compiler querying has already run. I'm also looking into if the lack of #defines is the cause.

The logging would include stuff like Querying compiler for default C language standard using command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -x c -E -dM /dev/null Compiler query command line: D:\Users\Tracer\Desktop\CrossCompiler\bin\cross\bin\x86_64-elf-g++ -std=c++23 -m64 -Wp,-v -E -dM -x c++ nul Failed to query compiler. Falling back to 32-bit intelliSenseMode.

but show more info.

Thats all the info I got from the C/C++ terminal. C/C++ Configuration Warnings doesn't show anything new

TracerDS commented 1 month ago

So... any solutions?

sean-mcmanus commented 1 month ago

@TracerDS Sorry, we've been pretty busy. We still need to look into what could be causing this.

sean-mcmanus commented 1 month ago

@TracerDS The lack of defines isn't causing the failure.

TracerDS commented 1 month ago

@TracerDS The lack of defines isn't causing the failure.

Hmm, so what would be the issue here then?

Colengms commented 2 days ago

The compiler is not windows compatible.

Hi @TracerDS . Do I understand correctly that you're using Windows, and not remoting into a WSL instance? If so, you're not going to be able to leverage a Linux compiler binary directly. In order to pick up various bits of information from a compiler, to fully configure IntelliSense, the C/C++ Extension needs to be able to execute the compiler. What people generally do in similar scenarioa is use the WSL remoting extension and remote into a WSL instance. In that case, the compiler can be invoked directly (even used to build).

Alternatively, you could configure IntelliSense to use one of the gcc IntelliSenseMode's. That should result in various compile-specific features getting enabled, such as gcc-specific attributes. However, without the compiler defines and system include paths from the compiler, you won't get fully functional IntelliSense, unless you manually populate your c_cpp_properties.json with any necessary compiler-predefined macros and system include paths.

Another alternative might be to use a Windows-hosted gcc compiler, such as Cygwin or MinGW. I don't know if your project would compiler on Windows with those compilers, but the C/C++ Extension should be able to 'query' one of those compilers directly, enabling IntelliSense support for various gcc-specific language features.

TracerDS commented 2 days ago

Hi @TracerDS . Do I understand correctly that you're using Windows, and not remoting into a WSL instance? If so, you're not going to be able to leverage a Linux compiler binary directly. In order to pick up various bits of information from a compiler, to fully configure IntelliSense, the C/C++ Extension needs to be able to execute the compiler. What people generally do in similar scenarioa is use the WSL remoting extension and remote into a WSL instance. In that case, the compiler can be invoked directly (even used to build).

I use wsl only to compile. VSC as a main editor on windows and simple bat script with linux commands as "the compiler".

Alternatively, you could configure IntelliSense to use one of the gcc IntelliSenseMode's. That should result in various compile-specific features getting enabled, such as gcc-specific attributes. However, without the compiler defines and system include paths from the compiler, you won't get fully functional IntelliSense, unless you manually populate your c_cpp_properties.json with any necessary compiler-predefined macros and system include paths.

Hmm, that would be the best way here. I assume VSC on linux does the same: takes definitions from a compiler. Cant it be possible to unify how it collects the data? Then, depending on the compiler, all defines would be imported no matter what env you use

Another alternative might be to use a Windows-hosted gcc compiler, such as Cygwin or MinGW. I don't know if your project would compiler on Windows with those compilers, but the C/C++ Extension should be able to 'query' one of those compilers directly, enabling IntelliSense support for various gcc-specific language features.

No, it wouldnt compile. Windows doesnt offer any crosscompiler and using one built on linux in windows wont work.

Colengms commented 1 day ago

I use wsl only to compile.

If you're compiling on WSL, why not remote into WSL to do your editing as well? The remoting feature allows you to use the VS Code editor UI on your local machine, while extensions run on the target machine (in the WSL Linux instance, where they can access Linux build tools). In the case of WSL remoting, it's the same machine, so I wouldn't expect you'd see a significant difference in the user-experience of the editor. Your use-case seems to be exactly what remoting is intended to facilitate.

Cant it be possible to unify how it collects the data? Then, depending on the compiler, all defines would be imported no matter what env you use

System defines and includes vary not only between compilers (and between different distros of gcc) but depend on the compiler arguments used. It's necessary for the C/C++ extension to invoke the compiler (with any configured compiler arguments that might influence the configuration). If unable to invoke the compiler to get this information, the Extension cannot fully configure IntelliSense, due to the missing information. Some things may work fine, but you wouldn't get IntelliSense for standard library types, for example, if IntelliSense did not know where to find the system headers containing them. In Visual Studio (which shares the same IntelliSense implementation), IntelliSense is tied directly to the build system, for these reasons. In VS Code, which does not have an integrated build system, it's possible to use certain 'custom configuration provider' extensions (such as CMake Tools or Makefile Tools), to automatically connect the configuration from those build systems (compiler and args used) to IntelliSense. Though, that approach also requires the extensions run on the same machine as the build tools.

Since what you reported appears to be by-design, I'm going to go ahead and close this issue.