I'm thinking that gettext.h needs a slight tweak to work with C++.  I'm
going off a report from Nelson H. F. Beebe, who tried building m4 on a
Linux system with CC=g++:

g++  -I.     -pedantic -Wall -W -Wfloat-equal -Wshadow -Wpointer-arith
-Wcast-qu
al -Wcast-align -Wwrite-strings -Wredundant-decls -Winline -O3 -MT
c-stack.o -MD
 -MP -MF .deps/c-stack.Tpo -c -o c-stack.o c-stack.c
gettext.h: In function 'const char* dcpgettext_expr(const char*, const
char*, co
nst char*, int)':
gettext.h:210: error: ISO C++ forbids variable-size array 'msg_ctxt_id'
gettext.h: In function 'const char* dcnpgettext_expr(const char*, const
char*, const char*, const char*, long unsigned int, int)':
gettext.h:256: error: ISO C++ forbids variable-size array 'msg_ctxt_id'

g++ (GCC) 4.1.3 20070723 (prerelease)

Looking in the source, the problematic lines are guarded by:

#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS

but this macro is defined by:

#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
  (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
   /* || __STDC_VERSION__ >= 199901L */ )

I'm thinking that merely adding '&& !defined __cplusplus' in the right
place might be enough to resolve the problem, especially since the
header is already checking this macro to decide whether to use inline.

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to