multiple inclusion guard for config.h

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

 



I ran into a problem compiling some code today and one symptom of the
problem I had showed up because config.h was included multiple times.  If
there was a guard against multiple inclusion...something like:

#ifndef INCLUDED_CONFIG_H
#define INCLUDED_CONFIG_H

<what's currently in config.h>

#endif

I wouldn't have had the problem, or at least the problem would have been
masked.  In my particular case, someone was #defining int64 to __int64 (I'm
running with MS native tools).  Before that, config.h was fine, but
afterwards it choked since it's got a line like this:

/* Define on systems that have an int64_t type. */
#define HAVE_INT64_T 0

/* Define to 1 if the system has the type `__int64'. */
#define HAVE___INT64 1

/* Define to the type of a signed integer type of width exactly 64 bits if
   such a type exists and the standard includes do not define it. */
/* #undef int64_t */

/* Try to define a 64 bit integer type */
#if !HAVE_INT64_T
#ifdef HAVE___INT64
typedef __int64 int64_t;
#else
#error "no 64 bit type available"
#endif
#endif

The actual offending line is this one:

typedef __int64 int64_t;

which after the #define became

typedef __int64 __int64;

I can't decide whether I'm glad I know about this lingering problem in my
code or whether I just want it to work.  I'm leaning towards the latter.

Anyway, I could use an education about why there isn't a guard against
multiple inclusion built in to autoheader, as well as a way to add one
myself.  AH_TOP puts the first part where I want, but I've got multiple
AH_BOTTOM calls and I can't see a way to force the final #endif to really go
last in the file.

automake 1.10 (slightly patched so .deps is created properly)
autoconf 2.61

Thanks for your help.

-DB




_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux