From 68a4f8c990f4ad0d031bd22a1f4af35437a0856a Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 29 Dec 2015 23:00:33 +0000 Subject: [PATCH] Remove `SOD_CAR' from the public interface. It's now called `SOD__CAR', no longer documented, and in a new, clearly marked `preliminaries utilities' section of the header file. This new section precedes the header-file inclusions because they can in principle depend on the definitions made here. This macro probably won't change, but I reserve the right to make the internal utilities be weird in ways which won't break the way Sod uses them, but might break other things which rely on them. --- doc/runtime.tex | 11 ----------- lib/sod.3 | 17 ----------------- lib/sod.h | 26 ++++++++++++++------------ src/class-output.lisp | 2 +- 4 files changed, 15 insertions(+), 41 deletions(-) diff --git a/doc/runtime.tex b/doc/runtime.tex index 487bcee..6f5c6be 100644 --- a/doc/runtime.tex +++ b/doc/runtime.tex @@ -87,17 +87,6 @@ general use. @|SOD_INSTBASE| macro (described below) is more suited to general use. \end{describe} -\begin{describe}[SOD_CAR]{mac} {@ SOD_CAR(@, @^*);} - Accepts one or more arguments and expands to just its first argument, - discarding the others. - - It is only defined if the C implementation advertises support for C99. It - is used in the definitions of message convenience macros for messages which - accept a variable number of arguments but no required arguments, and is - exported because the author has found such a thing useful in other - contexts. -\end{describe} - %%%-------------------------------------------------------------------------- \section{Utility macros} \label{sec:runtime.utility} diff --git a/lib/sod.3 b/lib/sod.3 index a1d520a..e5f9096 100644 --- a/lib/sod.3 +++ b/lib/sod.3 @@ -68,10 +68,6 @@ sod \- Sensible Object Design runtime library .IB cls , .IB chead , .BI "const void *" obj ); -.br -.B SOD_CAR(\c -.IB arg , -.RB ... ); .PP .B const void *\c .B SOD_CLASSOF(\c @@ -205,19 +201,6 @@ about the dynamic type of an instance. The .B SOD_INSTBASE macro (described below) is more suited to general use. -.PP -The -.B SOD_CAR -macro accepts one or more arguments -and expands to just its first argument, -discarding the others. -It is only defined if the C implementation -advertises support for C99. -It is used in the definitions of message convenience macros -for messages which accept a variable number of arguments -but no required arguments, -and is exported because the author has found such a thing useful in -other contexts. . .SS Utility macros The following macros are expected to be useful diff --git a/lib/sod.h b/lib/sod.h index 074989d..dc85843 100644 --- a/lib/sod.h +++ b/lib/sod.h @@ -32,6 +32,20 @@ extern "C" { #endif +/*----- Preliminary utilities ---------------------------------------------*/ + +/* --- @SOD__CAR@ --- * + * + * Arguments: @...@ = a nonempty list of arguments + * + * Returns: The first argument only. + */ + +#if __STDC_VERSION__ >= 199901 +# define SOD__CAR(...) SOD__CARx(__VA_LIST__, _) +# define SOD__CARx(a, ...) a +#endif + /*----- Header files ------------------------------------------------------*/ #include @@ -125,18 +139,6 @@ struct sod_chain { ((struct cls##__ilayout *) \ ((char *)(obj) - offsetof(struct cls##__ilayout, chead))) -/* --- @SOD_CAR@ --- * - * - * Arguments: @...@ = a nonempty list of arguments - * - * Returns: The first argument only. - */ - -#if __STDC_VERSION__ >= 199901 -# define SOD_CAR(...) SOD__CARx(__VA_LIST__, _) -# define SOD__CARx(a, ...) a -#endif - /*----- Utility macros ----------------------------------------------------*/ /* --- @SOD_CLASSOF@ --- * diff --git a/src/class-output.lisp b/src/class-output.lisp index aea85d4..f47bc7e 100644 --- a/src/class-output.lisp +++ b/src/class-output.lisp @@ -168,7 +168,7 @@ raw-name))) (cond ((and (cdr args) (eq (cadr args) :ellipsis)) (setf varargsp t) - (unless in-names (setf me "SOD_CAR(__VA_ARGS__)")) + (unless in-names (setf me "SOD__CAR(__VA_ARGS__)")) (push (format nil "/*~A*/ ..." name) in-names) (push "__VA_ARGS__" out-names) (return)) -- 2.11.0