Bug: rename.c - bucomm.h included before sys/stat.h
Alan Modra
amodra@gmail.com
Thu Feb 9 04:50:00 GMT 2012
On Tue, Feb 07, 2012 at 02:15:08PM -0800, Rene Sugar wrote:
> In binutils-2.22/binutils/rename.c, bucomm.h is included before sys/stat.h.
>
> bucomm.h uses a structure from sys/stat.h resulting in a compile
> error under gcc 4.7.
Not for me. On Linux I get sys/stat.h pulled in via fcntl.h, but yes,
this needs cleaning up.
* sysdep.h: Include sys/stat.h here.
* ar.c: Don't include headers already included by sysdep.h.
* bucomm.c: Likewise.
* budbg.h: Likewise.
* dlltool.h: Likewise.
* elfedit.c: Likewise.
* nlmconv.c: Likewise.
* objcopy.c: Likewise.
* objdump.c: Likewise.
* objdump.h: Likewise.
* readelf.c: Likewise.
* rename.c: Likewise.
* resrc.c: Likewise.
* strings.c: Likewise.
* windres.c: Likewise.
* od-macho.c: Ensure #include sysdep.h is first.
* od-xcoff.c: Likewise.
* dllwrap.c: Remove alloca pragma handled by sysdep.h, and
remove duplicate headers.
* dlltool.c: Likewise and ensure #include sysdep.h is first.
Index: binutils/ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.83
diff -u -p -r1.83 ar.c
--- binutils/ar.c 1 Feb 2012 16:49:25 -0000 1.83
+++ binutils/ar.c 9 Feb 2012 03:55:38 -0000
@@ -37,7 +37,6 @@
#include "filenames.h"
#include "binemul.h"
#include "plugin.h"
-#include <sys/stat.h>
#ifdef __GO32___
#define EXT_NAME_LEN 3 /* Bufflen of addition to name if it's MS-DOS. */
Index: binutils/bucomm.c
===================================================================
RCS file: /cvs/src/src/binutils/bucomm.c,v
retrieving revision 1.44
diff -u -p -r1.44 bucomm.c
--- binutils/bucomm.c 13 Oct 2011 15:33:32 -0000 1.44
+++ binutils/bucomm.c 9 Feb 2012 03:55:38 -0000
@@ -1,6 +1,6 @@
/* bucomm.c -- Bin Utils COMmon code.
Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002,
- 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -29,7 +29,6 @@
#include "filenames.h"
#include "libbfd.h"
-#include <sys/stat.h>
#include <time.h> /* ctime, maybe time_t */
#include <assert.h>
#include "bucomm.h"
Index: binutils/budbg.h
===================================================================
RCS file: /cvs/src/src/binutils/budbg.h,v
retrieving revision 1.9
diff -u -p -r1.9 budbg.h
--- binutils/budbg.h 2 Sep 2009 07:22:31 -0000 1.9
+++ binutils/budbg.h 9 Feb 2012 03:55:38 -0000
@@ -1,5 +1,5 @@
/* budbg.c -- Interfaces to the generic debugging information routines.
- Copyright 1995, 1996, 2002, 2003, 2005, 2007, 2008
+ Copyright 1995, 1996, 2002, 2003, 2005, 2007, 2008, 2012
Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
@@ -23,8 +23,6 @@
#ifndef BUDBG_H
#define BUDBG_H
-#include <stdio.h>
-
/* Routine used to read generic debugging information. */
extern void *read_debugging_info (bfd *, asymbol **, long, bfd_boolean);
Index: binutils/dlltool.c
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.103
diff -u -p -r1.103 dlltool.c
--- binutils/dlltool.c 13 Oct 2011 15:33:32 -0000 1.103
+++ binutils/dlltool.c 9 Feb 2012 03:55:40 -0000
@@ -1,6 +1,6 @@
/* dlltool.c -- tool to generate stuff for PE style DLLs
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -232,15 +232,6 @@
.idata$7 = dll name (eg: "kernel32.dll"). (.idata$6 for ppc). */
-/* AIX requires this to be the first thing in the file. */
-#ifndef __GNUC__
-# ifdef _AIX
- #pragma alloca
-#endif
-#endif
-
-#define show_allnames 0
-
#include "sysdep.h"
#include "bfd.h"
#include "libiberty.h"
@@ -252,8 +243,6 @@
#include "safe-ctype.h"
#include <time.h>
-#include <sys/stat.h>
-#include <stdarg.h>
#include <assert.h>
#ifdef DLLTOOL_ARM
@@ -319,6 +308,8 @@ static void mcore_elf_gen_out_file (void
#endif /* defined (_WIN32) && ! defined (__CYGWIN32__) */
#endif /* ! HAVE_SYS_WAIT_H */
+#define show_allnames 0
+
/* ifunc and ihead data structures: ttk@cygnus.com 1997
When IMPORT declarations are encountered in a .def file the
Index: binutils/dlltool.h
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.h,v
retrieving revision 1.8
diff -u -p -r1.8 dlltool.h
--- binutils/dlltool.h 23 Oct 2009 14:53:56 -0000 1.8
+++ binutils/dlltool.h 9 Feb 2012 03:55:40 -0000
@@ -1,5 +1,6 @@
/* dlltool.h -- header file for dlltool
- Copyright 1997, 1998, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2003, 2004, 2005, 2007, 2009, 2012
+ Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -18,9 +19,6 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "ansidecl.h"
-#include <stdio.h>
-
extern void def_code (int);
extern void def_data (int);
extern void def_description (const char *);
Index: binutils/dllwrap.c
===================================================================
RCS file: /cvs/src/src/binutils/dllwrap.c,v
retrieving revision 1.27
diff -u -p -r1.27 dllwrap.c
--- binutils/dllwrap.c 13 Oct 2011 15:33:32 -0000 1.27
+++ binutils/dllwrap.c 9 Feb 2012 03:55:40 -0000
@@ -1,6 +1,6 @@
/* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009,
- 2011 Free Software Foundation, Inc.
+ 2011, 2012 Free Software Foundation, Inc.
Contributed by Mumit Khan (khan@xraylith.wisc.edu).
This file is part of GNU Binutils.
@@ -20,13 +20,6 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-/* AIX requires this to be the first thing in the file. */
-#ifndef __GNUC__
-# ifdef _AIX
- #pragma alloca
-#endif
-#endif
-
#include "sysdep.h"
#include "bfd.h"
#include "libiberty.h"
@@ -35,7 +28,6 @@
#include "bucomm.h"
#include <time.h>
-#include <sys/stat.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
Index: binutils/elfedit.c
===================================================================
RCS file: /cvs/src/src/binutils/elfedit.c,v
retrieving revision 1.9
diff -u -p -r1.9 elfedit.c
--- binutils/elfedit.c 22 Jul 2011 20:22:34 -0000 1.9
+++ binutils/elfedit.c 9 Feb 2012 03:55:41 -0000
@@ -1,5 +1,5 @@
/* elfedit.c -- Update the ELF header of an ELF format file
- Copyright 2010
+ Copyright 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -19,10 +19,8 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include "config.h"
#include "sysdep.h"
#include <assert.h>
-#include <sys/stat.h>
#if __GNUC__ >= 2
/* Define BFD64 here, even if our default architecture is 32 bit ELF
Index: binutils/nlmconv.c
===================================================================
RCS file: /cvs/src/src/binutils/nlmconv.c,v
retrieving revision 1.37
diff -u -p -r1.37 nlmconv.c
--- binutils/nlmconv.c 28 Feb 2011 18:32:51 -0000 1.37
+++ binutils/nlmconv.c 9 Feb 2012 03:55:42 -0000
@@ -1,6 +1,7 @@
/* nlmconv.c -- NLM conversion program
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012
+ Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -42,8 +43,6 @@
#include "ansidecl.h"
#include <time.h>
-#include <sys/stat.h>
-#include <sys/file.h>
#include <assert.h>
#include "getopt.h"
Index: binutils/objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.153
diff -u -p -r1.153 objcopy.c
--- binutils/objcopy.c 16 Sep 2011 04:23:17 -0000 1.153
+++ binutils/objcopy.c 9 Feb 2012 03:55:43 -0000
@@ -1,6 +1,6 @@
/* objcopy.c -- copy object file from input to output, optionally massaging it.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -30,7 +30,6 @@
#include "filenames.h"
#include "fnmatch.h"
#include "elf-bfd.h"
-#include <sys/stat.h>
#include "libbfd.h"
#include "coff/internal.h"
#include "libcoff.h"
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.189
diff -u -p -r1.189 objdump.c
--- binutils/objdump.c 10 Jan 2012 11:52:27 -0000 1.189
+++ binutils/objdump.c 9 Feb 2012 03:55:45 -0000
@@ -1,7 +1,7 @@
/* objdump.c -- dump information about an object file.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+ 2012 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -71,8 +71,6 @@
#include <sys/mman.h>
#endif
-#include <sys/stat.h>
-
/* Internal headers for the ELF .stab-dump code - sorry. */
#define BYTES_IN_WORD 32
#include "aout/aout64.h"
Index: binutils/objdump.h
===================================================================
RCS file: /cvs/src/src/binutils/objdump.h,v
retrieving revision 1.2
diff -u -p -r1.2 objdump.h
--- binutils/objdump.h 13 Dec 2011 09:13:15 -0000 1.2
+++ binutils/objdump.h 9 Feb 2012 03:55:45 -0000
@@ -1,5 +1,5 @@
/* objdump.h
- Copyright 2011 Free Software Foundation, Inc.
+ Copyright 2011, 2012 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -18,8 +18,6 @@
Foundation, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-#include <stdio.h>
-
struct objdump_private_option
{
/* Option name. */
Index: binutils/od-macho.c
===================================================================
RCS file: /cvs/src/src/binutils/od-macho.c,v
retrieving revision 1.5
diff -u -p -r1.5 od-macho.c
--- binutils/od-macho.c 20 Jan 2012 10:40:53 -0000 1.5
+++ binutils/od-macho.c 9 Feb 2012 03:55:46 -0000
@@ -19,9 +19,9 @@
Foundation, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
+#include "sysdep.h"
#include <stddef.h>
#include <time.h>
-#include "sysdep.h"
#include "safe-ctype.h"
#include "bfd.h"
#include "objdump.h"
Index: binutils/od-xcoff.c
===================================================================
RCS file: /cvs/src/src/binutils/od-xcoff.c,v
retrieving revision 1.4
diff -u -p -r1.4 od-xcoff.c
--- binutils/od-xcoff.c 28 Sep 2011 07:22:39 -0000 1.4
+++ binutils/od-xcoff.c 9 Feb 2012 03:55:46 -0000
@@ -1,5 +1,5 @@
/* od-xcoff.c -- dump information about an xcoff object file.
- Copyright 2011 Free Software Foundation, Inc.
+ Copyright 2011, 2012 Free Software Foundation, Inc.
Written by Tristan Gingold, Adacore.
This file is part of GNU Binutils.
@@ -19,9 +19,9 @@
Foundation, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
+#include "sysdep.h"
#include <stddef.h>
#include <time.h>
-#include "sysdep.h"
#include "safe-ctype.h"
#include "bfd.h"
#include "objdump.h"
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.567
diff -u -p -r1.567 readelf.c
--- binutils/readelf.c 1 Feb 2012 15:44:30 -0000 1.567
+++ binutils/readelf.c 9 Feb 2012 03:55:51 -0000
@@ -42,10 +42,8 @@
ELF file than is provided by objdump. In particular it can display DWARF
debugging information which (at the moment) objdump cannot. */
-#include "config.h"
#include "sysdep.h"
#include <assert.h>
-#include <sys/stat.h>
#include <time.h>
#ifdef HAVE_ZLIB_H
#include <zlib.h>
Index: binutils/rename.c
===================================================================
RCS file: /cvs/src/src/binutils/rename.c,v
retrieving revision 1.15
diff -u -p -r1.15 rename.c
--- binutils/rename.c 2 Sep 2009 07:22:32 -0000 1.15
+++ binutils/rename.c 9 Feb 2012 03:55:51 -0000
@@ -22,8 +22,6 @@
#include "bfd.h"
#include "bucomm.h"
-#include <sys/stat.h>
-
#ifdef HAVE_GOOD_UTIME_H
#include <utime.h>
#else /* ! HAVE_GOOD_UTIME_H */
Index: binutils/resrc.c
===================================================================
RCS file: /cvs/src/src/binutils/resrc.c,v
retrieving revision 1.39
diff -u -p -r1.39 resrc.c
--- binutils/resrc.c 25 Oct 2011 08:03:17 -0000 1.39
+++ binutils/resrc.c 9 Feb 2012 03:55:52 -0000
@@ -32,11 +32,6 @@
#include "windres.h"
#include <assert.h>
-#include <errno.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
Index: binutils/strings.c
===================================================================
RCS file: /cvs/src/src/binutils/strings.c,v
retrieving revision 1.48
diff -u -p -r1.48 strings.c
--- binutils/strings.c 25 Mar 2011 17:09:08 -0000 1.48
+++ binutils/strings.c 9 Feb 2012 03:55:53 -0000
@@ -1,6 +1,6 @@
/* strings -- print the strings of printable characters in files
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -65,7 +65,6 @@
#include "getopt.h"
#include "libiberty.h"
#include "safe-ctype.h"
-#include <sys/stat.h>
#include "bucomm.h"
#define STRING_ISGRAPHIC(c) \
Index: binutils/sysdep.h
===================================================================
RCS file: /cvs/src/src/binutils/sysdep.h,v
retrieving revision 1.7
diff -u -p -r1.7 sysdep.h
--- binutils/sysdep.h 18 Mar 2009 11:27:17 -0000 1.7
+++ binutils/sysdep.h 9 Feb 2012 03:55:53 -0000
@@ -1,6 +1,6 @@
/* sysdep.h -- handle host dependencies for binutils
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009
+ 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2012
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -69,6 +69,10 @@ extern char *strrchr ();
#endif
#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#include "binary-io.h"
#if !HAVE_DECL_STPCPY
Index: binutils/windres.c
===================================================================
RCS file: /cvs/src/src/binutils/windres.c,v
retrieving revision 1.44
diff -u -p -r1.44 windres.c
--- binutils/windres.c 2 Jun 2011 13:43:18 -0000 1.44
+++ binutils/windres.c 9 Feb 2012 03:55:53 -0000
@@ -1,6 +1,6 @@
/* windres.c -- a program to manipulate Windows resources
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
- 2009, 2011 Free Software Foundation, Inc.
+ 2009, 2011, 2012 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
Rewritten by Kai Tietz, Onevision.
@@ -45,7 +45,6 @@
#include "safe-ctype.h"
#include "obstack.h"
#include "windres.h"
-#include <sys/stat.h>
/* Used by resrc.c at least. */
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list