RPM

rpmdir.c void functions and return values

Bug #1219107 reported by Tim Mooney
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
RPM
Fix Committed
Undecided
Unassigned

Bug Description

Building 5.4.12 on x86_64-pc-solaris2.11 (OpenIndiana oi151a8) with the Oracle Studio 12.3 compilers.

The Studio compiler objects to any function that claims it's void but issues a return statement:

gmake[2]: Entering directory `/local/src/RPM/BUILD/rpm-5.4.12/rpmio'
source='rpmdir.c' object='rpmdir.lo' libtool=yes \
        DEPDIR=.deps depmode=none /bin/sh ../depcomp \
        /bin/sh ../libtool --tag=CC --mode=compile cc -m64 -DHAVE_CONFIG_H -I. -I.. -I. -I.. -I../build -I../lib -I../lib -I../rpmdb -I../rpmio -I../misc -I../beecrypt/include -I../beecrypt/include -I../beecrypt -I../beecrypt -I../popt -I../popt -D__FUNCTION__=__func__ -I/local/gnu/include -I/local/include -I/local/include/neon -I/local/include/beecrypt -I/local/openssl/include -DRPM_OS_SOLARIS=021100 -I/local/include/db60 -I/usr/include/pcre -xopenmp -Xa -xc99=all -xO3 -g -mt -KPIC -D__FUNCTION__=__func__ -m64 -I/local/gnu/include -I/local/include -I/local/include/neon -I/local/include/beecrypt -I/local/openssl/include -D_GNU_SOURCE -D_REENTRANT -c -o rpmdir.lo rpmdir.c
libtool: compile: cc -m64 -DHAVE_CONFIG_H -I. -I.. -I. -I.. -I../build -I../lib -I../lib -I../rpmdb -I../rpmio -I../misc -I../beecrypt/include -I../beecrypt/include -I../beecrypt -I../beecrypt -I../popt -I../popt -D__FUNCTION__=__func__ -I/local/gnu/include -I/local/include -I/local/include/neon -I/local/include/beecrypt -I/local/openssl/include -DRPM_OS_SOLARIS=021100 -I/local/include/db60 -I/usr/include/pcre -xopenmp -Xa -xc99=all -xO3 -g -mt -KPIC -D__FUNCTION__=__func__ -m64 -I/local/gnu/include -I/local/include -I/local/include/neon -I/local/include/beecrypt -I/local/openssl/include -D_GNU_SOURCE -D_REENTRANT -c rpmdir.c -KPIC -DPIC -o .libs/rpmdir.o
"rpmdir.c", line 448: void function cannot return value
"rpmdir.c", line 449: void function cannot return value
"rpmdir.c", line 513: void function cannot return value
"rpmdir.c", line 514: void function cannot return value
cc: acomp failed for rpmdir.c
gmake[2]: *** [rpmdir.lo] Error 1
gmake[2]: Leaving directory `/local/src/RPM/BUILD/rpm-5.4.12/rpmio'

The simple fix is to just remove the return statement. Note that there's a mix of tabs and spaces in both of the function calls, which looks a little weird on my screen since I use a 4-width tabstop, but I believe I've preserved the original spacing in the patch.

Tags: solaris
Revision history for this message
Tim Mooney (tim-mooney) wrote :
Revision history for this message
Jeff Johnson (n3npq) wrote :

Thanks for the patch: pretty amazing what non-"portable"
extensions are routinely permitted, this code has been
fed to splint and coverity and a fair number of compilers zillions of times.

The patch isn't quite right, an else is needed.

No easy fix for "ts=4" editing: I use "ts=8" with 4 space indents
(which is the default output from indent -kr and originally
dates back to Erik Troan's coding style in vi.

Changed in rpm:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.