Skip to content

feature / #77 show warnings for included header files along with source files#84

Merged
davidramnero merged 3 commits into
mainfrom
feature/-#77-show-errors-for-other-files
Jun 24, 2026
Merged

feature / #77 show warnings for included header files along with source files#84
davidramnero merged 3 commits into
mainfrom
feature/-#77-show-errors-for-other-files

Conversation

@davidramnero

@davidramnero davidramnero commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator
  • To not clutter the problems tab with header file errors we need a fairly intricate solution to keep track of where header file errors are coming from (so we can clear diagnostics for a header file when the source file whose analysis generated them are closed).

  • This solution supports stack traces with locations in multiple different files

  • Previous bug where problems for a given file would not get cleared when it's tab is closed is also fixed

@davidramnero davidramnero requested a review from danmar June 23, 2026 21:57

@danmar danmar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will it show all the warnings in the header file? or only multi-location warnings that points at the source file primarily?

I wonder what we will do if the user wants to switch to the header file and fix a warning. We need to be able to analyze the header file then..
can you remember that "warnings in header X was generated when source file Y" was scanned? And then when header file X is saved then you run the analysis on file Y?

@davidramnero

davidramnero commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

will it show all the warnings in the header file? or only multi-location warnings that points at the source file primarily?

It will only show the warnings that come from analyzing the source file, which are not all warnings, no. I am not sure if they are all supposed to be multi-location, I get some warnings where all locations seem to point to the header-file. I.e. using this function (see image) get_value() in the source file generates a Null pointer dereference, with all locations pointing to the header file.
Screenshot 2026-06-24 at 11 24 50

I wonder what we will do if the user wants to switch to the header file and fix a warning. We need to be able to analyze the header file then.. can you remember that "warnings in header X was generated when source file Y" was scanned? And then when header file X is saved then you run the analysis on file Y?

But if you open a header file it will still be analyzed as a stand alone file, do we want to analyze source files utilizing a header file when the header file is opened? This seems fairly intricate

@davidramnero

davidramnero commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

I updated the solution somewhat, rather than mapping just header files relation to source files we map all files agnostically if they get warnings generated for them from analysis of any file (even themselves).

This makes it so that:

I analyze source file main.c which implements header.h
Relation map:
main.c : main.c | header.h : main.c

I analyze header file header.h
Relation map:
main.c : main.c | header.h : main.c, header.h

I close source file main.c -> this does not clear diagnostics for header.h because it has warnings generated from analyzing it itself. If however all warnings for header.h are generated when analyzing main.c we will clear diagnostics for header.h when main.c is closed.

@davidramnero davidramnero requested a review from danmar June 24, 2026 09:33
@danmar

danmar commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

does this fix mean that we have the #9 bug again?

@davidramnero

Copy link
Copy Markdown
Collaborator Author

does this fix mean that we have the #9 bug again?

no, it will point to the correct file

@davidramnero davidramnero merged commit cdf8b1a into main Jun 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants