Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#1848 closed defect (fixed)

many "warning: 'struct in_addr' declared inside parameter list" when compiled on OpenBSD 4.8

Reported by: Tas Owned by: arma
Priority: Medium Milestone: Tor: 0.2.2.x-final
Component: Core Tor/Tor Version: Tor: 0.2.2.15-alpha
Severity: Keywords: easy
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I see many "warning: 'struct in_addr' declared inside parameter list" when I compile Tor-0.2.2.15-alpha on OpenBSD 4.8 (that's -current at the moment). The binary that I get seems to work fine though. For comparision, I don't see these warnings on FreeBSD 8.1.

all output: http://pastebin.org/646438

and a part of the output:

[...]
Making all in or
gcc -DHAVE_CONFIG_H -I. -I../.. -DSHARE_DATADIR="\"/usr/local/share\"" -DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\"" -I../../src/common -g -O2 -Wall -g -O2 -fno-strict-aliasing -MT buffers.o -MD -MP -MF .deps/buffers.Tpo -c -o buffers.o buffers.c
In file included from or.h:63,

from buffers.c:14:

/usr/include/arpa/inet.h:74: warning: 'struct in_addr' declared inside parameter list
/usr/include/arpa/inet.h:74: warning: its scope is only this definition or declaration, which is probably not what you want
/usr/include/arpa/inet.h:75: warning: 'struct in_addr' declared inside parameter list
mv -f .deps/buffers.Tpo .deps/buffers.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -DSHARE_DATADIR="\"/usr/local/share\"" -DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\"" -I../../src/common -g -O2 -Wall -g -O2 -fno-strict-aliasing -MT circuitbuild.o -MD -MP -MF .deps/circuitbuild.Tpo -c -o circuitbuild.o circuitbuild.c
In file included from or.h:63,

from circuitbuild.c:14:

/usr/include/arpa/inet.h:74: warning: 'struct in_addr' declared inside parameter list
/usr/include/arpa/inet.h:74: warning: its scope is only this definition or declaration, which is probably not what you want
/usr/include/arpa/inet.h:75: warning: 'struct in_addr' declared inside parameter list
mv -f .deps/circuitbuild.Tpo .deps/circuitbuild.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -DSHARE_DATADIR="\"/usr/local/share\"" -DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\"" -I../../src/common -g -O2 -Wall -g -O2 -fno-strict-aliasing -MT circuitlist.o -MD -MP -MF .deps/circuitlist.Tpo -c -o circuitlist.o circuitlist.c
In file included from or.h:63,

from circuitlist.c:12:

/usr/include/arpa/inet.h:74: warning: 'struct in_addr' declared inside parameter list
/usr/include/arpa/inet.h:74: warning: its scope is only this definition or declaration, which is probably not what you want
/usr/include/arpa/inet.h:75: warning: 'struct in_addr' declared inside parameter list
mv -f .deps/circuitlist.Tpo .deps/circuitlist.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -DSHARE_DATADIR="\"/usr/local/share\"" -DLOCALSTATEDIR="\"/usr/local/var\"" -DBINDIR="\"/usr/local/bin\"" -I../../src/common -g -O2 -Wall -g -O2 -fno-strict-aliasing -MT circuituse.o -MD -MP -MF .deps/circuituse.Tpo -c -o circuituse.o circuituse.c
In file included from or.h:63,

from circuituse.c:12:

/usr/include/arpa/inet.h:74: warning: 'struct in_addr' declared inside parameter list
/usr/include/arpa/inet.h:74: warning: its scope is only this definition or declaration, which is probably not what you want
/usr/include/arpa/inet.h:75: warning: 'struct in_addr' declared inside parameter list
mv -f .deps/circuituse.Tpo .deps/circuituse.Po
[...]

Child Tickets

Attachments (1)

tor01.txt (159.7 KB) - added by Tas 9 years ago.
head with Sebastian's patch, output of "./configure --disable-asciidoc --enable-gcc-warnings-advisory && make"

Download all attachments as: .zip

Change History (21)

comment:1 Changed 9 years ago by arma

Component: - Select a componentTor Client
Owner: set to arma
Status: newaccepted

comment:2 Changed 9 years ago by nickm

Keywords: easy added
Milestone: Tor: 0.2.2.x-final

comment:3 Changed 9 years ago by Tas

New info: These warnings during compilation show also up with older Tor versions (I tried with 0.2.2.10-alpha as the oldest one), so this is /not/ related to any recent changes in the Tor source. OpenBSD upgraded gcc recently, and what will get released as OpenBSD 4.8 will have this gcc version (and that's what I tested with):

$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-unknown-openbsd4.8/4.2.1/specs
Target: i386-unknown-openbsd4.8
Configured with: OpenBSD/i386 system compiler
Thread model: posix
gcc version 4.2.1 20070719

Interestingly that's just the same gcc version I have also on FreeBSD 8.1, and there Tor compiles without any warnings.

comment:4 Changed 9 years ago by nickm

So, where is "struct in_addr" defined nowadays on openbsd?

comment:6 Changed 9 years ago by Sebastian

So, the first patch to make Tor compile without warnings when *not* specifying --enable-gcc-warnings is in branch bug1848. Tas tested it and it works.

However, when one specifies --enable-gcc-warnings then more errors happen. I'll have Tas update the bug with the complete make output.

Changed 9 years ago by Tas

Attachment: tor01.txt added

head with Sebastian's patch, output of "./configure --disable-asciidoc --enable-gcc-warnings-advisory && make"

comment:7 Changed 9 years ago by Tas

file attached (this comment added to make trac send a notification email :-) )

comment:8 Changed 9 years ago by nickm

The bug1848 branch looks ok to me; merging that.

The attached pile of warnings, though, looks like some kind of crazy snafu with the openbsd source. It should be totally legal to include stdlib.h and unistd.h and sys/types.h all from the same C source file, so I guess that maybe -Wredundant-decls just isn't going to be an option on OpenBSD 4.8. (Looking at the headers in http://www.openbsd.org/cgi-bin/cvsweb/src/include/ work, it really does seem that they declare these functions in multiple headers.)

comment:9 Changed 9 years ago by Sebastian

Yes, Tas and I think so too. Should we patch the autoconf stuff to not add -Wredundant-decls if openbsd is detected?

comment:10 Changed 9 years ago by nickm

First, can we confirm with the OpenBSD people, to see whether they think this is an OpenBSD bug? If they think it's a bug, we should just let them fix it.

comment:11 Changed 9 years ago by nickm

From #openbsd on freenode:

19:03 < PiotrSikora> this won't (or at least it shouldn't) be in the release
19:03 < PiotrSikora> this is because snapshots are compiled with

-Wsystem-headers

So I think we can close this.

comment:12 Changed 9 years ago by Tas

Very interesting! I did know that in snapshots a few things get tested first, but not this detail. And yes, I run Tor on OpenBSD only on machines which run snapshots.

comment:13 Changed 9 years ago by nickm

Actually, it looks like it _won't_ be fixed in release (after more conversations on #openbsd with NicM and Bradipo and PiotrSikora). Have a gander at branch "openbsd-sysheaders" in my public.

(Sebastian, do you suppose we should backport this to stable?)

comment:14 Changed 9 years ago by Sebastian

The patch looks good, but I would like to have Tas try it before we actually merge it.

I think backporting this change is a good idea, we'll most likely have a couple more releases of 0.2.1.x, and maybe we can even convince the openbsd ports maintainer to use --enable-gcc-warnings.

comment:15 Changed 9 years ago by Tas

have Tas try it

Sure! For some reason I can't connect to OFTC via Tor though at the moment, even not without SSL. I'll be there as soon as it works again (or I've found some workaround).

comment:16 Changed 9 years ago by Sebastian

Tas just tried it for me. Both the trivial backport (sebastian/openbsdheadersbackport) and your branch work for him. I'd say we should backport & merge this now.

comment:17 Changed 9 years ago by nickm

merged "openbsdheadersbackport" into 0.2.1, then 0.2.1 into master.

Do we need to backport the netinet/in.h thing?

comment:18 Changed 9 years ago by Sebastian

Apparently not, Tas tried to compile my branch with --enable-gcc-warnings and that worked fine.

comment:19 Changed 9 years ago by nickm

Resolution: fixed
Status: acceptedclosed

ok; closing then. thanks!

comment:20 Changed 7 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.