Bug#547798: [gettext]: gettext.h incompatible with g++ -pedantic (error: ISO C++ forbids variable length array ‘msg_ctxt_id’) (fwd)

View: New views
1 Messages — Rating Filter:   Alert me  

Bug#547798: [gettext]: gettext.h incompatible with g++ -pedantic (error: ISO C++ forbids variable length array ‘msg_ctxt_id’) (fwd)

by Santiago Vila :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello.

I received this from the Debian bug system:

---------- Forwarded message ----------
From: Jens Seidel <jensseidel@...>
To: submit@...
Date: Tue, 22 Sep 2009 11:20:39 +0200
Subject: Bug#547798: [gettext]: gettext.h incompatible with g++ -pedantic
    (error: ISO C++ forbids variable length array [UTF-8] msg_ctxt_id)

Package: gettext
Version: 0.17-7
Severity: important

Hi,

compiling
#include "/usr/share/gettext/gettext.h"

int main()
{
  return 0;
}
with g++ -pedantic results in:

/usr/share/gettext/gettext.h: In function ÿÿconst char* dcpgettext_expr(const
char*, const char*, const char*, int)ÿÿ:
/usr/share/gettext/gettext.h:201: error: ISO C++ forbids variable length
array ÿÿmsg_ctxt_idÿÿ
/usr/share/gettext/gettext.h: In function ÿÿconst char*
dcnpgettext_expr(const char*, const char*, const char*, const char*, long
unsigned int, int)ÿÿ:
/usr/share/gettext/gettext.h:247: error: ISO C++ forbids variable length
array ÿÿmsg_ctxt_idÿÿ

I work around it by using

 #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
-  (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
+  (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) && !__cplusplus \

but detecting a macro which is set in pedantic mode is probably better.

Jens