Bug #5539
-Wunused-variable trips up ipsecesp
Start date:
2015-01-14
Due date:
% Done:
80%
Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:
Description
Nightlies don't catch this for some reason, but compiling in usr/src/uts/*/ipsecesp reveals this error:
/opt/onbld/bin/i386/cw -_gcc -m64 -Ui386 -U__i386 -xO3 ../../intel/amd64/ml/amd64.il -D_ASM_INLINES -Xa -xspace -xmodel=kernel -_gcc=-mno-mmx -_gcc=-mno-sse -Wu,-save_args -v -xildoff -g -xc99=%all -W0,-noglobal -Wu,-save_args -xdebugformat=stabs -errtags=yes -errwarn=%all -_gcc=-Wno-missing-braces -_gcc= Wno-sign-compare -_gcc=-Wno-unknown-pragmas -_gcc=-Wno-unused-parameter -_gcc=-Wno-missing-field-initializers -_gcc=-Wno-uninitialized -_gcc=-fno-inline-small-functions -_gcc=-fno-inline-functions-called-once -_gcc=-fno-ipa-cp -W0,-xglobalstatic -xstrconst -D_KERNEL -D_SYSCALL32 -D_SYSCALL32_IMPL -D_ELF64 -D_DDI_STRICT -Dsun -D__sun -D__SVR4 -I../../intel -Y I,../../common -c -o obj64/ipsecesp.o ../../common/inet/ip/ipsecesp.c + /opt/gcc-4.4.4//bin/gcc -fident -finline -fno-inline-functions -fno-builtin -fno-asm -fdiagnostics-show-option -nodefaultlibs -D__sun -m64 -mtune=opteron -Ui386 -U__i386 -fno-strict-aliasing -fno-unit-at-a-time -fno-optimize-sibling-calls -O2 -D_ASM_INLINES -ffreestanding -mno-red-zone -mno-mmx -mno-sse -msave-args -Wall -Wextra -gdwarf-2 -std=gnu99 -msave-args -Werror -Wno-missing-braces -Wno-sign-compare -Wno-unknown-pragmas -Wno-unused-parameter -Wno-missing-field-initializers -Wno-uninitialized -fno-inline-small-functions -fno-inline-functions-called-once -fno-ipa-cp -D_KERNEL -ffreestanding -D_SYSCALL32 -D_SYSCALL32_IMPL -D_ELF64 -D_DDI_STRICT -Dsun -D__sun -D__SVR4 -I../../intel -nostdinc -I../../common -c -o obj64/ipsecesp.o ../../common/inet/ip/ipsecesp.c -mcmodel=kernel cc1: warnings being treated as errors ../../common/inet/ip/ipsecesp.c: In function 'esp_port_freshness': ../../common/inet/ip/ipsecesp.c:1575: error: unused variable 'local' [-Wunused-variable] *** Error code 1
For DEBUG, this variable ('local') is used, but not for non-DEBUG. Fix is to ASSERT on the expansion, like this:
diff --git a/usr/src/uts/common/inet/ip/ipsecesp.c b/usr/src/uts/common/inet/ip/ipsecesp.c index c325e8d..07206ec 100644 --- a/usr/src/uts/common/inet/ip/ipsecesp.c +++ b/usr/src/uts/common/inet/ip/ipsecesp.c @@ -1572,13 +1572,12 @@ static void esp_port_freshness(uint32_t ports, ipsa_t *assoc) { uint16_t remote = FIRST_16(ports); - uint16_t local = NEXT_16(ports); ipsa_t *outbound_peer; isaf_t *bucket; ipsecesp_stack_t *espstack = assoc->ipsa_netstack->netstack_ipsecesp; /* We found a conn_t, therefore local != 0. */ - ASSERT(local != 0); + ASSERT(NEXT_16(ports) != 0); /* Assume an IPv4 SA. */ ASSERT(assoc->ipsa_addrfam == AF_INET);
Updated by Dan McDonald about 5 years ago
I'm tempted to either close this bug as incomplete, or expand its scope to eliminate "CERRWARN += -_gcc=-Wno-uninitialized
" from ipsecesp's Makefile.