Eliminate the `rlimits.h' header using scary macros.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 29 Jun 2013 13:56:57 +0000 (14:56 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 29 Jun 2013 13:56:57 +0000 (14:56 +0100)
The `rlimits.h' header is a bit of a hack, which was thought necessary
because if must assemble a list of things conditionally.  This patch
eliminates this unpleasantness by replacing it with a different hack
which is at least as nasty.

Associate with each potential limit name a macro whose value is either
`t' or `nil', indicating whether the limit is known.  This can be done
using lots of `#ifdef ... #else ... #endif' blocks.  Finally, assemble
a list macro of all of the names, whether they're known or not (because
we can't tell at this point).  The trick is that, instead of just calling
`_(...)' for each item, we call `MAYBE_CALL(_, HAVE_???_P, (...))', and
the latter uses token-pasting to dispatch on the `HAVE_???_P' flag and
conditionally invoke `_(...)'.  Thus callers can work with this as a
conventional list macro.

Of course, building all of this is monumentally tedious, so we get Emacs
to do it for us.


No differences found