[pcre-dev] A problem with config.h.generic

Kezdőlap
Üzenet törlése
Szerző: Philip Hazel
Dátum:  
Címzett: pcre-dev
Tárgy: [pcre-dev] A problem with config.h.generic
A problem with pcre.h.generic in 8.32 has been pointed out to me, and
I'm not sure how best to deal with it. This file is provided for use by
people who build PCRE "by hand". It is created by doing a "configure"
with no options, and then massaging the result a little. An example of
the massaging is this:

/* Define to 1 if you have the <stdint.h> header file. */
#ifndef HAVE_STDINT_H         <============ Added line =============
#define HAVE_STDINT_H 1
#endif                        <============ Added line =============


I cannot now remember why this massaging is done.

Now, there's been a change in pcre_internal.h; it contains

#if defined HAVE_STDINT_H
#include <stdint.h>
#elif defined HAVE_INTTYPES_H
#include <inttypes.h>
#endif

Previously, it had

#if HAVE_STDINT_H
#include <stdint.h>
#elif HAVE_INTTYPES_H
#include <inttypes.h>
#endif

I think this patch happened because "#if HAVE_STDINT_H" gives an error
if HAVE_STDINT_H is not defined, and the autotools do indeed #undef
it when <stdint.h> does not exist.

In fact, all the conditional code in PCRE uses tests for definition
(#ifdef, #ifndef, or #if defined) rather than tests for a macro value.

The problem:

Somebody editing config.h.generic by hand, who doesn't have <stdint.h>
on there system, is quite likely to set

#define HAVE_STDINT_H 0

but of course that will not now work. This particular case can be bodged
by using #if defined HAVE_STDINT_H && HAVE_STDINT_H but I would like a
more general solution. We could:

(a) Stop massaging config.h.generic, but that would still suggest
setting the value to 0.

(b) Massage the comment in config.h.generic to say use #undef rather
than setting to 0.

(c) Modify all the tests in the code to test existence and value instead
of just existence. This might be a bit messy.

(d) Something else?

What do people think?

Philip

--
Philip Hazel