bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ASSERT and SIGNATURE_CHECK macros


From: Bruno Haible
Subject: Re: ASSERT and SIGNATURE_CHECK macros
Date: Wed, 23 Dec 2009 19:57:12 +0100
User-agent: KMail/1.9.9

Hi Eric,

> that also means that test/macros.h must NOT include any system headers (so 
> that
> SIGNATURE_CHECK can be invoked after config.h, macros.h, and exactly one 
> system 
> header has been included).

Thanks for stating this so clearly. Because on the other hand, I would like
tests/macros.h to #include <stdio.h> and <stdlib.h>, so that the test author
is freed from including these just for ASSERT. And in case ASSERT is ever
changed to use <execinfo.h> or some other header files, I don't want to
change 300 test files.

So, how to resolve this contradicting requirements?

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:

   #include <config.h>

   #include <specification.h>

   #include "signature.h"
   SIGNATURE_CHECK (...);

   #include <other.h>
   #include <other2.h>
   #include "macros.h"

Possibility 2: Keep the SIGNATURE_CHECK definition in config.h, on behalf of
m4/gnulib-common.m4, and put ASSERT, SIZEOF and a few others into 
tests/macros.h.
A test looks like this:

   #include <config.h>

   #include <specification.h>

   SIGNATURE_CHECK (...);

   #include <other.h>
   #include <other2.h>
   #include "macros.h"

I've explained why possibility 1 is preferable, but now I am actually undecided.
What do you think?

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]