- edited description
Generated Header with Dolfin backend Include Guards are mangled when input file is in a different directory
FFC places standard CPP include guards in generated header files for use with Dolfin. However when ffc is invoked with ffc path/to/other/dir/file.ufl
the ffc includes preproccessor illegal tokens (forward slashes) in the define guard. Causing compilation failure. Furthermore, because filename is split with filename.split(.)[0]
in the ffc script. Relative paths like ../relative/path/to/dir/file.ufl
result in a include guard that is identical between all relative files __h
FIX: Given in pull request
- use
os.splitext
to split filename - use regexp to replace all invalid characters with __ to preserve path/filename differentiation
Comments (10)
-
reporter -
Thanks for the report and patch. Is path differentiation necessary? Would just using the basename be sufficient? I think you can set the prefix on the commandline as well.
-
reporter Probably not, there may be edge cases where it is an issue, I can push a second fix tomorrow if you like , time to go home :)
-
Please do.
-
reporter Done, it was a trivial change.
-
Fix is available in https://bitbucket.org/fenics-project/ffc/pull-request/11
-
Since we haven't heard from Andrey Shmakov and I needed this I've fixed it in martinal/fix-ufl-file-path-bug and pushed to next. I fixed it only in scripts/ffc, also handles validating the prefix such that ../blatti/foo.bar.ufl gets a valid prefix foo_bar.
-
- changed milestone to 1.5
-
assigned issue to
-
- changed status to resolved
-
- removed milestone
Removing milestone: 1.5 (automated comment)
- Log in to comment