From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: [PATCH 2/4] Add basic sys/cdefs.h found on most unix
Date: Sat, 20 Oct 2012 20:11:18 -0400 [thread overview]
Message-ID: <20121021001118.GW254@brightrain.aerifal.cx> (raw)
In-Reply-To: <50833E3B.1070003@embtoolkit.org>
On Sun, Oct 21, 2012 at 02:13:47AM +0200, Abdoulaye Walsimou GAYE wrote:
> On 10/21/2012 01:38 AM, Rich Felker wrote:
> >On Sun, Oct 21, 2012 at 01:38:52AM +0200, Abdoulaye Walsimou GAYE wrote:
> >>On 10/21/2012 01:18 AM, Isaac Dunham wrote:
> >>>On Sat, 20 Oct 2012 22:15:43 +0200
> >>>Abdoulaye Walsimou Gaye <awg@embtoolkit.org> wrote:
> >>>
> >>>>Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
> >>>>---
> >>>> include/sys/cdefs.h | 22 ++++++++++++++++++++++
> >>>> 1 file changed, 22 insertions(+)
> >>>> create mode 100644 include/sys/cdefs.h
> >>>I'm pretty sure that the last three times sys/cdefs.h was proposed,
> >>>it was rejected.
> >>Unfortunately many packages (wrongly?) use to rely on macros defined there,
> >I've found it's really very few; an equivalent sys/cdefs.h does not
> >exist on most systems. It was never intended for use by applications;
> >it's an internal part of glibc (and perhaps also some BSDs?) used for
> >handling backwardsness like pre-ANSI C compilers (abstracting const
> >away as __const, or abstracting away prototypes with __P()) and
> >optional use of GCC-specific features.
>
> But applications borrowed from systems internal and ported to others
> systems tend to use these macros (libtirpc, libbsd come in mind).
> Major BSD systems have it (FreeBSD, NetBSD, OpenBSD, PCBSD), it not
> a reason to have it on linux systems but it helps/simplifies packages porting
> from these OS.
As it stands, these libraries/apps won't work anywhere but GNU/Linux
(by "GNU/" I mean glibc-based) or BSD. If the offending code is
removed and replaced with what should be there, they'd be a lot more
portable. So I would not say sys/cdefs.h aids in porting them; I'd say
its presence gives these libs/apps a way to be lazy and
non-portable...
> >For things like 'extern "C"', there's no reason to use sys/cdefs.h;
> >the just writing the code it expands to inline is much more
> >clear/informative and provides better performance as a nice side
> >effect.
> >
> >>sometimes indirectly via <features.h>.
> >I don't see what you mean by this.
>
> some applications use <features.h> to get macros defined in <sys/cdefs.h>
> as on glibc, eglibc, uClibc <features.h> have a #include <sys/cdefs.h>
Both of these usages are incorrect and could easily be fixed (both are
implementation-internal headers).
Rich
next prev parent reply other threads:[~2012-10-21 0:11 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-20 20:15 [PATCH 0/4] Import <netinet/ether.h> features from NetBSD Abdoulaye Walsimou Gaye
2012-10-20 20:15 ` [PATCH 1/4] Build system: give ability to install lib/crt*.o files separately Abdoulaye Walsimou Gaye
2012-10-20 23:49 ` Rich Felker
2012-10-20 20:15 ` [PATCH 2/4] Add basic sys/cdefs.h found on most unix Abdoulaye Walsimou Gaye
2012-10-20 23:18 ` Isaac Dunham
2012-10-20 23:38 ` Abdoulaye Walsimou GAYE
2012-10-20 23:38 ` Rich Felker
2012-10-21 0:13 ` Abdoulaye Walsimou GAYE
2012-10-21 0:11 ` Rich Felker [this message]
2012-10-21 0:38 ` Abdoulaye Walsimou GAYE
2012-10-21 0:39 ` John Spencer
2012-10-21 1:21 ` John Spencer
2012-10-20 23:50 ` Isaac Dunham
2012-10-20 23:44 ` Rich Felker
2012-10-20 20:15 ` [PATCH 3/4] Import BSD functions defined in <netinet/ether.h> from NetBSD Abdoulaye Walsimou Gaye
2012-10-20 23:37 ` idunham
2012-10-21 0:40 ` Abdoulaye Walsimou GAYE
2012-10-21 0:42 ` John Spencer
2012-10-21 0:41 ` Rich Felker
2012-10-21 0:52 ` Abdoulaye Walsimou GAYE
2012-10-21 0:48 ` Rich Felker
2012-10-21 0:57 ` John Spencer
2012-10-21 0:53 ` Rich Felker
2012-10-20 20:15 ` [PATCH 4/4] <netinet/ether.h>: Add GNU extensions ether_ntoa_r() and ether_aton_r() Abdoulaye Walsimou Gaye
2012-10-20 23:53 ` Rich Felker
2012-10-21 0:43 ` Abdoulaye Walsimou GAYE
2012-10-21 0:46 ` John Spencer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121021001118.GW254@brightrain.aerifal.cx \
--to=dalias@aerifal.cx \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).