dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.62k stars 114 forks source link

Hurd build blows up when %lx is used for uint64_t #519

Closed dankamongmen closed 4 years ago

dankamongmen commented 4 years ago

@edmonds pointed out that we're failing to build on Debian's Hurd autobuilder. It appears to be due to printf()-style format warnings: https://buildd.debian.org/status/fetch.php?pkg=notcurses&arch=hurd-i386&ver=1.3.1%2Bdfsg.1-2&stamp=1587297261&raw=0

/<<PKGBUILDDIR>>/src/lib/internal.h: In function ‘void cell_debug(const egcpool*, const cell*)’:
/<<PKGBUILDDIR>>/src/lib/internal.h:595:62: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
  595 |   fprintf(stderr, "gcluster: %u %c attr: 0x%08x chan: 0x%016lx\n",
      |                                                         ~~~~~^
      |                                                              |
      |                                                              long unsigned int
      |                                                         %016llx
  596 |         c->gcluster, c->gcluster, c->attrword, c->channels);
      |                                                ~~~~~~~~~~~    
      |                                                   |
      |                                                   uint64_t {aka long long unsigned int}
/<<PKGBUILDDIR>>/src/lib/internal.h:598:62: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=]
  598 |   fprintf(stderr, "gcluster: %u %s attr: 0x%08x chan: 0x%016lx\n",
      |                                                         ~~~~~^
      |                                                              |
      |                                                              long unsigned int
      |                                                         %016llx
  599 |         c->gcluster, egcpool_extended_gcluster(p, c), c->attrword, c->channels);
      |                                                                    ~~~~~~~~~~~
      |                                                                       |
      |                                                                       uint64_t {aka long long unsigned int}
[ 10%] Building CXX object CMakeFiles/notcurses-tester.dir/tests/main.cpp.o
/usr/bin/c++  -DFORTIFY_SOURCE=2 -D_XOPEN_SOURCE -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/obj-i686-gnu/include -I/<<PKGBUILDDIR>>/src/lib  -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fvisibility=hidden   -Wall -Wextra -W -Wshadow -O2 -std=c++17 -o CMakeFiles/notcurses-tester.dir/tests/main.cpp.o -c /<<PKGBUILDDIR>>/tests/main.cpp
/<<PKGBUILDDIR>>/tests/main.cpp:10:21: error: ‘PATH_MAX’ was not declared in this scope
   10 | static char datadir[PATH_MAX + 1] = "/usr/share/notcurses"; // FIXME
      |                     ^~~~~~~~
/<<PKGBUILDDIR>>/tests/main.cpp: In function ‘char* find_data(const char*)’:
/<<PKGBUILDDIR>>/tests/main.cpp:24:37: error: ‘datadir’ was not declared in this scope
   24 |   char* path = (char*)malloc(strlen(datadir) + 1 + strlen(datum) + 1);
      |                                     ^~~~~~~
/<<PKGBUILDDIR>>/tests/main.cpp: In function ‘void handle_opts(const char**)’:
/<<PKGBUILDDIR>>/tests/main.cpp:36:15: error: ‘datadir’ was not declared in this scope
   36 |       strncpy(datadir, *argv, sizeof(datadir) - 1);
      |               ^~~~~~~

also note the missing PATH_MAX at the bottom.

dankamongmen commented 4 years ago

The three issues on Hurd are believed fixed for 1.3.3: