n-t-roff / heirloom-doctools

The Heirloom Documentation Tools: troff, nroff, and related utilities
http://n-t-roff.github.io/heirloom/doctools.html
Other
126 stars 23 forks source link

b0c598742fe9b8ffe5fcdfdc9adce34708907379 breaks build on OS X, does not eliminate warnings #45

Closed andlabs closed 7 years ago

andlabs commented 7 years ago

Trying to build current master on OS X 10.11.6 with Xcode 8 yields the following early on in the build process:

../lex.c:137:19: error: use of undeclared identifier 'deftbl'
        if ((tp = lookup(deftbl, token, NULL)) != NULL) {
                         ^
../lex.c:144:24: error: use of undeclared identifier 'keytbl'
        else if ((tp = lookup(keytbl, token, NULL)) == NULL) {
                              ^

git-blaming reveals that commit b0c598742fe9b8ffe5fcdfdc9adce34708907379 removed the declarations of deftbl and keytbl from yylex() in eqn. If I manually add them back, we get a bit more progress:

../lookup.c:223:1: error: conflicting types for 'lookup'
lookup(tbl **tblp, const char *name, const char *defn)  /* find name in ...
^
../e.h:150:6: note: previous declaration is here
tbl *lookup(tbl **, char *, char *);
     ^

Readding the const qualifiers to the parameters in lookup.c brings us even further:

../paren.c:166:1: error: conflicting types for 'brack'
brack(int m, const char *t, const char *c, const char *b) {
^
../e.h:164:6: note: previous declaration is here
void brack(int, char *, char *, char *);
     ^

but at this point I stopped and did the git blame, and noticed that the commit in question was trying to fix constness warnings, which still show up for me among the other noise.

Reverting the commit entirely causes eqn to build without any warnings or errors. It then breaks on dpost with similar errors, from a similar commit.

Example make output for one file's compilation, to show compiler flags:

cc   -D_GNU_SOURCE -I. -I.. -I../../include -DHAVE_STRLCPY -DHAVE_STRLCAT -DHAVE_WCSLCPY -c ../lex.c

clang version:

Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

cc @bapt

bapt commented 7 years ago

oups I know what I missed I will fix tonight sorry about that

andlabs commented 7 years ago

All right; no worries. Thanks for the quick response!

andlabs commented 7 years ago

Yep, everything builds perfectly now. Thanks! And thanks to all of you for maintaining this!