bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gl_STDARG_H on AIX 5.3 with IBM v8 C compiler


From: Albert Chin
Subject: gl_STDARG_H on AIX 5.3 with IBM v8 C compiler
Date: Thu, 1 Feb 2007 17:57:09 -0600
User-agent: Mutt/1.5.6i

I've fetched the latest gnulib CVS and tried testing the xvasprintf
module on AIX 5.3:
  $ ./gnulib-tool --create-testdir --dir=/home/china/tmp/z xvasprintf
  $ cd /home/china/tmp/z
  $ ./configure CC=xlc --disable-dependency-tracking
  ...
  $ gmake
  ...
  $ nm -BCpg gllib/libgnu.a|grep va_copy 
           - U .va_copy

During the build, the following warnings occur:
  ...
  xlc -DHAVE_CONFIG_H -I. -I. -I..     -g -c vasnprintf.c
  "/usr/include/stdarg.h", line 89.9: 1506-236 (W) Macro name va_copy has been 
redefined.
  "/usr/include/stdarg.h", line 89.9: 1506-358 (I) "va_copy" is defined on line 
163 of ../config.h.
  xlc -DHAVE_CONFIG_H -I. -I. -I..     -g -c vasprintf.c
  "/usr/include/stdarg.h", line 89.9: 1506-236 (W) Macro name va_copy has been 
redefined.
  "/usr/include/stdarg.h", line 89.9: 1506-358 (I) "va_copy" is defined on line 
163 of ../config.h.

If I build with the C99 variant of the compiler, va_copy isn't
undefined in gllib/libgnu.a nor are there any warnings during the
build:
  $ ./configure CC=xlc CFLAGS=-qlanglvl=extc99 \
  --disable-dependency-tracking

I'm not really sure what the xlc compiler is doing with va_copy(). In
<stdarg.h>, we have:
  88: #ifdef _ISOC99_SOURCE
  89: #define va_copy(__list1,__list2) ((void)(__list1 = __list2))
  90: #endif

config.h has:
  /* A replacement for va_copy, if needed.  */
  #define gl_va_copy(a,b) ((a) = (b))

  /* Define as a macro for copying va_list variables. */
  #define va_copy gl_va_copy

config.log has:
  configure:6770: checking for va_copy
  configure:6796: xlc -c -g  conftest.c >&5
  "conftest.c", line 44.35: 1506-045 (S) Undeclared identifier va_copy.
  configure:6802: $? = 1
  ...
  configure:6855: xlc -c -g  conftest.c >&5
  "conftest.c", line 44.1: 1506-045 (S) Undeclared identifier error.
  "conftest.c", line 44.13: 1506-275 (S) Unexpected text out encountered.
  configure:6861: $? = 1


Consider compiler output for the following program:
  $ cat a.c
  #include <stdarg.h>
  va_copy(a,b)
  $ xlc -E a.c
  #line 62 "/usr/include/va_list.h"
  typedef char *va_list;
  #line 2 "a.c"
  va_copy(a,b)

  $ xlc -qlanglvl=extc99 -E a.c
  #line 62 "/usr/include/va_list.h"
  typedef char *va_list;
  #line 2 "a.c"
  __builtin_va_copy(a,b)

  $ cat b.c
  #define va_copy(a,b) (a)
  #include <stdarg.h>
  va_copy(a,b)
  $ xlc -E b.c
  "/usr/include/stdarg.h", line 89.9: 1506-236 (W) Macro name va_copy has been 
redefined.
  "/usr/include/stdarg.h", line 89.9: 1506-358 (I) "va_copy" is defined on line 
1 of b.c.
  #line 62 "/usr/include/va_list.h"
  typedef char *va_list;
  #line 3 "b.c"
  va_copy(a,b)

So, if we #define va_copy() before <stdarg.h>, it's obvious that
<stdarg.h> is redefining it. But, to what? It looks like the only way
to get the builtin va_copy() to work on AIX 5.3 is to add
-qlanglvl=extc99 to CFLAGS?

-- 
albert chin (address@hidden)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]