public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: C99 binutils configury
Date: Mon, 5 Apr 2021 15:24:01 +0930	[thread overview]
Message-ID: <20210405055401.GI5425@bubble.grove.modra.org> (raw)
In-Reply-To: <20210405055258.GH5425@bubble.grove.modra.org>

	* configure.ac: Assume long long is available.  Don't test for
	strings.h, stdlib.h, limits.h, locale.h, or wchar.h.  Check
	inttypes.h, stdint.h, sys/stat.h and sys/types.h. Don't check for
	strcoll, setlocale, setmode or location of time_t.  Don't check
	for fprintf, getenv, snprintf, strnlen, strstr or vsnprintf decls.
	(AC_ISC_POSIX, AXC_HEADER_STRING, AC_FUNC_ALLOCA): Don't invoke.
	* sysdep.h: Don't include alloca-conf.h, include config.h instead.
	Test HAVE_SYS_TYPES_H and reorder includes.  Include limits.h,
	locale.h, string.h and stdlib.h unconditionally.  Remove various
	fallback declarations.  Assume long long is available.
	* addr2line.c: Don't test HAVE_SETLOCALE.
	* ar.c: Likewise.
	* coffdump.c: Likewise.
	* dlltool.c: Likewise.
	* dllwrap.c: Likewise.
	* elfedit.c: Likewise.
	* nm.c: Likewise.
	* objcopy.c: Likewise.
	* objdump.c: Likewise.
	* readelf.c: Likewise.
	* size.c: Likewise.
	* srconv.c: Likewise.
	* strings.c: Likewise.
	* sysdump.c: Likewise.
	* windmc.c: Likewise.
	* windres.c: Likewise.
	* bucomm.c: Don't test HAVE_TIME_T_IN_TIME_H or HAVE_TIME_T_IN_TYPES_H.
	* dwarf.c: Include limits.h unconditionally.  Assume long long
	is available.
	* nm.c: Don't test HAVE_STRCOLL.
	* readelf.c: Don't test HAVE_WCHAR_H.
	* strings.c: Assume long long is available.
	* syslex.l: Include string.h unconditionally.
	* aclocal.m4: Regenerate.
	* config.in: Regenerate.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.

diff --git a/binutils/addr2line.c b/binutils/addr2line.c
index 578c64adbd1..5b02a67567b 100644
--- a/binutils/addr2line.c
+++ b/binutils/addr2line.c
@@ -425,12 +425,10 @@ main (int argc, char **argv)
   char *target;
   int c;
 
-#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/binutils/ar.c b/binutils/ar.c
index 71bbde65ed6..5d6976c7027 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -723,12 +723,10 @@ main (int argc, char **argv)
   char *inarch_filename;
   int i;
 
-#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/binutils/bucomm.c b/binutils/bucomm.c
index 5a3eab62f98..8ce66ab8cce 100644
--- a/binutils/bucomm.c
+++ b/binutils/bucomm.c
@@ -25,16 +25,9 @@
 #include "bfd.h"
 #include "libiberty.h"
 #include "filenames.h"
-
-#include <time.h>		/* ctime, maybe time_t */
+#include <time.h>
 #include <assert.h>
 #include "bucomm.h"
-
-#ifndef HAVE_TIME_T_IN_TIME_H
-#ifndef HAVE_TIME_T_IN_TYPES_H
-typedef long time_t;
-#endif
-#endif
 \f
 /* Error reporting.  */
 
diff --git a/binutils/coffdump.c b/binutils/coffdump.c
index dd40221b45d..37274d9d44e 100644
--- a/binutils/coffdump.c
+++ b/binutils/coffdump.c
@@ -488,12 +488,10 @@ main (int ac, char **av)
       { NULL, no_argument, 0, 0 }
     };
 
-#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/binutils/configure.ac b/binutils/configure.ac
index af24c0c9a8a..ad6d2aaefad 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -23,7 +23,6 @@ AC_INIT([binutils], BFD_VERSION)
 AC_CONFIG_SRCDIR(ar.c)
 
 AC_CANONICAL_TARGET
-AC_ISC_POSIX
 
 AM_INIT_AUTOMAKE
 
@@ -162,14 +161,18 @@ esac
 AC_SUBST(DEMANGLER_NAME)
 
 AC_CHECK_SIZEOF([long])
-AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
-
-AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h)
+AC_CHECK_SIZEOF([long long])
+
+# We use headers from include/ that check various HAVE_*_H macros, thus
+# should ensure they are set by configure.  This is true even when C99
+# guarantees they are available.
+# plugin-api.h tests HAVE_STDINT_H and HAVE_INTTYPES_H
+# Besides those, we need to check anything used in binutils/ not in C99.
+AC_CHECK_HEADERS(fcntl.h inttypes.h stdint.h sys/file.h sys/param.h \
+		 sys/stat.h sys/types.h unistd.h)
 AC_HEADER_SYS_WAIT
-ACX_HEADER_STRING
-AC_FUNC_ALLOCA
 AC_FUNC_MMAP
-AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
+AC_CHECK_FUNCS(getc_unlocked sbrk utimes)
 AC_CHECK_FUNC([mkstemp],
 	      AC_DEFINE([HAVE_MKSTEMP], 1,
 	      [Define to 1 if you have the `mkstemp' function.]))
@@ -190,26 +193,6 @@ AC_SEARCH_LIBS(frexp, m)
 
 AM_LC_MESSAGES
 
-AC_MSG_CHECKING(for time_t in time.h)
-AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
-bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
-AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
-if test $bu_cv_decl_time_t_time_h = yes; then
-  AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
-	    [Is the type time_t defined in <time.h>?])
-fi
-
-AC_MSG_CHECKING(for time_t in sys/types.h)
-AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
-bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
-AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
-if test $bu_cv_decl_time_t_types_h = yes; then
-  AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
-	    [Is the type time_t defined in <sys/types.h>?])
-fi
-
 AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
 AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
@@ -236,8 +219,7 @@ if test $bu_cv_header_utime_h = yes; then
   AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
 fi
 
-AC_CHECK_DECLS([asprintf, environ, fprintf, getc_unlocked, getenv,
-		sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
+AC_CHECK_DECLS([asprintf, environ, getc_unlocked, sbrk, stpcpy])
 
 # Link in zlib if we can.  This allows us to read compressed debug
 # sections.  This is used only by readelf.c (objdump uses bfd for
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index b26c17852e3..e6fafb4dc84 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -3779,12 +3779,10 @@ main (int ac, char **av)
   program_name = av[0];
   oav = av;
 
-#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/binutils/dllwrap.c b/binutils/dllwrap.c
index bc7104de004..698f6468d6c 100644
--- a/binutils/dllwrap.c
+++ b/binutils/dllwrap.c
@@ -630,12 +630,10 @@ main (int argc, char **argv)
 
   prog_name = argv[0];
 
-#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/binutils/dwarf.c b/binutils/dwarf.c
index 293d33ec9ac..562dce5dd26 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -36,9 +36,7 @@
 #include <elfutils/debuginfod.h>
 #endif
 
-#ifdef HAVE_LIMITS_H
 #include <limits.h>
-#endif
 #ifndef CHAR_BIT
 #define CHAR_BIT 8
 #endif
@@ -215,7 +213,7 @@ get_encoded_value (unsigned char **pdata,
   return val;
 }
 
-#if defined HAVE_LONG_LONG && SIZEOF_LONG_LONG > SIZEOF_LONG
+#if SIZEOF_LONG_LONG > SIZEOF_LONG
 # ifndef __MINGW32__
 #  define DWARF_VMA_FMT		"ll"
 #  define DWARF_VMA_FMT_LONG	"%16.16llx"
diff --git a/binutils/elfedit.c b/binutils/elfedit.c
index ddcace90f3a..e33c340d758 100644
--- a/binutils/elfedit.c
+++ b/binutils/elfedit.c
@@ -959,12 +959,10 @@ main (int argc, char ** argv)
 {
   int c, status;
 
-#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/binutils/nm.c b/binutils/nm.c
index 64105ca627f..82ccec6801c 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -633,7 +633,6 @@ non_numeric_forward (const void *P_x, const void *P_y)
   if (xn == NULL)
     return -1;
 
-#ifdef HAVE_STRCOLL
   /* Solaris 2.5 has a bug in strcoll.
      strcoll returns invalid values when confronted with empty strings.  */
   if (*yn == '\0')
@@ -642,9 +641,6 @@ non_numeric_forward (const void *P_x, const void *P_y)
     return -1;
 
   return strcoll (xn, yn);
-#else
-  return strcmp (xn, yn);
-#endif
 }
 
 static int
@@ -1788,13 +1784,11 @@ main (int argc, char **argv)
   int c;
   int retval;
 
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
   setlocale (LC_MESSAGES, "");
 #endif
-#if defined (HAVE_SETLOCALE)
   setlocale (LC_CTYPE, "");
   setlocale (LC_COLLATE, "");
-#endif
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 6622adc5e7c..3b6a7e50169 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -6016,12 +6016,10 @@ copy_main (int argc, char *argv[])
 int
 main (int argc, char *argv[])
 {
-#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/binutils/objdump.c b/binutils/objdump.c
index cbbec81c026..aa1215cede8 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -5135,12 +5135,10 @@ main (int argc, char **argv)
   char *target = default_target;
   bool seenflag = false;
 
-#if defined (HAVE_SETLOCALE)
-#if defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
   setlocale (LC_MESSAGES, "");
 #endif
   setlocale (LC_CTYPE, "");
-#endif
 
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 5bc59e4c5e2..840a160ae82 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -44,9 +44,7 @@
 #include <assert.h>
 #include <time.h>
 #include <zlib.h>
-#ifdef HAVE_WCHAR_H
 #include <wchar.h>
-#endif
 
 #if __GNUC__ >= 2
 /* Define BFD64 here, even if our default architecture is 32 bit ELF
@@ -21748,12 +21746,10 @@ main (int argc, char ** argv)
 {
   int err;
 
-#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/binutils/size.c b/binutils/size.c
index 294cc0b9a44..bbd79dddcfa 100644
--- a/binutils/size.c
+++ b/binutils/size.c
@@ -134,12 +134,10 @@ main (int argc, char **argv)
   int temp;
   int c;
 
-#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/binutils/srconv.c b/binutils/srconv.c
index 8476e12b638..dab04e21c30 100644
--- a/binutils/srconv.c
+++ b/binutils/srconv.c
@@ -1722,12 +1722,10 @@ main (int ac, char **av)
   char *input_file;
   char *output_file;
 
-#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/binutils/strings.c b/binutils/strings.c
index 3ecdb929953..44a8e1da644 100644
--- a/binutils/strings.c
+++ b/binutils/strings.c
@@ -149,9 +149,7 @@ main (int argc, char **argv)
   char *s;
   int numeric_opt = 0;
 
-#if defined (HAVE_SETLOCALE)
   setlocale (LC_ALL, "");
-#endif
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
@@ -610,61 +608,42 @@ print_strings (const char *filename, FILE *stream, file_ptr address,
 	switch (address_radix)
 	  {
 	  case 8:
-#ifdef HAVE_LONG_LONG
 	    if (sizeof (start) > sizeof (long))
 	      {
-# ifndef __MSVCRT__
+#ifndef __MSVCRT__
 		printf ("%7llo ", (unsigned long long) start);
-# else
+#else
 		printf ("%7I64o ", (unsigned long long) start);
-# endif
+#endif
 	      }
 	    else
-#elif !BFD_HOST_64BIT_LONG
-	      if (start != (unsigned long) start)
-		printf ("++%7lo ", (unsigned long) start);
-	      else
-#endif
-		printf ("%7lo ", (unsigned long) start);
+	      printf ("%7lo ", (unsigned long) start);
 	    break;
 
 	  case 10:
-#ifdef HAVE_LONG_LONG
 	    if (sizeof (start) > sizeof (long))
 	      {
-# ifndef __MSVCRT__
+#ifndef __MSVCRT__
 		printf ("%7llu ", (unsigned long long) start);
-# else
+#else
 		printf ("%7I64d ", (unsigned long long) start);
-# endif
+#endif
 	      }
 	    else
-#elif !BFD_HOST_64BIT_LONG
-	      if (start != (unsigned long) start)
-		printf ("++%7lu ", (unsigned long) start);
-	      else
-#endif
-		printf ("%7ld ", (long) start);
+	      printf ("%7ld ", (long) start);
 	    break;
 
 	  case 16:
-#ifdef HAVE_LONG_LONG
 	    if (sizeof (start) > sizeof (long))
 	      {
-# ifndef __MSVCRT__
+#ifndef __MSVCRT__
 		printf ("%7llx ", (unsigned long long) start);
-# else
+#else
 		printf ("%7I64x ", (unsigned long long) start);
-# endif
+#endif
 	      }
 	    else
-#elif !BFD_HOST_64BIT_LONG
-	      if (start != (unsigned long) start)
-		printf ("%lx%8.8lx ", (unsigned long) (start >> 32),
-			(unsigned long) (start & 0xffffffff));
-	      else
-#endif
-		printf ("%7lx ", (unsigned long) start);
+	      printf ("%7lx ", (unsigned long) start);
 	    break;
 	  }
 
diff --git a/binutils/sysdep.h b/binutils/sysdep.h
index 981ec025fc7..747ff4c31ff 100644
--- a/binutils/sysdep.h
+++ b/binutils/sysdep.h
@@ -20,50 +20,21 @@
 #ifndef _BIN_SYSDEP_H
 #define _BIN_SYSDEP_H
 
-#include "alloca-conf.h"
-#include "ansidecl.h"
+#include "config.h"
 #include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
-
-#include "bfdver.h"
-
-#include <stdarg.h>
-
-#ifdef USE_BINARY_FOPEN
-#include "fopen-bin.h"
-#else
-#include "fopen-same.h"
 #endif
-
-#include <errno.h>
-#ifndef errno
-extern int errno;
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
 #endif
-
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <errno.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-
-#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>
-#else
-extern char *strchr ();
-extern char *strrchr ();
-#endif
-#endif
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #else
@@ -72,8 +43,13 @@ extern char *strrchr ();
 #endif
 #endif
 
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
+#include "ansidecl.h"
+#include "bfdver.h"
+
+#ifdef USE_BINARY_FOPEN
+#include "fopen-bin.h"
+#else
+#include "fopen-same.h"
 #endif
 
 #include "binary-io.h"
@@ -82,40 +58,16 @@ extern char *strrchr ();
 extern char *stpcpy (char *, const char *);
 #endif
 
-#if !HAVE_DECL_STRSTR
-extern char *strstr ();
-#endif
-
 #ifdef HAVE_SBRK
 #if !HAVE_DECL_SBRK
 extern char *sbrk ();
 #endif
 #endif
 
-#if !HAVE_DECL_GETENV
-extern char *getenv ();
-#endif
-
 #if !HAVE_DECL_ENVIRON
 extern char **environ;
 #endif
 
-#if !HAVE_DECL_FPRINTF
-extern int fprintf (FILE *, const char *, ...);
-#endif
-
-#if !HAVE_DECL_SNPRINTF
-extern int snprintf(char *, size_t, const char *, ...);
-#endif
-
-#if !HAVE_DECL_VSNPRINTF
-extern int vsnprintf(char *, size_t, const char *, va_list);
-#endif
-
-#if !HAVE_DECL_STRNLEN
-size_t strnlen (const char *, size_t);
-#endif
-
 #ifndef O_RDONLY
 #define O_RDONLY 0
 #endif
@@ -134,18 +86,16 @@ size_t strnlen (const char *, size_t);
 #define SEEK_END 2
 #endif
 
-#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 defintions 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 defintions 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>
@@ -175,9 +125,7 @@ size_t strnlen (const char *, size_t);
 #define BUFSIZE 8192
 
 /* For PATH_MAX.  */
-#ifdef HAVE_LIMITS_H
 #include <limits.h>
-#endif
 
 #ifndef PATH_MAX
 /* For MAXPATHLEN.  */
@@ -193,7 +141,7 @@ size_t strnlen (const char *, size_t);
 # endif
 #endif
 
-#if defined HAVE_LONG_LONG && SIZEOF_LONG_LONG > SIZEOF_LONG
+#if SIZEOF_LONG_LONG > SIZEOF_LONG
 /* We can't use any bfd types here since readelf may define BFD64 and
    objdump may not.  */
 #define HOST_WIDEST_INT	long long
diff --git a/binutils/sysdump.c b/binutils/sysdump.c
index f5c06504746..8993152bdd6 100644
--- a/binutils/sysdump.c
+++ b/binutils/sysdump.c
@@ -659,12 +659,10 @@ main (int ac, char **av)
     {NULL, no_argument, 0, 0}
   };
 
-#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/binutils/syslex.l b/binutils/syslex.l
index fc6ccea7ba6..d376e3b1b3a 100644
--- a/binutils/syslex.l
+++ b/binutils/syslex.l
@@ -22,14 +22,7 @@
 
 /* Note: config.h is #included via syslex_wrap.c.  */
 
-#ifdef HAVE_STRING_H
 #include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
 #include "sysinfo.h"
 
 #ifndef YY_NO_UNPUT
diff --git a/binutils/windmc.c b/binutils/windmc.c
index af32f3bf22c..0ae4fe9b43d 100644
--- a/binutils/windmc.c
+++ b/binutils/windmc.c
@@ -941,12 +941,10 @@ main (int argc, char **argv)
   char *target, *input_filename;
   int verbose;
 
-#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/binutils/windres.c b/binutils/windres.c
index 0fbf1f9fa5e..544cef6eb34 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -823,12 +823,10 @@ main (int argc, char **argv)
   rc_res_directory *resources;
   int use_temp_file;
 
-#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);
 

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2021-04-05  5:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05  5:50 C99 gprof configury Alan Modra
2021-04-05  5:52 ` C99 bfd configury Alan Modra
2021-04-05  5:52   ` C99 opcodes configury Alan Modra
2021-04-05  5:54     ` Alan Modra [this message]
2021-04-05  5:55       ` C99 gas configury Alan Modra
2021-04-05  5:55         ` C99 ld configury Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210405055401.GI5425@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).