1999-09-24 Jim Blandy <jimb@zwingli.cygnus.com>

* acspecific.m4 (AC_C_VOLATILE): New test.
	* acconfig.h: Add new entry for `volatile'.
	* autoconf.texi (C Compiler Characteristics): Document it.
This commit is contained in:
Ben Elliston 1999-09-24 05:30:05 +00:00
parent 2c5609f43b
commit c6fc36753a
6 changed files with 97 additions and 0 deletions

View File

@ -1,3 +1,9 @@
1999-09-24 Jim Blandy <jimb@zwingli.cygnus.com>
* acspecific.m4 (AC_C_VOLATILE): New test.
* acconfig.h: Add new entry for `volatile'.
* autoconf.texi (C Compiler Characteristics): Document it.
1999-09-24 Ben Elliston <bje@cygnus.com>
* autoreconf.sh: Do not run autoheader if AC_CONFIG_HEADER is

View File

@ -35,6 +35,9 @@
/* Define to empty if the keyword does not work. */
#undef const
/* Define to empty if the volatile keyword does not work. */
#undef volatile
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END

View File

@ -2110,6 +2110,28 @@ if test $ac_cv_c_const = no; then
fi
])
dnl Note that, unlike const, #defining volatile to be the empty
dnl string can actually turn a correct program into an incorrect
dnl one, since removing uses of volatile actually grants the
dnl compiler permission to perform optimizations that could break
dnl the user's code. So, do not #define volatile away unless it is
dnl really necessary to allow the user's code to compile cleanly.
dnl Benign compiler failures should be tolerated.
AC_DEFUN(AC_C_VOLATILE,
[AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
[AC_TRY_COMPILE(,
changequote(<<, >>)dnl
<<
volatile int x;
int * volatile y;
>>,
changequote([, ])dnl
ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])
if test $ac_cv_c_volatile = no; then
AC_DEFINE(volatile, )
fi
])
AC_DEFUN(AC_C_STRINGIZE, [
AC_REQUIRE([AC_PROG_CPP])
AC_MSG_CHECKING([for preprocessor stringizing operator])

View File

@ -2721,6 +2721,28 @@ that don't, the @file{Makefile} or configuration header file will define
it as empty.
@end defmac
@defmac AC_C_VOLATILE
@maindex C_VOLATILE
@cvindex volatile
If the C compiler does not understand the keyword @code{volatile},
define @code{volatile} to be empty. Programs can simply use
@code{volatile} as if every C compiler supported it; for those that do
not, the @file{Makefile} or configuration header will define it as
empty.
If the correctness of your program depends on the semantics of
@code{volatile}, simply defining it to be empty does, in a sense, break
your code. However, given that the compiler does not support
@code{volatile}, you are at its mercy anyway. At least your
program will compile, when it wouldn't before.
In general, the @code{volatile} keyword is a feature of ANSI C, so you
might expect that @code{volatile} is available only when @code{__STDC__}
is defined. However, Ultrix 4.3's native compiler does support
volatile, but does not defined @code{__STDC__}.
@end defmac
@defmac AC_C_INLINE
@maindex C_INLINE
@cvindex inline

View File

@ -2721,6 +2721,28 @@ that don't, the @file{Makefile} or configuration header file will define
it as empty.
@end defmac
@defmac AC_C_VOLATILE
@maindex C_VOLATILE
@cvindex volatile
If the C compiler does not understand the keyword @code{volatile},
define @code{volatile} to be empty. Programs can simply use
@code{volatile} as if every C compiler supported it; for those that do
not, the @file{Makefile} or configuration header will define it as
empty.
If the correctness of your program depends on the semantics of
@code{volatile}, simply defining it to be empty does, in a sense, break
your code. However, given that the compiler does not support
@code{volatile}, you are at its mercy anyway. At least your
program will compile, when it wouldn't before.
In general, the @code{volatile} keyword is a feature of ANSI C, so you
might expect that @code{volatile} is available only when @code{__STDC__}
is defined. However, Ultrix 4.3's native compiler does support
volatile, but does not defined @code{__STDC__}.
@end defmac
@defmac AC_C_INLINE
@maindex C_INLINE
@cvindex inline

View File

@ -2110,6 +2110,28 @@ if test $ac_cv_c_const = no; then
fi
])
dnl Note that, unlike const, #defining volatile to be the empty
dnl string can actually turn a correct program into an incorrect
dnl one, since removing uses of volatile actually grants the
dnl compiler permission to perform optimizations that could break
dnl the user's code. So, do not #define volatile away unless it is
dnl really necessary to allow the user's code to compile cleanly.
dnl Benign compiler failures should be tolerated.
AC_DEFUN(AC_C_VOLATILE,
[AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
[AC_TRY_COMPILE(,
changequote(<<, >>)dnl
<<
volatile int x;
int * volatile y;
>>,
changequote([, ])dnl
ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])
if test $ac_cv_c_volatile = no; then
AC_DEFINE(volatile, )
fi
])
AC_DEFUN(AC_C_STRINGIZE, [
AC_REQUIRE([AC_PROG_CPP])
AC_MSG_CHECKING([for preprocessor stringizing operator])