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]

fixincludes patch for AIX



On this powerpc-ibm-aix4.3.3.0 machine, the file /usr/include/stdio.h
contains:

#if (_XOPEN_SOURCE == 500)
extern int      vsnprintf(char *, size_t, const char *, va_list);
#endif /* _XOPEN_SOURCE == 500 */
#else
#define _HIDDEN_VA_LIST         /* define a type not in the namespace */
#include <va_list.h>
extern int      vfprintf(FILE *, const char *, __va_list);
extern int      vprintf(const char *, __va_list); 
extern int      vsprintf(char *, const char *, __va_list);
#if (_XOPEN_SOURCE == 500)
extern int      vsnprintf(char *, size_t, const char *, __va_list);
#endif /* _XOPEN_SOURCE == 500 */
#endif /* _VA_LIST */

and the file <va_list.h> contains:

#if     !defined(_HIDDEN_VA_LIST) && !defined(_VA_LIST)
#define _VA_LIST
typedef char *va_list;

#elif   defined(_HIDDEN_VA_LIST) && !defined(_VA_LIST)
#define _VA_LIST
typedef char *__va_list;

#elif   defined(_HIDDEN_VA_LIST) && defined(_VA_LIST)
#undef _HIDDEN_VA_LIST
typedef __va_list va_list;

#endif

which does not work in gcc 2.96, because 'char *' is not considered
the same type as '__builtin_va_list' (even though they really are the
same).

To fix this, I tried this patch, which seems to work, although I'm not
completely sure I understand what's going on in the AIX headers.  OK
to commit?

I haven't included the (rather boring) diffs for generated files.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File
/mnt/celeste/home/geoffk/patches/egcs-aix-valist-notget.patch===
1999-12-29  Geoff Keating  <geoffk@cygnus.com>

	* fixinc/inclhack.def: Don't allow AIX to define its own
	version of va_list.
	* fixinc/fixincl.sh: Regenerated.
	* fixinc/fixincl.x: Regenerated.
	* fixinc/inclhack.sh: Regenerated.

Index: gcc/fixinc/inclhack.def
===================================================================
RCS file: /cvs/gcc/egcs/gcc/fixinc/inclhack.def,v
retrieving revision 1.44
diff -u -r1.44 inclhack.def
--- inclhack.def	1999/12/17 21:49:30	1.44
+++ inclhack.def	1999/12/29 20:57:06
@@ -477,6 +477,21 @@
 
 
 /*
+ *  This is the AIX version of varargs breakage.
+ */
+fix = {
+    hackname = aix_varargs;
+    files    = va_list.h;
+    replace  = "/* This file was generated by fixincludes.  */\n"
+	       "#if   defined(_HIDDEN_VA_LIST)\n"
+	       "#define __need___va_list\n"
+	       "#undef _HIDDEN_VA_LIST\n"
+	       "#endif\n"
+	       "#include <stdarg.h>\n";
+};
+
+
+/*
  *  sys/signal.h on some versions of AIX uses volatile in the typedef of
  *  sig_atomic_t, which causes gcc to generate a warning about duplicate
  *  volatile when a sig_atomic_t variable is declared volatile, as
============================================================


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