pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: pkgsrc/net/nsd



  And I dislike "warning: implicit declaration of function" messages.

  How to fix this problem?

Sure, many people don't like that either!

If you include the right header, and don't define any visibility
defines, then typically things like strlcpy appear just fine.

The problem is if someone defines _XOPEN_SOURCE to some level, that is
not really so much a request to make that level of XOPEN available as a
request to hide everything that is not specified by that version of
XOPEN.  The point is to detect use of things beyond the standard, so
that the program will build on all other conforming platforms.  And
thus, assuming this hypothetical, if strlcpy isn't in XOPEN, then it
can't be used.

  For example, initgroups(e) is defined in /usr/include/unistd.h like:
  #if defined(_NETBSD_SOURCE)
  (snip)
  int      initgroups(const char *, gid_t);

Yes, but if there are no visibility defines, _NETBSD_SOURCE will be
defined by default.

Looking in the sources, there are all sorts of visibility defines.  See
config.h.in.

I did the configure phase, and removed all the visibility defines, and
then built.

The only symbol that was not defined was reallocarray, which is an
OpenBSD thing, and for that one needs _OPENBSD_SOURCE.  As far as I know
reallocarray is not defined by any standard.

So, this is an upstream bug, and should be addressed upstream.  I think
they should just remove all the defines, and only set them on specific
operating systems where they are really necessary.  Most operating
systems provide symbols from all standards by default.

I am not really clear on the portable rules for reallocarray.   On
NetBSD it needs _OPENBSD_SOURCE, and I don't know if it needs that on
OpenBSD, on which other platforms it is available, and what one needs to
do there.

It might be reasonable to have _OPENBSD_SOURCE defined only on NetBSD,
and to not define any other defines otherwise.





Home | Main Index | Thread Index | Old Index