From: Mark Wooding Date: Sat, 29 Jun 2013 13:56:57 +0000 (+0100) Subject: Eliminate the `rlimits.h' header using scary macros. X-Git-Tag: 1.3.7~14 X-Git-Url: https://git.distorted.org.uk/~mdw/fwd/commitdiff_plain/1cd4a3bfdaf82f0bc0691671954b239dccb003fb?hp=1cd4a3bfdaf82f0bc0691671954b239dccb003fb Eliminate the `rlimits.h' header using scary macros. 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. ---