bug-gnulib
[Top][All Lists]
Advanced

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

gettext.h and C++


From: Eric Blake
Subject: gettext.h and C++
Date: Wed, 03 Nov 2010 16:32:37 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.1.6-1.fc14 Mnenhy/0.8.3 Thunderbird/3.1.6

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   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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