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

Picking up a compiler's predefined macros in the wave driver #110

Open
eldiener opened this issue Sep 4, 2020 · 5 comments
Open

Picking up a compiler's predefined macros in the wave driver #110

eldiener opened this issue Sep 4, 2020 · 5 comments

Comments

@eldiener
Copy link

eldiener commented Sep 4, 2020

A number of compilers have commands to output the predefined macros for the compiler regardless of any source file and just depending on the command line to the compiler. The output is always of the form for each line:

#define SOME_MACRO SOME_EXPANSION

It would be nice if the Wave driver program could just pick up a file of these predefined macros as is, using its @filepath syntax for the file, and process it as predefined macros, rather than having to transform each define from the form above to the wave acceptable form of:

-P SOME_MACRO=SOME_EXPANSION

I understand that I can use some program or regex to transform the compiler's output file to the form which the wave driver accepts, but for convenience sake it would be nice if the wave driver accepted the first form above.

@jefftrull
Copy link
Collaborator

Have you tried using the -F option to read in the file containing the definitions?

@eldiener
Copy link
Author

eldiener commented Sep 4, 2020

Thank you for notifying me about the -F option. That actually worked but since the file produced by a compiler also includes Wave predefined macros I get the message from the wave driver when it reads in the file:

warning: this predefined name may not be redefined: __STDC__

and wave does not process the file I am passing to it to expand macros. Should it not continue anyway and do its expansion ?

@jefftrull
Copy link
Collaborator

__STDC__ is one of the special macros that is predefined through a different path, as Wave is currently designed. There are only a handful of them, starting around here - can you remove them first?

@hkaiser
Copy link
Collaborator

hkaiser commented Sep 4, 2020

We could make it so that it is possible to redefine the basic macros in a file included using -F as your use case is probably the most likely one for using this option. Another alternative would be to have a new command line option for this.

@eldiener
Copy link
Author

eldiener commented Sep 4, 2020

Either case would be fine. If I manually remove the defines for __STDC__, __STDC_VERSION__, and __STDC_HOSTED__ from the -F file, Wave does work fine. But as you anticipated it would be much easier if Wave allowed me to redefine the basic macros since the -F file can be generated on the fly for many compilers as the compiler's predefined macros.

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

No branches or pull requests

3 participants