Undefine "extended" macro temporarily on GNU Hurd#5047
Merged
ctrlcctrlv merged 1 commit intofontforge:masterfrom Jun 17, 2022
Merged
Conversation
GNU Mach microkernel header files (gnumach-dev 1.8+git20201129) added to struct i386_xfp_save in /usr/include/i386-gnu/include/mach/i386/fp_reg.h a new "extended" field which happens to collide with the macro definition "#define extended double" in FontForge, leading to FTBFS on GNU Hurd. This issue may be circumvented by temporarily undefining the "extended" macro before loading `<gio/gio.h>` and friends, and redefining the "extended" macro right after.
ctrlcctrlv
approved these changes
Jun 17, 2022
Member
ctrlcctrlv
left a comment
There was a problem hiding this comment.
Ugh, what a mess. Way too common of a name, but it's used extensively:
$ find . -iname '*.c' -or -iname '*.h'|xargs grep 'extended'|wc -l
324As you note, we already have to undef it for another collision:
$ rg 'undef extended'fontforge/svg.c
1140:#undef extended /* used in xlink.h */
fontforge/ufo.c
60:#undef extended /* used in xlink.h */So I see no reason not to merge this; I doubt anyone is going to want to tackle unfudging more than 20 years of brokenness in FontForge's floating point types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GNU Mach microkernel header files (gnumach-dev 1.8+git20201129) added to
struct i386_xfp_savein /usr/include/i386-gnu/include/mach/i386/fp_reg.ha new
extendedfield which happens to collide with the macro definition#define extended doublein FontForge, leading to FTBFS on GNU Hurd:This issue may be circumvented by temporarily undefining the
extendedmacro before loading<gio/gio.h>and friends, and redefining theextendedmacro right after, as is done in this PR.For Debian packaging, in fontforge (1:20201107~dfsg-4) released 2021-01-15, I replaced all relevant instances of
extendedwithextendeddblto avoid macro/type name collision; see my patch at https://sources.debian.org/src/fontforge/1%3A20201107~dfsg-4/debian/patches/0005-hurd-rename-extended-to-avoid-conflict-with-gnumach-dev.patch/However, when it came time to upgrade to fontforge (1:20220308~dfsg-1) on 2022-06-16, I realized such a patch would be very hard to maintain in the long run. Fortunately, I came across instances of
#undef extendedin the existing codebase for avoiding conflict with xlink.h, and borrowed the idea for this pull request. I am happy to report that this allows fontforge to build successfully on hurd-i386; see https://buildd.debian.org/status/logs.php?pkg=fontforge&ver=1%3A20220308%7Edfsg-1&arch=hurd-i386Type of change