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

Preprocessor: Add debug dump options #745

Merged
merged 2 commits into from
Aug 8, 2024
Merged

Preprocessor: Add debug dump options #745

merged 2 commits into from
Aug 8, 2024

Conversation

ehaas
Copy link
Collaborator

@ehaas ehaas commented Aug 6, 2024

Adds support for GCC's -dD, -dM, -dN flags which enable dumping macro names and/or definitions along with or instead of preprocessor output.

Added a CHECK_PARTIAL_MATCH option for preprocessor testing, because the output contains things like __TIME__ which is difficult to fit into our existing preprocessor test framework.

-dM is also difficult to test extensively with the existing framework because it dumps the output in arbitrary order (just iterates over pp.defines) which seems to match the observed behavior of clang

Adds support for GCC's -dD, -dM, -dN flags which enable dumping macro
names and/or definitions along with or instead of preprocessor output.
m: bool = false,
n: bool = false,

/// Specifying letters whose behavior conflicts is undefined.
Copy link
Owner

Choose a reason for hiding this comment

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

This could specify that we match clang's behavior.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Does it actually match clang as it is now? I just chose the current order because it was alphabetical.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok just did a quick check - clang doesn't support -dN; and -dM wins over -dD (it always does -dM regardless of order if -dD and -dM are provided). I'll update it to match that.

@ehaas
Copy link
Collaborator Author

ehaas commented Aug 6, 2024

@Vexu Once this is merged, would you be able to sync aro to the main zig repo? I'd like to try updating https://github.com/ziglang/zig/blob/master/tools/generate_linux_syscalls.zig to use aro instead of zig cc (removing the clang dependency).

Is there a technical reason why Zig can't use aro as a build.zig.zon dependency? Doing so would eliminate the pain point of needing to update the Zig files generated from .def files.

@Vexu
Copy link
Owner

Vexu commented Aug 6, 2024

Once this is merged, would you be able to sync aro to the main zig repo?

Sure!

Is there a technical reason why Zig can't use aro as a build.zig.zon dependency?

I don't think so as long as bootstrapping doesn't depend on it. I'd ask @andrewrk before trying to get that to work since he tends to have opinions on stuff like that.

@ehaas
Copy link
Collaborator Author

ehaas commented Aug 6, 2024

On second thought - let me see if I can make some progress on #732 before the sync.

@Vexu Vexu merged commit 1d24511 into Vexu:master Aug 8, 2024
3 checks passed
@ehaas ehaas deleted the debug-dump branch August 9, 2024 22:30
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