mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Remove overly presumptuous use of __STDC__ in c.h, replacing
it with configure-script tests to see whether const, inline, volatile, etc work or not. (Curiously, configure was already doing the work to see if const and inline were OK, but the results were not getting plugged into config.h :-(.)
This commit is contained in:
parent
0b874f01dd
commit
f620241d73
1153
src/configure
vendored
1153
src/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -583,8 +583,9 @@ dnl
|
|||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_TYPE_UID_T
|
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
|
AC_C_STRINGIZE
|
||||||
|
AC_TYPE_UID_T
|
||||||
AC_TYPE_MODE_T
|
AC_TYPE_MODE_T
|
||||||
AC_TYPE_OFF_T
|
AC_TYPE_OFF_T
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
@ -592,6 +593,18 @@ AC_HEADER_TIME
|
|||||||
AC_STRUCT_TM
|
AC_STRUCT_TM
|
||||||
AC_STRUCT_TIMEZONE
|
AC_STRUCT_TIMEZONE
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for signed types)
|
||||||
|
AC_TRY_COMPILE([],
|
||||||
|
[signed char c; signed short s; signed int i;],
|
||||||
|
[AC_MSG_RESULT(yes)],
|
||||||
|
[AC_DEFINE(signed, ) AC_MSG_RESULT(no)])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for volatile)
|
||||||
|
AC_TRY_COMPILE([],
|
||||||
|
[extern volatile int i;],
|
||||||
|
[AC_MSG_RESULT(yes)],
|
||||||
|
[AC_DEFINE(volatile, ) AC_MSG_RESULT(no)])
|
||||||
|
|
||||||
AC_MSG_CHECKING(for type of last arg to accept)
|
AC_MSG_CHECKING(for type of last arg to accept)
|
||||||
AC_TRY_COMPILE([#include <stdlib.h>
|
AC_TRY_COMPILE([#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
132
src/include/c.h
132
src/include/c.h
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: c.h,v 1.53 1999/03/30 01:37:28 momjian Exp $
|
* $Id: c.h,v 1.54 1999/04/02 05:10:14 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -19,11 +19,10 @@
|
|||||||
*
|
*
|
||||||
* section description
|
* section description
|
||||||
* ------- ------------------------------------------------
|
* ------- ------------------------------------------------
|
||||||
* 1) bool, true, false, TRUE, FALSE
|
* 1) bool, true, false, TRUE, FALSE, NULL
|
||||||
* 2) __STDC__, non-ansi C definitions:
|
* 2) non-ansi C definitions:
|
||||||
* Pointer typedef, NULL
|
|
||||||
* cpp magic macros
|
|
||||||
* type prefixes: const, signed, volatile, inline
|
* type prefixes: const, signed, volatile, inline
|
||||||
|
* cpp magic macros
|
||||||
* 3) standard system types
|
* 3) standard system types
|
||||||
* 4) datum type
|
* 4) datum type
|
||||||
* 5) IsValid macros for system types
|
* 5) IsValid macros for system types
|
||||||
@ -58,7 +57,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* Section 1: bool, true, false, TRUE, FALSE
|
* Section 1: bool, true, false, TRUE, FALSE, NULL
|
||||||
* ----------------------------------------------------------------
|
* ----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
@ -66,13 +65,13 @@
|
|||||||
* Boolean value, either true or false.
|
* Boolean value, either true or false.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define false ((char) 0)
|
|
||||||
#define true ((char) 1)
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#ifndef bool
|
#ifndef bool
|
||||||
typedef char bool;
|
typedef char bool;
|
||||||
#endif /* ndef bool */
|
#endif /* ndef bool */
|
||||||
#endif /* not C++ */
|
#endif /* not C++ */
|
||||||
|
#define false ((bool) 0)
|
||||||
|
#define true ((bool) 1)
|
||||||
typedef bool *BoolPtr;
|
typedef bool *BoolPtr;
|
||||||
|
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
@ -83,99 +82,43 @@ typedef bool *BoolPtr;
|
|||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#endif /* FALSE */
|
#endif /* FALSE */
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
|
||||||
* Section 2: __STDC__, non-ansi C definitions:
|
|
||||||
*
|
|
||||||
* cpp magic macros
|
|
||||||
* Pointer typedef, NULL
|
|
||||||
* type prefixes: const, signed, volatile, inline
|
|
||||||
* ----------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __STDC__ /* ANSI C */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Pointer
|
|
||||||
* Variable holding address of any memory resident object.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XXX Pointer arithmetic is done with this, so it can't be void *
|
|
||||||
* under "true" ANSI compilers.
|
|
||||||
*/
|
|
||||||
typedef char *Pointer;
|
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
/*
|
/*
|
||||||
* NULL
|
* NULL
|
||||||
* Null pointer.
|
* Null pointer.
|
||||||
*/
|
*/
|
||||||
|
#ifndef NULL
|
||||||
#define NULL ((void *) 0)
|
#define NULL ((void *) 0)
|
||||||
#endif /* !defined(NULL) */
|
#endif /* !defined(NULL) */
|
||||||
|
|
||||||
#define HAVE_ANSI_CPP /* all ANSI C compilers must have this! */
|
/* ----------------------------------------------------------------
|
||||||
#if defined(NEED_STD_HDRS)
|
* Section 2: non-ansi C definitions:
|
||||||
#undef NEED_STD_HDRS /* all ANSI systems must have
|
|
||||||
* stddef/stdlib */
|
|
||||||
#endif /* NEED_STD_HDRS */
|
|
||||||
|
|
||||||
#else /* !defined(__STDC__) *//* NOT ANSI C */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Pointer
|
|
||||||
* Variable containing address of any memory resident object.
|
|
||||||
*/
|
|
||||||
typedef char *Pointer;
|
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
/*
|
|
||||||
* NULL
|
|
||||||
* Null pointer.
|
|
||||||
*/
|
|
||||||
#define NULL 0
|
|
||||||
#endif /* !defined(NULL) */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* const
|
|
||||||
* Type modifier. Identifies read only variables.
|
|
||||||
*
|
*
|
||||||
* Example:
|
* type prefixes: const, signed, volatile, inline
|
||||||
* extern const Version RomVersion;
|
* cpp magic macros
|
||||||
|
* ----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#ifndef WIN32
|
|
||||||
#define const /* const */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* signed
|
* We used to define const, signed, volatile, and inline as empty
|
||||||
* Type modifier. Identifies signed integral types.
|
* if __STDC__ wasn't defined. Now we let configure test whether
|
||||||
|
* those keywords work; config.h defines them as empty if not.
|
||||||
*/
|
*/
|
||||||
#define signed /* signed */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* volatile
|
|
||||||
* Type modifier. Identifies variables which may change in ways not
|
|
||||||
* noticeable by the compiler, e.g. via asynchronous interrupts.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* extern volatile unsigned int NumberOfInterrupts;
|
|
||||||
*/
|
|
||||||
#define volatile /* volatile */
|
|
||||||
|
|
||||||
#endif /* !defined(__STDC__) */ /* NOT ANSI C */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CppAsString
|
* CppAsString
|
||||||
* Convert the argument to a string, using the C preprocessor.
|
* Convert the argument to a string, using the C preprocessor.
|
||||||
* CppConcat
|
* CppConcat
|
||||||
* Concatenate two arguments together, using the C preprocessor.
|
* Concatenate two arguments together, using the C preprocessor.
|
||||||
|
*
|
||||||
|
* Note: the standard Autoconf macro AC_C_STRINGIZE actually only checks
|
||||||
|
* whether #identifier works, but if we have that we likely have ## too.
|
||||||
*/
|
*/
|
||||||
#if defined(HAVE_ANSI_CPP)
|
#if defined(HAVE_STRINGIZE)
|
||||||
|
|
||||||
#define CppAsString(identifier) #identifier
|
#define CppAsString(identifier) #identifier
|
||||||
#define CppConcat(x, y) x##y
|
#define CppConcat(x, y) x##y
|
||||||
|
|
||||||
#else /* !HAVE_ANSI_CPP */
|
#else /* !HAVE_STRINGIZE */
|
||||||
|
|
||||||
#define CppAsString(identifier) "identifier"
|
#define CppAsString(identifier) "identifier"
|
||||||
|
|
||||||
@ -190,39 +133,32 @@ typedef char *Pointer;
|
|||||||
#define _priv_CppIdentity(x)x
|
#define _priv_CppIdentity(x)x
|
||||||
#define CppConcat(x, y) _priv_CppIdentity(x)y
|
#define CppConcat(x, y) _priv_CppIdentity(x)y
|
||||||
|
|
||||||
#endif /* !HAVE_ANSI_CPP */
|
#endif /* !HAVE_STRINGIZE */
|
||||||
|
|
||||||
#ifndef __GNUC__ /* GNU cc */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __GNUC__ /* GNU cc */
|
|
||||||
#define inline
|
|
||||||
/*
|
/*
|
||||||
* dummyret is used to set return values in macros that use ?: to make
|
* dummyret is used to set return values in macros that use ?: to make
|
||||||
* assignments. gcc wants these to be void, other compilers like char
|
* assignments. gcc wants these to be void, other compilers like char
|
||||||
*/
|
*/
|
||||||
#define dummyret char
|
#ifdef __GNUC__ /* GNU cc */
|
||||||
#else
|
|
||||||
#define dummyret void
|
#define dummyret void
|
||||||
|
#else
|
||||||
|
#define dummyret char
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NEED_STD_HDRS)
|
|
||||||
/*
|
|
||||||
* You're doomed. We've removed almost all of our own C library
|
|
||||||
* extern declarations because they conflict on the different
|
|
||||||
* systems. You'll have to write your own stdlib.h.
|
|
||||||
*/
|
|
||||||
#include "stdlib.h"
|
|
||||||
#else /* NEED_STD_HDRS */
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#endif /* NEED_STD_HDRS */
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* Section 3: standard system types
|
* Section 3: standard system types
|
||||||
* ----------------------------------------------------------------
|
* ----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pointer
|
||||||
|
* Variable holding address of any memory resident object.
|
||||||
|
*
|
||||||
|
* XXX Pointer arithmetic is done with this, so it can't be void *
|
||||||
|
* under "true" ANSI compilers.
|
||||||
|
*/
|
||||||
|
typedef char *Pointer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* intN
|
* intN
|
||||||
* Signed integer, EXACTLY N BITS IN SIZE,
|
* Signed integer, EXACTLY N BITS IN SIZE,
|
||||||
|
@ -302,6 +302,21 @@ extern void srandom(unsigned int seed);
|
|||||||
#undef ALIGNOF_DOUBLE
|
#undef ALIGNOF_DOUBLE
|
||||||
#undef MAXIMUM_ALIGNOF
|
#undef MAXIMUM_ALIGNOF
|
||||||
|
|
||||||
|
/* Define const as empty if your compiler doesn't grok const. */
|
||||||
|
#undef const
|
||||||
|
|
||||||
|
/* Define as your compiler's spelling of "inline", or empty if no inline. */
|
||||||
|
#undef inline
|
||||||
|
|
||||||
|
/* Define signed as empty if your compiler doesn't grok "signed char" etc */
|
||||||
|
#undef signed
|
||||||
|
|
||||||
|
/* Define volatile as empty if your compiler doesn't grok volatile. */
|
||||||
|
#undef volatile
|
||||||
|
|
||||||
|
/* Define if your cpp understands the ANSI stringizing operators in macros */
|
||||||
|
#undef HAVE_STRINGIZE
|
||||||
|
|
||||||
/* Define as the base type of the last arg to accept */
|
/* Define as the base type of the last arg to accept */
|
||||||
#undef SOCKET_SIZE_TYPE
|
#undef SOCKET_SIZE_TYPE
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#define USE_POSIX_TIME
|
#define USE_POSIX_TIME
|
||||||
#define CLASS_CONFLICT
|
#define CLASS_CONFLICT
|
||||||
#define DISABLE_XOPEN_NLS
|
#define DISABLE_XOPEN_NLS
|
||||||
#define HAVE_ANSI_CPP
|
|
||||||
#define HAS_TEST_AND_SET
|
#define HAS_TEST_AND_SET
|
||||||
typedef unsigned int slock_t;
|
typedef unsigned int slock_t;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user