question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Header files are not excluded when they do not declare any types

See original GitHub issue

If a file is included in excludedHeaderFiles but doesn’t declare any types or functions, it will not be excluded. This is a problem when the header file is including other header files that do declare types.

A good example of this is windows.h. It doesn’t declare any types itself, but includes quite a few headers that will be visited during ExploreTranslationUnit.

An easy way to replicate the issue is to do the following:

// Library.h
#include "ParentHeader.h"

// ParentHeader.h
#include "ChildHeader.h"

// ChildHeader.h
struct MyStruct
{
    int x;
    int y;
}

// config.json
{
  "inputFilePath": "Library.h",
  "outputFilePath": "Library.cs",
  "excludedHeaderFiles": ["ParentHeader.h"]
}

In the example above, MyStruct will be generated in Library.cs.

Alternatively on windows, just try to #include <windows.h> and "excludeHeaderFiles": ["windows.h"]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lithiumtoastcommented, Apr 1, 2022

I’ll add the test case to the integration test when the multi-pass branch is merged.

0reactions
lithiumtoastcommented, Jun 12, 2022

@waldnercharles I fixed this and added a test for it for regression. See pull request #94.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Header exclusion? - c++
1 Answer 1 ... Now when Header.h includes <stdbool.h> it will have no effect because it's already been included. This way is technically...
Read more >
Best practices for making header file? [closed]
Header files should never contain object definitions, only type definitions and object declarations. I would probably never say never, but ...
Read more >
Header Files are Excluded from Analysis when Using any ...
When no sonar-project.properties file is specified, the header and test files appear in the analysis, and coverage is reported.
Read more >
Using header files without include? - Programming Questions
hi.. i have an external library that i need to adapt for arduino. one of the issues i have is that it has...
Read more >
Ignore header file with module? - Swift Forums
Hi all,. Is there a way to ignore a specific header file when declaring a C dependency? I'm working with a library that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found