Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 2021 18:30:26 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: adbaad235b4c - main - net/ifdepd: fix clang 13 warnings and non-static inline functions
Message-ID:  <202109211830.18LIUQXi020468@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dim (src committer):

URL: https://cgit.FreeBSD.org/ports/commit/?id=adbaad235b4cfaa6571f3c1fb0bce2b23d50c400

commit adbaad235b4cfaa6571f3c1fb0bce2b23d50c400
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-09-21 18:26:13 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-09-21 18:26:13 +0000

    net/ifdepd: fix clang 13 warnings and non-static inline functions
    
    Building net/ifdepd with clang and lld 13 results in a few warnings, and
    a link error:
    
    cc  -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -Wall -Wnested-externs -Wpointer-arith -Winline -Wcast-qual -Wredundant-decls -c ifdepd.c -o ifdepd.o
    ifdepd.c:420:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
              free(d_ints);
              ^
    ifdepd.c:418:2: note: previous statement is here
            if (D)
            ^
    ifdepd.c:434:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
              free(s_ints);
              ^
    ifdepd.c:432:2: note: previous statement is here
            if (S)
            ^
    2 warnings generated.
    cc -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -Wall -Wnested-externs -Wpointer-arith -Winline -Wcast-qual -Wredundant-decls -o ifdepd ifdepd.o
    ld: error: undefined symbol: cleanup
    >>> referenced by ifdepd.c
    >>>               ifdepd.o:(main)
    >>> referenced by ifdepd.c
    >>>               ifdepd.o:(main)
    >>> referenced by ifdepd.c
    >>>               ifdepd.o:(main)
    >>> referenced 1 more times
    cc: error: linker command failed with exit code 1 (use -v to see invocation)
    *** Error code 1
    
    The warnings about misleading indentation are indicating an actual bug,
    which can be fixed by adding a few braces. The link error is because
    ifdepd uses an inline function without either a static or an extern
    specifier. Fix this by adding a static specifier.
    
    Approved by:    alex@hugo.bmg.gv.at (maintainer)
    PR:             258512
    MFH:            2021Q3
---
 net/ifdepd/Makefile             |  1 +
 net/ifdepd/files/patch-ifdepd.c | 44 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/net/ifdepd/Makefile b/net/ifdepd/Makefile
index 9a431f215dc9..e86d794685cf 100644
--- a/net/ifdepd/Makefile
+++ b/net/ifdepd/Makefile
@@ -2,6 +2,7 @@
 
 PORTNAME=	ifdepd
 PORTVERSION=	20110412
+PORTREVISION=	1
 CATEGORIES=	net
 MASTER_SITES=	http://alex.bmg.gv.at/programs/
 
diff --git a/net/ifdepd/files/patch-ifdepd.c b/net/ifdepd/files/patch-ifdepd.c
new file mode 100644
index 000000000000..f6836dabd96a
--- /dev/null
+++ b/net/ifdepd/files/patch-ifdepd.c
@@ -0,0 +1,44 @@
+--- ifdepd.c.orig	2011-04-12 13:24:48 UTC
++++ ifdepd.c
+@@ -188,7 +188,7 @@ void int_down(int_name if_name) {
+   }
+ }
+ 
+-inline void cleanup() {
++static inline void cleanup() {
+   if (s_opt != NULL)
+     free(s_opt);
+   if (d_opt != NULL)
+@@ -204,7 +204,7 @@ void usage(const char *progname) {
+        progname);
+ }
+ 
+-inline int del_count(const char *s, const char d) {
++static inline int del_count(const char *s, const char d) {
+   int cnt=0, a;
+   for (a=0; s[a] != '\0'; a++)
+     if (s[a] == d)
+@@ -415,9 +415,10 @@ int main(int argc, char *argv[]) {
+       if (!ints_exists(s_ints, s_cnt)) {
+         free(s_opt);
+ 	free(s_ints);
+-	if (D)
++	if (D) {
+ 	  free(d_opt);
+ 	  free(d_ints);
++	}
+ 	exit(1);
+       }
+       break;
+@@ -429,9 +430,10 @@ int main(int argc, char *argv[]) {
+       if (!ints_exists(d_ints, d_cnt)) {
+         free(d_opt);
+ 	free(d_ints);
+-	if (S)
++	if (S) {
+ 	  free(s_opt);
+ 	  free(s_ints);
++	}
+ 	exit(1);
+       }
+       break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109211830.18LIUQXi020468>