From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: [PATCH/RFC] inline cleanup/C89 support
Date: Tue, 4 Sep 2012 13:44:23 -0400 [thread overview]
Message-ID: <20120904174423.GN27715@brightrain.aerifal.cx> (raw)
In-Reply-To: <20120904174912.5985657a@gmail.com>
On Tue, Sep 04, 2012 at 05:49:12PM +0200, philomath wrote:
> On Sun, 2 Sep 2012 12:51:26 -0400
> Rich Felker <dalias@aerifal.cx> wrote:
>
> > On Thu, Aug 30, 2012 at 03:45:34PM -0700, Isaac Dunham wrote:
> > > On Fri, 24 Aug 2012 09:53:16 +0200
> > > Szabolcs Nagy <nsz@port70.net> wrote:
> > >
> > > > * Rich Felker <dalias@aerifal.cx> [2012-08-23 22:34:25 -0400]:
> > > ...
> > > > > #if __STDC_VERSION__ >= 199901L
> > > > > #define __inline inline
> > > > > #define __restrict restrict
> > > > > #endif
> > > > >
> > > > > added near the top of headers that need to use inline and/or
> > > > > restrict.
> > > (As previously stated, it appears-per a grep of glibc-that restrict is
> > > not needed in these headers.)
> > > This patch is updated for C++:
> > >
> > > #if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
> > > #define __inline inline
> > > #endif
> > > [...]
> >
> > Committed, with minor changes.
> >
> > Rich
>
>
> Sorry for asking after the fact, but why the whole code-duplication? why not
> have an internal header (like glibc's cdefs.h) for these kind of things (inline,
> restrict, noreturn, etc) and include it where needed?
It's really a matter of weighing the costs against the benefits. The
duplication is minimal and it's not code that should require
maintenance; even if it did, maintenance would be simple pattern
replacement. On the other hand, the cost is pretty high. For compiling
small C files, the whole compile job is dominated O(# calls to open)
and adding an extra junk header just to do this trivial definition of
__inline would increase compile times measurably.
Rich
prev parent reply other threads:[~2012-09-04 17:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-23 5:07 compatability: bits/syscall.h requires C99 idunham
2012-08-23 6:11 ` [PATCH] Problem is static inline idunham
2012-08-23 6:20 ` [PATCH 2/1] " idunham
2012-08-23 6:43 ` Szabolcs Nagy
2012-08-23 6:51 ` [PATCH] " Szabolcs Nagy
2012-08-23 12:18 ` Rich Felker
2012-08-23 12:31 ` compatability: bits/syscall.h requires C99 John Spencer
2012-08-23 12:34 ` Rich Felker
2012-08-24 0:25 ` Isaac Dunham
2012-08-24 2:07 ` Rich Felker
2012-08-24 2:34 ` Rich Felker
2012-08-24 3:31 ` [PATCH/RFC] __inline for C89 compilers (take 3?) Isaac Dunham
2012-08-24 7:53 ` compatability: bits/syscall.h requires C99 Szabolcs Nagy
2012-08-30 22:45 ` [PATCH/RFC] inline cleanup/C89 support Isaac Dunham
2012-08-31 8:34 ` Szabolcs Nagy
2012-08-31 19:27 ` Isaac Dunham
2012-09-02 16:51 ` Rich Felker
2012-09-04 15:49 ` philomath
2012-09-04 17:44 ` Rich Felker [this message]
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=20120904174423.GN27715@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).