PR32243, NAME_MAX does not exist on mingw-w64 without _POSIX_

Message ID ZwX_gwKyJgIDlg95@squeak.grove.modra.org
State New
Headers
Series PR32243, NAME_MAX does not exist on mingw-w64 without _POSIX_ |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 warning Patch is already merged

Commit Message

Alan Modra Oct. 9, 2024, 3:58 a.m. UTC
  PR 32243
	* dlltool.c: Move forward decls.  Delete unnecessary ones.
	(bfd_errmsg): Delete macro, define as inline function.
	(PATHMAX): Delete.
	(NAME_MAX): Define.
  

Patch

diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 9acd080b7b6..17e9416a7f1 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -271,16 +271,8 @@ 
 #define PAGE_MASK ((bfd_vma) (- COFF_PAGE_SIZE))
 #endif
 
-/* Get current BFD error message.  */
-#define bfd_get_errmsg() (bfd_errmsg (bfd_get_error ()))
-
-/* Forward references.  */
-static char *look_for_prog (const char *, const char *, int);
-static char *deduce_name (const char *);
-
-#ifdef DLLTOOL_MCORE_ELF
-static void mcore_elf_cache_filename (const char *);
-static void mcore_elf_gen_out_file (void);
+#ifndef NAME_MAX
+#define NAME_MAX	255
 #endif
 
 #ifdef HAVE_SYS_WAIT_H
@@ -483,9 +475,6 @@  static char * mcore_elf_linker_flags = NULL;
 #define DRECTVE_SECTION_NAME ".drectve"
 #endif
 
-/* What's the right name for this ?  */
-#define PATHMAX 250
-
 /* External name alias numbering starts here.  */
 #define PREFIX_ALIAS_BASE	20000
 
@@ -805,8 +794,9 @@  struct string_list
 
 static struct string_list *excludes;
 
+/* Forward references.  */
+static char *deduce_name (const char *);
 static const char *xlate (const char *);
-static bfd *make_delay_head (void);
 static void dll_name_list_free_contents (dll_name_list_node_type *);
 static void identify_search_archive
   (bfd *, void (*) (bfd *, bfd *, void *),  void *);
@@ -814,6 +804,18 @@  static void identify_search_member (bfd *, bfd *, void *);
 static void identify_search_section (bfd *, asection *, void *);
 static void inform (const char *, ...) ATTRIBUTE_PRINTF_1;
 
+#ifdef DLLTOOL_MCORE_ELF
+static void mcore_elf_cache_filename (const char *);
+static void mcore_elf_gen_out_file (void);
+#endif
+
+/* Get current BFD error message.  */
+static inline const char *
+bfd_get_errmsg (void)
+{
+  return bfd_errmsg (bfd_get_error ());
+}
+
 static char *
 prefix_encode (char *start, unsigned code)
 {
@@ -2778,7 +2780,7 @@  make_head (void)
   return abfd;
 }
 
-bfd *
+static bfd *
 make_delay_head (void)
 {
   FILE *f = fopen (TMP_HEAD_S, FOPEN_WT);