Subject: lib/19241: ibstdc++.so: warning: reference to compatibility vfork(); include for correct reference
To: None <gnats-bugs@gnats.netbsd.org>
From: None <cagney@mac.com>
List: netbsd-bugs
Date: 12/02/2002 11:34:14
>Number:         19241
>Category:       lib
>Synopsis:       ibstdc++.so: warning: reference to compatibility vfork(); include <unistd.h> for correct reference
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 02 11:35:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Cagney
>Release:        1.6
>Organization:
>Environment:
NetBSD localhost 1.6 NetBSD 1.6 (NETLUX) #0: Mon Dec  2 11:24:42 EST 2002     boor@localhost:/usr/old/syssrc/sys/arch/macppc/compile/NETLUX macppc

>Description:
On Sat, Nov 23, 2002 at 08:01:10PM -0800, Jason R Thorpe wrote:

 >  > /usr/lib/libstdc++.so: warning: reference to compatibility vfork(); include <unistd.h> for correct reference
 >  > Well, it tells you precisely what needs to happen -- <unistd.h> needs to
 > be included by the source file using vfork().
 >  > This warning does not happen on a -current system, but the toolchain has
 > not changed... and I don't see a reference to vfork in the libstdc++ sources,
 > however it is there in the object... hm.

Ah, it was right under my nose:

./libio/iopopen.c:#define _IO_fork vfork /* defined in libiberty, if needed */

-current does indeed include <unistd.h> to get the correct vfork reference,
...and apparently the netbsd-1-6 branch does, as well:

Well, I just re-built 1-6 and still get the warning.  Appears to be a bit of a gap between the theory and reality :-/

The declaration (<unistd.h>) looks to be wrapped in the (false) expression:

   228  #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
   229      (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
   230      (_XOPEN_SOURCE - 0) >= 500

Poking around with:

# /home/tmp/TOOLDIR/bin/powerpc--netbsd-gcc -O2   -Werror  -nostdinc++ -I/usr/src/gnu/lib/libstdc++/arch/powerpc -I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/libio -I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/libstdc++ -I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/libstdc++/stl -I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/libstdc++/../libio -I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/gcc/cp/inc -I/usr/src/gnu/lib/libstdc++/../libiberty -I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/include -nostdinc -isystem /home/tmp/DESTDIR/usr/include  -c -fPIC -DPIC /usr/src/gnu/lib/libstdc++/../../dist/toolchain/libio/iopopen.c -E -dD

Indicates:

extern _G_pid_t  vfork   (void)  ;
  ((_IO_proc_file *) fp)->pid = child_pid = vfork  ();

(that's the declaration found in iopopen.c) and only

#define _POSIX_C_SOURCE 1L

is defined.

Andrew



symbolic names:
        netbsd-1-6-RELEASE: 1.2
        netbsd-1-6-RC3: 1.2
        netbsd-1-6-RC2: 1.2
        netbsd-1-6-RC1: 1.2
        netbsd-1-6: 1.2.0.2
        netbsd-1-6-base: 1.2
        gcc-2-95-3: 1.1.1.1
        gcc-2-95-2: 1.1.1.1
        FSF: 1.1.1
keyword substitution: o
total revisions: 3;     selected revisions: 3
description:



>How-To-Repeat:
Compile hello world using G++.


>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted: