Eric Blake wrote: > According to Eric Blake on 12/23/2009 2:45 PM: >>> Possibility 1: Put the SIGNATURE_CHECK into a file tests/signature.h, and >>> put >>> ASSERT, SIZEOF and a few others into tests/macros.h. A test looks like this: >>> >> >> It's less work for me if we go with possibility 2, but I have no qualms with >> the work to go with possibility 1. Either way we create macros.h and put >> ASSERT there, and the creation of macros.h is now decoupled from my signature >> check macro. The difference all boils down to whether SIGNATURE_CHECK is in >> its own header ("signature.h", affecting only the unit tests that include >> it), >> or whether it is in a common header (<config.h>, and probably should be named >> _GL_SIGNATURE_CHECK to avoid pollution, since config.h is also included by >> the >> actual project). I'm 55-45 for going with option 1. Anyone else want to >> speak >> up? > > I'm pushing this. The patch is largely a mechanical update to prior > versions, so the attached is only a subset showing how the new file > tests/signature.h fits in, and why signature.h needed an include guard for > test-getopt.c. ...
Worth showing indeed. Looks fine to me. > diff --git a/tests/test-atexit.c b/tests/test-atexit.c ... > +#include "signature.h" > +SIGNATURE_CHECK (atexit, int, (void (*) (void))); > + > #include <unistd.h> > > #define TEMPFILE "t-atexit.tmp" > diff --git a/tests/test-getopt.c b/tests/test-getopt.c > index 6811a02..9502a44 100644 > --- a/tests/test-getopt.c > +++ b/tests/test-getopt.c > @@ -27,9 +27,25 @@ > > #if GNULIB_GETOPT_GNU > # include <getopt.h> > + > +# ifndef __getopt_argv_const > +# define __getopt_argv_const const > +# endif > +# include "signature.h" > +SIGNATURE_CHECK (getopt_long, int, (int, char *__getopt_argv_const *, > + char const *, struct option const *, > + int *)); > +SIGNATURE_CHECK (getopt_long_only, int, (int, char *__getopt_argv_const *, > + char const *, struct option const *, > + int *)); > + > #endif > + > #include <unistd.h> > > +#include "signature.h" > +SIGNATURE_CHECK (getopt, int, (int, char * const[], char const *)); ...