Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System include paths should always be after recursive include paths #11485

Closed
mrx23dot opened this issue Sep 29, 2023 · 11 comments
Closed

System include paths should always be after recursive include paths #11485

mrx23dot opened this issue Sep 29, 2023 · 11 comments
Assignees
Labels
bug Feature: Configuration An issue related to configuring the extension or IntelliSense fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@mrx23dot
Copy link

Type: Bug

#include "adc.h"

includes adc.h from minGW first (at least for browsing), instead of local folder,

if I wanted that then I would use
#include <adc.h>

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:
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 (6.69GB free)
Process Argv
Screen Reader no
VM 0%
@sean-mcmanus
Copy link
Contributor

Using IntelliSense, #include "" prioritizes the local folder in regards to which adc.h file it chooses, as can be verified via using Go to Definition on the include line or running C/C++: Log Diagnostics. What do you mean by "at least for browsing"? Can you provide more repro details or the Log Diagnostics output?

@sean-mcmanus sean-mcmanus self-assigned this Sep 29, 2023
@sean-mcmanus sean-mcmanus added Language Service more info needed The issue report is not actionable in its current state not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). Feature: Configuration An issue related to configuring the extension or IntelliSense labels Sep 29, 2023
@mrx23dot
Copy link
Author

mrx23dot commented Oct 2, 2023

When I was viewing adc.c it was complaining about missing types (located in adc.h next to it),
and when I clicked in it #include "adc.h" it open adc.h from gcc include directory.

After a reboot everything worked fine, weird.
I will investigate further when/if it comes back.
Cheers

This is the debug output now that it's working:


-------- Diagnostics - 2023. 10. 02. 22:13:40
Version: 1.14.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "d:\\DRIVE\\Projects\\xxx\\src/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "cStandard": "c17",
    "cppStandard": "gnu++14",
    "intelliSenseMode": "windows-gcc-x64",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPath": "D:\\Cool\\DevEnv\\TDMGCC64\\bin\\gcc.exe",
    "compilerPathIsExplicit": false,
    "browse": {
        "limitSymbolsToIncludedHeaders": true,
        "path": [
            "${workspaceFolder}/**"
        ]
    }
}
Translation Unit Mappings:
[ D:\DRIVE\Projects\xxx\src\adc\adc.c ]:
    D:\DRIVE\Projects\xxx\src\adc\adc.c
    D:\DRIVE\Projects\xxx\src\adc\adc.h *
Translation Unit Configurations:
[ D:\DRIVE\Projects\xxx\src\adc\adc.c ]:
    Process ID: 8604
    Memory Usage: 65 MB
    Compiler Path: D:\Cool\DevEnv\TDMGCC64\bin\gcc.exe
    Includes:
        D:\Cool\DevEnv\TDMGCC64\lib\gcc\x86_64-w64-mingw32\10.3.0\include
        D:\Cool\DevEnv\TDMGCC64\include
        D:\Cool\DevEnv\TDMGCC64\lib\gcc\x86_64-w64-mingw32\10.3.0\include-fixed
        D:\Cool\DevEnv\TDMGCC64\x86_64-w64-mingw32\include
        D:\DRIVE\Projects\xxx\src\main
        D:\DRIVE\Projects\xxx\src\dio
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: c17
    IntelliSense Mode: windows-gcc-x64
    Other Flags:
        --gcc
        --gnu_version=100300
Total Memory Usage: 65 MB

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


@mrx23dot mrx23dot closed this as completed Oct 2, 2023
@mrx23dot
Copy link
Author

mrx23dot commented Oct 3, 2023

I managed to recreate on Windows 10

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:
Sandboxed: No

image
image
image
image
image

C/C++: Log Diagnostics is not offered in cmd palette.

image

@mrx23dot mrx23dot reopened this Oct 3, 2023
Copy link

Hey @sean-mcmanus, this issue might need further attention.

@mrx23dot, you can help us out by closing this issue if the problem no longer exists, or adding more information.

Copy link

This issue has been closed because it needs more information and has not had recent activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2024
@mrx23dot
Copy link
Author

Please don't close this.

I don't know what else can be more important than locating the correct include files.

@bobbrow
Copy link
Member

bobbrow commented Feb 13, 2024

I think I know what's going on here. It's because we prioritize exact paths over recursive includes. When we add the compiler include paths at the end they are being prioritized ahead of the workspace include paths, but compiler paths should always be last.

I thought this worked in the past, but it's been a while since I worked on this part of the code. We need to investigate what's going on here and make sure the compiler includes are at the end.

EDIT: for reference

    Includes:
        D:\Cool\DevEnv\TDMGCC64\lib\gcc\x86_64-w64-mingw32\10.3.0\include
        D:\Cool\DevEnv\TDMGCC64\include
        D:\Cool\DevEnv\TDMGCC64\lib\gcc\x86_64-w64-mingw32\10.3.0\include-fixed
        D:\Cool\DevEnv\TDMGCC64\x86_64-w64-mingw32\include
        D:\DRIVE\Projects\xxx\src\main
        D:\DRIVE\Projects\xxx\src\dio

@bobbrow bobbrow reopened this Feb 13, 2024
@bobbrow bobbrow removed more info needed The issue report is not actionable in its current state not reproing We're not able to reproduce the issue (it's unlikely to get fixed until we find one). labels Feb 13, 2024
@bobbrow bobbrow added this to the On Deck milestone Feb 13, 2024
@bobbrow bobbrow assigned Colengms and unassigned sean-mcmanus Feb 13, 2024
@bobbrow bobbrow changed the title Include priority ignored System include paths should always be after recursive include paths May 13, 2024
@bobbrow bobbrow added the bug label May 13, 2024
@bobbrow bobbrow added this to cpptools Jun 17, 2024
@bobbrow bobbrow moved this to Triage in cpptools Jun 17, 2024
@bobbrow bobbrow moved this from Triage to Pull Request in cpptools Aug 12, 2024
@sean-mcmanus sean-mcmanus modified the milestones: On Deck, 1.22.0 Aug 15, 2024
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Aug 15, 2024
@sean-mcmanus sean-mcmanus moved this from Pull Request to Done in cpptools Aug 15, 2024
@sean-mcmanus
Copy link
Contributor

@mrx23dot This should be fixed/changed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.22.0

@mrx23dot
Copy link
Author

Works great in 1.73, thank you!

@mrx23dot
Copy link
Author

mrx23dot commented Aug 30, 2024

Is it me or after the addon update parsing is broken?
Intellisense keeps on spinning for minutes in taskbar and nothing is colored.
Was working fine in Extension version: 1.17.5

image

Pressing rescan/rescan workspace doesn't do anything.

Never mind after restarting vscode it finishes in 7seconds.

@mrx23dot mrx23dot reopened this Aug 30, 2024
@sean-mcmanus
Copy link
Contributor

@mrx23dot -- if you were using 1.22.1, you may have hit a random deadlock that got fixed with 1.22.2.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Feature: Configuration An issue related to configuring the extension or IntelliSense fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
Status: Done
Development

No branches or pull requests

4 participants