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

makeotf and shared: Fix some linux compile problems with "bool" #1524

Merged
merged 1 commit into from
Jun 27, 2022

Conversation

skef
Copy link
Collaborator

@skef skef commented Jun 25, 2022

Description

I ran into some post-libxml2 commit compilation problems on Arch Linux, which
seem to be related to libxml2 header files pulling the stdbool.h header into some new contexts:

FAILED: c/shared/source/CMakeFiles/t1read.dir/t1read/t1read.c.o 
/usr/local/bin/cc -DANTLR4CPP_STATIC -I/usr/include/libxml2 -I/home/skef/src/afdko2/c/shared/source/../include -I/home/skef/src/afdko2/c/shared/source/../resource -O2 -g -DNDEBUG -MD -MT c/shared/source/CMakeFiles/t1read.dir/t1read/t1read.c.o -MF c/shared/source/CMakeFiles/t1read.dir/t1read/t1read.c.o.d -o c/shared/source/CMakeFiles/t1read.dir/t1read/t1read.c.o -c /home/skef/src/afdko2/c/shared/source/t1read/t1read.c
In file included from /usr/include/unicode/umachine.h:52,
                 from /usr/include/unicode/utypes.h:38,
                 from /usr/include/unicode/ucnv_err.h:88,
                 from /usr/include/unicode/ucnv.h:51,
                 from /usr/include/libxml2/libxml/encoding.h:31,
                 from /usr/include/libxml2/libxml/parser.h:812,
                 from /usr/include/libxml2/libxml/globals.h:18,
                 from /usr/include/libxml2/libxml/threads.h:35,
                 from /usr/include/libxml2/libxml/xmlmemory.h:218,
                 from /usr/include/libxml2/libxml/tree.h:1307,
                 from /home/skef/src/afdko2/c/shared/source/../include/ctlshare.h:18,
                 from /home/skef/src/afdko2/c/shared/source/../include/t1read.h:8,
                 from /home/skef/src/afdko2/c/shared/source/t1read/t1read.c:18:
/home/skef/src/afdko2/c/shared/source/t1read/t1read.c: In function ‘parseBool’:
/home/skef/src/afdko2/c/shared/source/t1read/t1read.c:1860:10: error: both ‘long’ and ‘_Bool’ in declaration specifiers
 1860 |     long bool = 0; /* Suppress optimizer warning */
      |          ^~~~
/home/skef/src/afdko2/c/shared/source/t1read/t1read.c:1860:15: error: expected identifier or ‘(’ before ‘=’ token
 1860 |     long bool = 0; /* Suppress optimizer warning */
      |               ^
In file included from /usr/include/unicode/umachine.h:52,
                 from /usr/include/unicode/utypes.h:38,
                 from /usr/include/unicode/ucnv_err.h:88,
                 from /usr/include/unicode/ucnv.h:51,
                 from /usr/include/libxml2/libxml/encoding.h:31,
                 from /usr/include/libxml2/libxml/parser.h:812,
                 from /usr/include/libxml2/libxml/globals.h:18,
                 from /usr/include/libxml2/libxml/threads.h:35,
                 from /usr/include/libxml2/libxml/xmlmemory.h:218,
                 from /usr/include/libxml2/libxml/tree.h:1307,
                 from /home/skef/src/afdko2/c/shared/source/../include/ctlshare.h:18,
                 from /home/skef/src/afdko2/c/shared/source/../include/t1read.h:8,
                 from /home/skef/src/afdko2/c/shared/source/t1read/t1read.c:18:
/home/skef/src/afdko2/c/shared/source/t1read/t1read.c:1865:17: error: expected expression before ‘_Bool’
 1865 |                 bool = 0;
      |                 ^~~~
/home/skef/src/afdko2/c/shared/source/t1read/t1read.c:1867:17: error: expected expression before ‘_Bool’
 1867 |                 bool = 1;
      |                 ^~~~
/home/skef/src/afdko2/c/shared/source/t1read/t1read.c:1899:17: error: expected expression before ‘_Bool’
 1899 |                 bool = value >= h->mm.ForceBoldThreshold;
      |                 ^~~~
/home/skef/src/afdko2/c/shared/source/t1read/t1read.c:1901:17: error: expected expression before ‘_Bool’
 1901 |                 bool = value >= 0.5;
      |                 ^~~~
/home/skef/src/afdko2/c/shared/source/t1read/t1read.c:1906:12: error: expected expression before ‘_Bool’
 1906 |     return bool;
      |            ^~~~

This is a trivial PR to change some variables named bool to boole.

We might need this as a quick rev of the recent release -- I'm not sure.

Checklist:

  • I have followed the Contribution Guidelines
  • I have added test code and data to prove that my code functions correctly
  • I have verified that new and existing tests pass locally with my changes
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

   (These seem to be due to libxml pulling in stdbool.h in more
   contexts.)
@skef skef requested a review from kaydeearts June 25, 2022 06:23
Copy link
Collaborator

@kaydeearts kaydeearts left a comment

Choose a reason for hiding this comment

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

Thanks for catching this!

@skef skef merged commit 15c16d6 into develop Jun 27, 2022
@skef skef deleted the boolfixes branch June 27, 2022 16:36
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