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

[usdGenSchema] Header guard for schemaClass.h should have corresponding #endif in same file rather than being encoded in usdGenSchema.py logic #1092

Closed
moddyz opened this issue Jan 18, 2020 · 3 comments

Comments

@moddyz
Copy link
Contributor

moddyz commented Jan 18, 2020

Description of Issue

The #ifndef ... #define header guard started in codegenTemplates/schemaClass.h should have a corresponding #endif at the end of the same file. Currently, that #endif is added by usdGenSchema.py.

The use case is we prefer using #pragma once as the header guarding mechanism throughout our codebase. It would be useful to be able to make this customisation purely through codegenTemplates.

System Information (OS, Hardware)

ubuntu-18.04

Package Versions

usd-19.11

@jilliene
Copy link

Filed as internal issue #USD-5806

@spiffmon
Copy link
Member

Hi @moddyz !
Moving the "terminator" logic entirely out of usdGenSchema and into schemaClass.h templates would require the addition of a new line/token to robustly bracket the custom section... and I think you might also lose the ability to add free functions. But most importantly, the implication is that it would cause a diff to every single generated schema header, which is a pretty high overhead to accommodate this need.
However, we would support a PR that adds a command-line option to usdGenSchema , --headerTerminatorString so that you are not stuck with the hardcoded string that's in there, now, when generating your local schemas. You may want to add a companion argument that customizes the message that accompanies the --(BEGIN CUSTOM CODE)-- so that your users aren't still admonished to "Close the include guard with #endif"

@moddyz
Copy link
Contributor Author

moddyz commented Jan 25, 2020

@spiffmon sounds like a solid plan 👍

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

4 participants