Bug 209920

Summary: 11.0 -r303469 buildkernel via amd64-gcc fails for: .../dev/cxgb/ulp/tom/cxgb_listen.c:926:13: error: redundant redeclaration of 'tcp_dooptions'; (not retested: a different cxbge issue too)
Product: Base System Reporter: Mark Millard <marklmi26-fbsd>
Component: kernAssignee: Enji Cooper <ngie>
Status: Closed FIXED    
Severity: Affects Some People CC: amd64, ngie, np
Priority: Normal Flags: ngie: mfc-stable11+
ngie: mfc-stable10-
ngie: mfc-stable9-
Version: 11.0-BETA3   
Hardware: amd64   
OS: Any   

Description Mark Millard 2016-06-01 05:28:21 UTC
--- all_subdir_cxgb ---
/usr/src/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_listen.c:926:13: error: redundant redeclaration of 'tcp_dooptions' [-Werror=redundant-decls]
extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
            ^
In file included from /usr/src/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_listen.c:49:0:
/usr/src/sys/netinet/tcp_var.h:769:7: note: previous declaration of 'tcp_dooptions' was here
void  tcp_dooptions(struct tcpopt *, u_char *, int, int);
      ^
. . .
--- all_subdir_cxgb ---
cc1: all warnings being treated as errors
*** [cxgb_listen.o] Error code 1


I got this while experimenting with WITH_META_MODE=yes for an external toolchain.


src.conf details:
(Yes it has some redundancies.)

TO_TYPE=amd64
TOOLS_TO_TYPE=x86_64
VERSION_CONTEXT=11.0
#
KERNCONF=GENERIC-NODEBUG
TARGET=${TO_TYPE}
.if ${.MAKE.LEVEL} == 0
TARGET_ARCH=${TO_TYPE}
.export TARGET_ARCH
.endif
#
WITHOUT_CROSS_COMPILER=
WITHOUT_SYSTEM_COMPILER=
#
WITH_LIBCPLUSPLUS=
WITHOUT_BINUTILS_BOOTSTRAP=
WITHOUT_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
WITH_CLANG_FULL=
WITH_CLANG_EXTRAS=
WITH_LLDB=
#PORTS_MODULES=emulators/virtualbox-ose-additions
#
#WITH_BOOT= for amd64-xtoolschain-gcc/amd64-gcc gets... 
# --- all_subdir_sys ---
# -994 bytes available
# *** [boot2] Error code 1
WITHOUT_BOOT=
WITH_LIB32=
#
WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=
WITHOUT_GCC_BOOTSTRAP=
WITHOUT_GCC=
WITHOUT_GCC_IS_CC=
WITHOUT_GNUCXX=
#
NO_WERROR=
#WERROR=
MALLOC_PRODUCTION=
#
WITH_DEBUG_FILES=
#
#
# For TO (so-called "cross") stages . . .
# So-called-cross via ${TO_TYPE}-xtoolchain-gcc/${TO_TYPE}-gcc. . .
# TOOLS_TO_TYPE based on ${TO_TYPE}-xtoolchain-gcc related binutils. . .
#
CROSS_TOOLCHAIN=${TO_TYPE}-gcc
X_COMPILER_TYPE=gcc
CROSS_BINUTILS_PREFIX=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/
.if ${.MAKE.LEVEL} == 0
XCC=/usr/local/bin/${TOOLS_TO_TYPE}-portbld-freebsd${VERSION_CONTEXT}-gcc
XCXX=/usr/local/bin/${TOOLS_TO_TYPE}-portbld-freebsd${VERSION_CONTEXT}-g++
XCPP=/usr/local/bin/${TOOLS_TO_TYPE}-portbld-freebsd${VERSION_CONTEXT}-cpp
.export XCC
.export XCXX
.export XCPP
XAS=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/as
XAR=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ar
XLD=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ld
XNM=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/nm
XOBJCOPY=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objcopy
XOBJDUMP=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objdump
XRANLIB=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ranlib
XSIZE=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/size
#NO-SUCH: XSTRINGS=/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/strings
XSTRINGS=/usr/local/bin/${TOOLS_TO_TYPE}-freebsd-strings
.export XAS
.export XAR
.export XLD
.export XNM
.export XOBJCOPY
.export XOBJDUMP
.export XRANLIB
.export XSIZE
.export XSTRINGS
.endif
#
#
# From based on clang (via system). . .
#
.if ${.MAKE.LEVEL} == 0
CC=/usr/bin/clang
CXX=/usr/bin/clang++
CPP=/usr/bin/clang-cpp
.export CC
.export CXX
.export CPP
.endif
Comment 1 Mark Millard 2016-06-01 05:41:23 UTC
(In reply to Mark Millard from comment #0)

If the offending declaration in cxgb_listen.c is commented out (or removed) there is a "next problem" for csgb:

--- all_subdir_cxgbe/tom ---
/usr/src/sys/modules/cxgbe/tom/../../../dev/cxgbe/tom/t4_listen.c: In function 'do_pass_accept_req':
/usr/src/sys/modules/cxgbe/tom/../../../dev/cxgbe/tom/t4_listen.c:640:1: warning: inlining failed in call to 'release_synqe': call is unlikely and code size would grow [-Winline]
release_synqe(struct synq_entry *synqe)
^
/usr/src/sys/modules/cxgbe/tom/../../../dev/cxgbe/tom/t4_listen.c:1406:3: warning: called from here [-Winline]
  release_synqe(synqe); /* extra hold */
  ^
/usr/src/sys/modules/cxgbe/tom/../../../dev/cxgbe/tom/t4_listen.c:640:1: warning: inlining failed in call to 'release_synqe': call is unlikely and code size would grow [-Winline]
release_synqe(struct synq_entry *synqe)
^
/usr/src/sys/modules/cxgbe/tom/../../../dev/cxgbe/tom/t4_listen.c:1411:2: warning: called from here [-Winline]
 release_synqe(synqe); /* extra hold */
 ^
. . .
--- all_subdir_cxgbe/tom ---
cc1: all warnings being treated as errors
*** [t4_listen.o] Error code 1

It looks like this code has not been tried under devel/amd64-gcc compiles.
Comment 2 Mark Millard 2016-06-01 05:44:25 UTC
(In reply to Mark Millard from comment #1)

Actually: cxbge for the second problem, not cxgb.
Comment 3 Mark Millard 2016-06-01 05:45:52 UTC
(In reply to Mark Millard from comment #1)

Actually: cxbge for the second amd64-gcc rejection, not cxgb.
Comment 4 Mark Millard 2016-06-01 09:07:14 UTC
(In reply to Mark Millard from comment #3)

After the cxgbe failed-inline error is cleared by removing the "inline" cxgbe then gets another error:

--- t4_listen.o ---
/usr/src/sys/modules/cxgbe/tom/../../../dev/cxgbe/tom/t4_listen.c:669:13: error: redundant redeclaration of 'tcp_dooptions' [-Werror=redundant-decls]
extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
            ^
In file included from /usr/src/sys/modules/cxgbe/tom/../../../dev/cxgbe/tom/t4_listen.c:61:0:
/usr/src/sys/netinet/tcp_var.h:769:7: note: previous declaration of 'tcp_dooptions' was here
void  tcp_dooptions(struct tcpopt *, u_char *, int, int);
      ^

. . .
--- t4_listen.o ---
cc1: all warnings being treated as errors
*** [t4_listen.o] Error code 1
Comment 5 Mark Millard 2016-06-13 07:14:28 UTC
(In reply to Mark Millard from comment #4)

As of 11.0 -r301815 the example changes tested have not been applied and so the status has not changed. (I can not update official FreeBSD source so someone else would have to.)

# svnlite diff /usr/src/sys/dev/cxgb/ulp/tom/cxgb_listen.c
Index: /usr/src/sys/dev/cxgb/ulp/tom/cxgb_listen.c
===================================================================
--- /usr/src/sys/dev/cxgb/ulp/tom/cxgb_listen.c	(revision 301815)
+++ /usr/src/sys/dev/cxgb/ulp/tom/cxgb_listen.c	(working copy)
@@ -923,7 +923,7 @@
 }
 
 /* XXX */
-extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
+//extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
 
 int
 t3_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m)
# svnlite diff /usr/src/sys/dev/cxgbe/tom/t4_listen.c
Index: /usr/src/sys/dev/cxgbe/tom/t4_listen.c
===================================================================
--- /usr/src/sys/dev/cxgbe/tom/t4_listen.c	(revision 301815)
+++ /usr/src/sys/dev/cxgbe/tom/t4_listen.c	(working copy)
@@ -636,7 +636,7 @@
 	refcount_acquire(&synqe->refcnt);
 }
 
-static inline void
+static /* inline */ void
 release_synqe(struct synq_entry *synqe)
 {
 
@@ -666,7 +666,7 @@
 }
 
 /* XXX */
-extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
+//extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
 
 int
 t4_syncache_respond(struct toedev *tod, void *arg, struct mbuf *m)
Comment 6 Mark Millard 2016-07-11 10:29:18 UTC
This still is true of -r302457. So I've updated the Version selected.
Comment 7 commit-hook freebsd_committer freebsd_triage 2016-07-11 16:57:08 UTC
A commit references this bug:

Author: ngie
Date: Mon Jul 11 16:56:51 UTC 2016
New revision: 302576
URL: https://svnweb.freebsd.org/changeset/base/302576

Log:
  (Re-do r302574 with corrected commit message..)

  Remove redundant declaration for tcp_dooptions

  netinet/tcp_var.h already defines this function

  Differential Revision:	https://reviews.freebsd.org/D7187
  MFC after:	1 week
  PR:		209920
  Reported by:	Mark Millard <markmi@dsl-only.net>
  Reviewed by:	np
  Tested with:	clang 3.8.0, gcc 4.2.1, gcc 5.3.0
  Sponsored by:	EMC / Isilon Storage Division

Changes:
  head/sys/dev/cxgb/ulp/tom/cxgb_listen.c
Comment 8 commit-hook freebsd_committer freebsd_triage 2016-07-11 17:12:11 UTC
A commit references this bug:

Author: ngie
Date: Mon Jul 11 17:11:19 UTC 2016
New revision: 302581
URL: https://svnweb.freebsd.org/changeset/base/302581

Log:
  Remove redundant declaration for tcp_dooptions, similar to r302576

  netinet/tcp_var.h already defines this function

  Differential Revision:	https://reviews.freebsd.org/D7189
  MFC after:	1 week
  PR:	209920
  Reported by:	Mark Millard <markmi@dsl-only.net>
  Reviewed by:	np
  Tested with:	clang 3.8.0, gcc 4.2.1, gcc 5.3.0
  Sponsored by:	EMC / Isilon Storage Division

Changes:
  head/sys/dev/cxgbe/tom/t4_listen.c
Comment 9 Mark Millard 2016-07-30 06:28:49 UTC
Attempting to builds BETA3 via amd64-gcc again got the following so I'm updating het information to track:

/usr/src/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_listen.c:926:13: error: redundant redeclaration of 'tcp_dooptions' [-Werror=redundant-decls]
 extern void tcp_dooptions(struct tcpopt *, u_char *, int, int);
             ^
In file included from /usr/src/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_listen.c:49:0:
/usr/src/sys/netinet/tcp_var.h:766:7: note: previous declaration of 'tcp_dooptions' was here
 void  tcp_dooptions(struct tcpopt *, u_char *, int, int);
       ^
cc1: all warnings being treated as errors
*** [cxgb_listen.o] Error code 1

(I have not re-testd what was later reported in comments 1 or 4.)

Context:

make[5]: stopped in /usr/src/sys/modules/cxgb/tom

# uname -apKU
FreeBSD FreeBSDx64 11.0-BETA3 FreeBSD 11.0-BETA3 #1 r303469M: Fri Jul 29 03:54:43 PDT 2016     markmi@FreeBSDx64:/usr/obj/clang/amd64.amd64/usr/src/sys/GENERIC-NODBG  amd64 amd64 1100120 1100120
# svnlite info
Path: .
Working Copy Root Path: /usr/src
URL: svn://svn.freebsd.org/base/stable/11
Relative URL: ^/stable/11
Repository Root: svn://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 303469
Node Kind: directory
Schedule: normal
Last Changed Author: gjb
Last Changed Rev: 303469
Last Changed Date: 2016-07-28 17:00:54 -0700 (Thu, 28 Jul 2016)
Comment 10 commit-hook freebsd_committer freebsd_triage 2016-08-02 23:35:48 UTC
A commit references this bug:

Author: ngie
Date: Tue Aug  2 23:35:00 UTC 2016
New revision: 303686
URL: https://svnweb.freebsd.org/changeset/base/303686

Log:
  MFC r302581:

  Remove redundant declaration for tcp_dooptions, similar to r302576

  netinet/tcp_var.h already defines this function

  Approved by:	re (gjb)
  PR:	209920

Changes:
_U  stable/11/
  stable/11/sys/dev/cxgbe/tom/t4_listen.c
Comment 11 commit-hook freebsd_committer freebsd_triage 2016-08-03 00:19:55 UTC
A commit references this bug:

Author: ngie
Date: Wed Aug  3 00:19:52 UTC 2016
New revision: 303690
URL: https://svnweb.freebsd.org/changeset/base/303690

Log:
  MFC r302576:

  Approved by: re (gjb)

  r302576:

  (Re-do r302574 with corrected commit message..)

  Remove redundant declaration for tcp_dooptions

  netinet/tcp_var.h already defines this function

  PR:		209920
  Tested with:	clang 3.8.0, gcc 4.2.1, gcc 5.3.0

Changes:
_U  stable/11/
  stable/11/sys/dev/cxgb/ulp/tom/cxgb_listen.c
Comment 12 Mark Millard 2016-08-03 07:43:13 UTC
Updating to -r303691 allowed my build attempt to get farther but I've submitted 211540 for the next things that stopped the amd64-gcc build that 11.0-BETA3+.

I classified 211540 as 11.0-STABLE as it is between 11.0-BETA3 and the future 11.0-RC1: it is not right at what a BETA3 tag would identify.