This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

#undef fopen+freopen prior to #def in system.h, for aix bootstrap


bootstrap currently fails for mainline on AIX, first because of problems like

 ...trunk/libcpp/system.h:47:0: error: "fopen" redefined [-Werror]
 .../include-fixed/stdio.h:110:0: note: this is the location of the previous definition

Indeed, libcpp/system and gcc/system.h have

  /* Use the unlocked open routines from libiberty.  */
  ...
  #define fopen(PATH,MODE) fopen_unlocked(PATH,MODE)
  #define fdopen(FILDES,MODE) fdopen_unlocked(FILDES,MODE)
  #define freopen(PATH,MODE,STREAM) freopen_unlocked(PATH,MODE,STREAM)

while /usr/include/stdio.h on AIX (5.3 at least) has

  #ifdef _LARGE_FILES
  ...
  #define fopen fopen64
  #define freopen freopen64

gcc/system.h already has some provision for this sort of mishap:

  #ifdef fopen /* fopen is a #define on VMS.  */
  #undef fopen
  #endif

The attached patch is a suggestion to simplify and widen this a bit
to catch all the AIX related problems to date.

Tested by checking that bootstrap proceeds (and ends successfully
after another change, to be posted shortly) on powerpc-ibm-aix5.3.0
with languages=all,ada. Also bootstrapped on i686-suse-linux.

OK ?

Thanks in advance,

Regards,

Olivier

--

2011-12-23  Olivier Hainque  <hainque@adacore.com>

	* system.h: #undef fopen and freopen unconditionally.

libcpp/
	* system.h: #undef fopen and freopen unconditionally.


Attachment: aix-redef.dif
Description: video/dv


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]