* Don't use __attribute__ if not using GNU C.

git-svn-id: svn://svn.zoy.org/elk/trunk@99 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-09-06 02:33:10 +00:00
parent f244b25ea4
commit 6000fb66f3
7 changed files with 52 additions and 9 deletions

View File

@ -353,24 +353,36 @@ AC_CHECK_LIB(gdbm, gdbm_open, ac_cv_have_gdbm=yes)
AM_CONDITIONAL(HAVE_GDBM, test "${ac_cv_have_gdbm}" = "yes")
dnl
dnl Check for available warning flags
dnl Check for available compiler features
dnl
CFLAGS_save="${CFLAGS}"
AC_CACHE_CHECK([__attribute__ ((noreturn)) support with function pointers],
[ac_cv_c_attribute_noreturn],
[ac_cv_c_attribute_noreturn=no
CFLAGS="${CFLAGS_save} -Werror"
AC_TRY_COMPILE([],
[extern void foobar() __attribute__ ((noreturn));],
[ac_cv_c_attribute_noreturn=yes])
CFLAGS="${CFLAGS_save}"])
if test "${ac_cv_c_attribute_noreturn}" != "no"; then
AC_DEFINE(HAVE_ATTRIBUTE_NORETURN, 1, Support for __attribute__((noreturn)))
fi
AC_CACHE_CHECK([if \$CC accepts -Wall],
[ac_cv_c_Wall],
[CFLAGS="-Wall ${CFLAGS_save}"
AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)])
[ac_cv_c_Wall],
[CFLAGS="-Wall ${CFLAGS_save}"
AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)])
if test "x${ac_cv_c_Wall}" != "xno"; then
CFLAGS_save="-Wall ${CFLAGS_save}"
CFLAGS_save="-Wall ${CFLAGS_save}"
fi
AC_CACHE_CHECK([if \$CC accepts -Wsign-compare],
[ac_cv_c_Wsign_compare],
[CFLAGS="-Wsign-compare ${CFLAGS_save}"
AC_TRY_COMPILE([],,ac_cv_c_Wsign_compare=yes, ac_cv_c_Wsign_compare=no)])
[ac_cv_c_Wsign_compare],
[CFLAGS="-Wsign-compare ${CFLAGS_save}"
AC_TRY_COMPILE([],,ac_cv_c_Wsign_compare=yes, ac_cv_c_Wsign_compare=no)])
if test "x${ac_cv_c_Wsign_compare}" != "xno"; then
CFLAGS_save="-Wsign-compare ${CFLAGS_save}"
CFLAGS_save="-Wsign-compare ${CFLAGS_save}"
fi
CFLAGS="${CFLAGS_save}"

View File

@ -109,8 +109,13 @@ extern Object The_Environment, Global_Environment;
/* Error handling
*/
#ifdef HAVE_ATTRIBUTE_NORETURN
extern void Primitive_Error P_((const char*, ...)) __attribute__ ((__noreturn__));
extern void Fatal_Error P_((const char*, ...)) __attribute__ ((__noreturn__));
#else
extern void Primitive_Error P_((const char*, ...));
extern void Fatal_Error P_((const char*, ...));
#endif
extern void Range_Error P_((Object));
extern void Panic P_((const char*));
extern Object P_Error P_((int, Object*));
@ -468,9 +473,14 @@ extern void Terminate_Type P_((int));
*/
extern TYPEDESCR *Types;
extern Object P_Type P_((Object));
#ifdef HAVE_ATTRIBUTE_NORETURN
extern void Wrong_Type P_((Object, int)) __attribute__ ((__noreturn__));
extern void Wrong_Type_Combination P_((Object, const char*))
__attribute__ ((__noreturn__));
#else
extern void Wrong_Type P_((Object, int));
extern void Wrong_Type_Combination P_((Object, const char*));
#endif
extern int Define_Type P_((int, const char*, int (*)(Object), int,
int (*)(Object, Object), int (*)(Object, Object),
int (*)(Object, Object, int, int, int),

View File

@ -34,8 +34,13 @@
#include "kernel.h"
#ifdef HAVE_ATTRIBUTE_NORETURN
void Reset () __attribute__ ((__noreturn__));
void Err_Handler () __attribute__ ((__noreturn__));
#else
void Reset ();
void Err_Handler ();
#endif
Object Arg_True;

View File

@ -32,7 +32,11 @@
#include <stdlib.h>
#ifdef HAVE_ATTRIBUTE_NORETURN
extern void Reset () __attribute__ ((__noreturn__));
#else
extern void Reset ();
#endif
int Intr_Was_Ignored;
unsigned long int Intr_Level;

View File

@ -120,7 +120,11 @@ void Exit_Handler () {
#ifndef HAVE_ATEXIT
/* Hack: __GNUC_MINOR__ was introduced together with __attribute__ */
#ifdef __GNUC_MINOR__
#ifdef HAVE_ATTRIBUTE_NORETURN
extern void _exit() __attribute__ ((noreturn));
#else
extern void _exit();
#endif
#endif
#ifndef PROFILING
void exit (n) {

View File

@ -55,8 +55,12 @@
extern void Switch_Environment (Object);
extern unsigned int Stack_Size ();
extern void Uncatchable_Error (char *);
#ifdef HAVE_ATTRIBUTE_NORETURN
extern void Funcall_Control_Point (Object, Object, int)
__attribute__ ((__noreturn__));
#else
extern void Funcall_Control_Point (Object, Object, int);
#endif
extern void Pop_Frame ();
extern void Push_Frame (Object);

View File

@ -52,7 +52,11 @@ extern char *index();
extern double atof();
int Skip_Comment (Object);
#ifdef HAVE_ATTRIBUTE_NORETURN
void Reader_Error (Object, char *) __attribute__ ((__noreturn__));
#else
void Reader_Error (Object, char *);
#endif
Object Sym_Quote,
Sym_Quasiquote,