#67290 closed defect (fixed)

fnc @0.15: error: declaration does not declare anything

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: mcjsk (Mark Jamsek)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc:
Port: fnc

Description

fnc fails to build on macOS 10.15 and earlier:

https://build.macports.org/builders/ports-10.15_x86_64-builder/builds/137045/steps/install-port/logs/stdio

lib/libfossil.c:5308:5: error: declaration does not declare anything [-Werror,-Wmissing-declarations]
    __attribute__ ((fallthrough));
    ^
lib/libfossil.c:24826:7: error: declaration does not declare anything [-Werror,-Wmissing-declarations]
      __attribute__ ((fallthrough));
      ^
lib/libfossil.c:24828:7: error: declaration does not declare anything [-Werror,-Wmissing-declarations]
      __attribute__ ((fallthrough));
      ^
lib/libfossil.c:24830:7: error: declaration does not declare anything [-Werror,-Wmissing-declarations]
      __attribute__ ((fallthrough));
      ^
lib/libfossil.c:35036:7: error: declaration does not declare anything [-Werror,-Wmissing-declarations]
      __attribute__ ((fallthrough));
      ^
5 errors generated.
*** Error code 1
1 error

Change History (3)

comment:1 Changed 19 months ago by ryandesign (Ryan Carsten Schmidt)

The "declaration does not declare anything" error is probably something to report to the developer of fnc. I don't know if it's critical to fix, since it would originally have only been a warning, but this project promotes warnings to errors by using -Werror. That's hardcoded into FNC_CFLAGS in the fnc.bld.mk file. While it's not unreasonable for a developer to want to use -Werror themselves, usually we don't want to use it in MacPorts since we build on a wide range of OS and compiler versions, so it would be appropriate for us to add a patch to remove this flag.

comment:2 Changed 19 months ago by mcjsk (Mark Jamsek)

Please see comment in #64175, which includes the below diff addressing this issue by patching -Werror out of the libfossil.c compilation.

diff /home/mark/src/macport-ports
commit - 0a81b08c5c8033f3b2f71d1185ec0e129e49a612
path + /home/mark/src/macport-ports
blob - ef0e1e3feae0cb775fe263136db728db0c09d816
file + devel/fnc/Portfile
--- devel/fnc/Portfile
+++ devel/fnc/Portfile
@@ -5,7 +5,7 @@ revision        0
 
 name            fnc
 version         0.15
-revision        0
+revision        1
 categories      devel
 license         ISC
 maintainers     {bsdbox.org:mark @mcjsk} \
@@ -27,8 +27,11 @@ depends_lib-append      port:zlib
 
 build.type      bsd
 
-depends_lib-append      port:zlib
+patchfiles      libf-Werror-include-ncursesw.diff
 
+depends_lib-append      port:zlib \
+                        port:ncurses
+
 destroot {
     xinstall -m 755 ${worksrcpath}/src/${name} ${destroot}${prefix}/bin/${name}
     xinstall -m 444 ${worksrcpath}/src/${name}.1 ${destroot}${prefix}/share/man/man1/${name}.1
blob - /dev/null
file + devel/fnc/files/libf-Werror-include-ncursesw.diff (mode 644)
--- /dev/null
+++ devel/fnc/files/libf-Werror-include-ncursesw.diff
@@ -0,0 +1,22 @@
+Index: fnc.bld.mk
+=======================================================================
+hash - d5125d91b651e4115400e52857e80fd35cd8fb25ccf50e3828db32c27f119b63
+hash + 0461726b7bef3caa495e6e17283581bc33b1f0d439da29c2ef477439a27d6d45
+--- fnc.bld.mk
++++ fnc.bld.mk
+@@ -37,13 +37,13 @@ FOSSIL_CFLAGS =	${CFLAGS} -Wall -Werror -Wsign-compare 
+ 		-DSQLITE_TRUSTED_SCHEMA=0
+ 
+ # FLAGS NEEDED TO BUILD LIBFOSSIL
+-FOSSIL_CFLAGS =	${CFLAGS} -Wall -Werror -Wsign-compare -pedantic -std=c99
++FOSSIL_CFLAGS =	${CFLAGS} -Wall -Wsign-compare -pedantic -std=c99
+ 
+ # On SOME Linux (e.g., Ubuntu 18.04.6), we have to include wchar curses from
+ # I/.../ncursesw, but linking to -lncursesw (w/ no special -L path) works fine.
+ # FLAGS NEEDED TO BUILD FNC
+ FNC_CFLAGS =	${CFLAGS} -Wall -Werror -Wsign-compare -pedantic -std=c99 \
+-		-I./lib -I./include -I/usr/include/ncursesw \
++		-I./lib -I./include \
+ 		-D_XOPEN_SOURCE_EXTENDED -DVERSION=${VERSION} -DHASH=${HASH} \
+ 		-DDATE="${DATE}"
+ 

comment:3 Changed 12 months ago by Mark Jamsek <mark@…>

Resolution: fixed
Status: assignedclosed

In 83d43386d08576fa0f71e655cbcd96086c3353fa/macports-ports (master):

fnc: close tickets https://github.com/macports/macports-ports/pull/64175 and https://github.com/macports/macports-ports/pull/67290

(https://github.com/macports/macports-ports/pull/64175) changes the Portfile to add a missing depends (ncurses), and patches
out an unwanted include (i.e,-I/usr/include/ncursesw) from upstream's makefile.
(https://github.com/macports/macports-ports/pull/67290) patches out -Werror from the upstream's libfossil build to silence
warnings due to missing fallthrough attribute on older compilers.

Closes: #64175
Closes: #67290

Note: See TracTickets for help on using tickets.