C99 gas configury
Alan Modra
amodra@gmail.com
Mon Apr 5 05:55:01 GMT 2021
Also remove alloca stuff since we don't use alloca in gas nowadays.
* configure.ac: Don't check for string.h, strings.h, stdlib.h,
errno.h, limits.h, locale.h or time.h. Don't check for unlink,
remove, sbrk (unused) or setlocale. Adjust gas_test_headers.
Don't check for errno, free, malloc, realoc, sbrk, strstr, getenv
strstr, or vsnprintf declarations.
(AC_ISC_POSIX, AC_FUNC_ALLOCA, AC_C_INLINE): Don't invoke.
* as.h: Don't include alloca-conf.h, include config.h instead.
Include string.h, stdlib.h, errno.h unconditionally. Remove
various fallback declarations.
* asintl.h: Don't test HAVE_LOCALE_H.
* as.c: Don't test HAVE_SETLOCALE.
* dwarf2dbg.c: Include limits.h unconditionally.
* expr.c: Likewise.
* sb.c: Likewise.
* symbols.c: Likewise.
* config/tc-cr16.c: Likewise.
* config/tc-d30v.c: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-tic54x.c (tic54x_mlib): Call remove rather than unlink.
* config.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
diff --git a/gas/as.c b/gas/as.c
index b2684fabe51..7de8af246e1 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -1256,12 +1256,10 @@ main (int argc, char ** argv)
start_time = get_run_time ();
signal_init ();
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/gas/as.h b/gas/as.h
index 295d20ef467..6b6895479de 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -34,29 +34,15 @@
COMMON as "".
If TEST is #defined, then we are testing a module: #define COMMON as "". */
-#include "alloca-conf.h"
+#include "config.h"
/* Now, tend to the rest of the configuration. */
/* System include files first... */
#include <stdio.h>
-
-#ifdef STRING_WITH_STRINGS
-#include <string.h>
-#include <strings.h>
-#else
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#endif
-
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -65,10 +51,7 @@
#include <sys/types.h>
#endif
-#ifdef HAVE_ERRNO_H
#include <errno.h>
-#endif
-
#include <stdarg.h>
#include "getopt.h"
@@ -101,41 +84,14 @@
#ifdef NEED_DECLARATION_ENVIRON
extern char **environ;
#endif
-#ifdef NEED_DECLARATION_ERRNO
-extern int errno;
-#endif
#ifdef NEED_DECLARATION_FFS
extern int ffs (int);
#endif
-#ifdef NEED_DECLARATION_FREE
-extern void free ();
-#endif
-#ifdef NEED_DECLARATION_MALLOC
-extern void *malloc ();
-extern void *realloc ();
-#endif
-#ifdef NEED_DECLARATION_STRSTR
-extern char *strstr ();
-#endif
#if !HAVE_DECL_MEMPCPY
void *mempcpy(void *, const void *, size_t);
#endif
-#if !HAVE_DECL_VSNPRINTF
-extern int vsnprintf(char *, size_t, const char *, va_list);
-#endif
-
-/* This is needed for VMS. */
-#if ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE)
-#define unlink remove
-#endif
-
-/* Hack to make "gcc -Wall" not complain about obstack macros. */
-#if !defined (memcpy) && !defined (bcopy)
-#define bcopy(src,dest,size) memcpy (dest, src, size)
-#endif
-
#ifndef __LINE__
#define __LINE__ "unknown"
#endif /* __LINE__ */
diff --git a/gas/asintl.h b/gas/asintl.h
index 1bc1dd5adea..8fcbbf07ea8 100644
--- a/gas/asintl.h
+++ b/gas/asintl.h
@@ -20,18 +20,16 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#ifdef HAVE_LOCALE_H
-# ifndef ENABLE_NLS
- /* The Solaris version of locale.h always includes libintl.h. If we have
- been configured with --disable-nls then ENABLE_NLS will not be defined
- and the dummy definitions of bindtextdomain (et al) below will conflict
- with the definitions in libintl.h. So we define these values to prevent
- the bogus inclusion of libintl.h. */
-# define _LIBINTL_H
-# define _LIBGETTEXT_H
-# endif
-# include <locale.h>
+#ifndef ENABLE_NLS
+ /* The Solaris version of locale.h always includes libintl.h. If we have
+ been configured with --disable-nls then ENABLE_NLS will not be defined
+ and the dummy definitions of bindtextdomain (et al) below will conflict
+ with the definitions in libintl.h. So we define these values to prevent
+ the bogus inclusion of libintl.h. */
+# define _LIBINTL_H
+# define _LIBGETTEXT_H
#endif
+#include <locale.h>
#ifdef ENABLE_NLS
# include <libintl.h>
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index 1f6b1fe8b6d..cbe113ef093 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -26,9 +26,7 @@
#include "opcode/cr16.h"
#include "elf/cr16.h"
-#ifdef HAVE_LIMITS_H
#include <limits.h>
-#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c
index 1fb078662fa..957182ac2aa 100644
--- a/gas/config/tc-d30v.c
+++ b/gas/config/tc-d30v.c
@@ -31,10 +31,7 @@ const char *md_shortopts = "OnNcC";
const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "dD";
-#if HAVE_LIMITS_H
#include <limits.h>
-#endif
-
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 235bac075dd..b6d43b5f617 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -32,17 +32,7 @@
#include "dw2gencfi.h"
#include "elf/x86-64.h"
#include "opcodes/i386-init.h"
-
-#ifdef HAVE_LIMITS_H
#include <limits.h>
-#else
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifndef INT_MAX
-#define INT_MAX (int) (((unsigned) (-1)) >> 1)
-#endif
-#endif
#ifndef INFER_ADDR_PREFIX
#define INFER_ADDR_PREFIX 1
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index c1008c2b0bd..045abaf7357 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -51,10 +51,7 @@
#include "elf/ia64.h"
#include "bfdver.h"
#include <time.h>
-
-#ifdef HAVE_LIMITS_H
#include <limits.h>
-#endif
#define NELEMS(a) ((int) (sizeof (a)/sizeof ((a)[0])))
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index f0ac732b11e..783c3be83e1 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -2357,7 +2357,7 @@ tic54x_mlib (int ignore ATTRIBUTE_UNUSED)
fclose (ftmp);
free (buf);
input_scrub_insert_file (fname);
- unlink (fname);
+ remove (fname);
}
}
diff --git a/gas/configure.ac b/gas/configure.ac
index 6a96bb70d7d..78efba88e23 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -29,7 +29,6 @@ dnl we specify this explicitly, automake-1.7 will assume that ylwrap is in
dnl gas/ instead of gas/../.
AC_CONFIG_AUX_DIR(..)
AC_CANONICAL_TARGET
-AC_ISC_POSIX
AM_INIT_AUTOMAKE
@@ -941,8 +940,7 @@ AM_MAINTAINER_MODE
AM_CONDITIONAL(GENINSRC_NEVER, false)
AC_EXEEXT
-AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h errno.h sys/types.h limits.h locale.h time.h sys/stat.h)
-ACX_HEADER_STRING
+AC_CHECK_HEADERS(memory.h sys/stat.h sys/types.h unistd.h)
# Put this here so that autoconf's "cross-compiling" message doesn't confuse
# people who are not cross-compiling but are compiling cross-assemblers.
@@ -955,14 +953,6 @@ else
fi
AC_MSG_RESULT($cross_gas)
-dnl ansidecl.h will deal with const
-dnl AC_C_CONST
-AC_FUNC_ALLOCA
-AC_C_INLINE
-
-# VMS doesn't have unlink.
-AC_CHECK_FUNCS(unlink remove, break)
-AC_CHECK_FUNCS(sbrk setlocale)
AC_CHECK_FUNCS(strsignal)
AM_LC_MESSAGES
@@ -987,29 +977,13 @@ gas_test_headers="
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
"
-# Does errno.h declare errno, or do we have to add a separate declaration
-# for it?
-GAS_CHECK_DECL_NEEDED(errno, f, int f, [
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-])
-
AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
AC_CACHE_VAL(gas_cv_decl_getopt_unistd_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
@@ -1022,12 +996,8 @@ fi
GAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
GAS_CHECK_DECL_NEEDED(ffs, f, int (*f)(int), $gas_test_headers)
-GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
-GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
-GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
-GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
-AC_CHECK_DECLS([free, getenv, malloc, mempcpy, realloc, stpcpy, strstr, vsnprintf, asprintf])
+AC_CHECK_DECLS([asprintf, mempcpy, stpcpy])
BFD_BINARY_FOPEN
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 24c3560f6f4..460daaa5c0c 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -30,18 +30,7 @@
#include "as.h"
#include "safe-ctype.h"
-
-#ifdef HAVE_LIMITS_H
#include <limits.h>
-#else
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifndef INT_MAX
-#define INT_MAX (int) (((unsigned) (-1)) >> 1)
-#endif
-#endif
-
#include "dwarf2dbg.h"
#include <filenames.h>
diff --git a/gas/expr.c b/gas/expr.c
index 4d7b2ce380d..aabd33c84f9 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -28,9 +28,7 @@
#include "as.h"
#include "safe-ctype.h"
-#ifdef HAVE_LIMITS_H
#include <limits.h>
-#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
diff --git a/gas/sb.c b/gas/sb.c
index 44c0a16d60a..08ed8916feb 100644
--- a/gas/sb.c
+++ b/gas/sb.c
@@ -24,9 +24,7 @@
#include "as.h"
#include "sb.h"
-#ifdef HAVE_LIMITS_H
#include <limits.h>
-#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
diff --git a/gas/symbols.c b/gas/symbols.c
index f3632f13200..12216800edb 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -26,9 +26,7 @@
#include "subsegs.h"
#include "write.h"
-#ifdef HAVE_LIMITS_H
#include <limits.h>
-#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list