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

Add option to retain #include directives in preprocessor #75

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

seladb
Copy link
Contributor

@seladb seladb commented Oct 5, 2023

Please let me know if you're open to this change...

In the existing behavior - the preprocessor will remove #include headers that it can find in the current directory. For example, if these are the files in my folder:

|- t1.h
|- t2.h

Content of t1.h:

// t1.h

#include "t2.h

Content of t2.h:

// t2.h

...

When I run the preprocessor for t1.h, I won't see any includes:

{
    "includes": []
}

With this change I can see the include:

  "includes": [
    {
      "filename": "\"t2.h\""
    }
  ]

@virtuald
Copy link
Member

virtuald commented Oct 5, 2023

I don't want this to be the default behavior. Add it as an option to make_pcpp_preprocessor instead?

@seladb
Copy link
Contributor Author

seladb commented Oct 5, 2023

I don't want this to be the default behavior. Add it as an option to make_pcpp_preprocessor instead?

Added here: 9fe4713
I'm not sure about the option name, please feel free to suggest another name...

Are you open to also expose it as an opition in dumpmain()? If yes, what should be the option name?

@virtuald virtuald force-pushed the do-not-skip-headers-in-preprocessor branch from 9fe4713 to 5cdbef1 Compare October 6, 2023 06:32
@virtuald virtuald force-pushed the do-not-skip-headers-in-preprocessor branch from 5cdbef1 to 312f6fb Compare October 6, 2023 06:34
@virtuald virtuald changed the title preprocessor - avoid removing known #include headers Add option to retain #include directives in preprocessor Oct 6, 2023
@virtuald
Copy link
Member

virtuald commented Oct 6, 2023

I don't really think it makes sense to expose it in dumpmain, it already doesn't support all options and isn't really intended to be used directly, it's merely a tool to help you visualize the output when parsing something. As the documentation says "Anything more than that and you should use the python API".

@virtuald virtuald merged commit 2a17b27 into robotpy:main Oct 6, 2023
33 checks passed
@seladb seladb deleted the do-not-skip-headers-in-preprocessor branch October 6, 2023 07:02
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