bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] C++ support?


From: Bruno Haible
Subject: Re: [bug-gnulib] C++ support?
Date: Wed, 25 Oct 2006 18:11:15 +0200
User-agent: KMail/1.9.1

Karl Berry asked:
> Is supporting compilation with C++ of interest?  (I'm not arguing for
> it, just reporting it, since Nelson went to the trouble of trying it.)

Yes, it is of interest in general. Some GNU projects use C++ in addition to
C for purposes that a C compiler cannot fulfill (such as tracing assignments
of all objects of a given type) or to workaround limitations on Woe32
platforms.

> Configure environment:  CC=pgCC CXX=pgCC FC=pgf77 F77=pgf77 
> LDFLAGS="-L/usr/local/lib64 -R/usr/local/lib64"
> 
> pgCC -DHAVE_CONFIG_H -I. -I../..  -I../../intl   -g -c xalloc-die.c
> "gettext.h", line 172: error: expression must have a constant value
>     char msg_ctxt_id[msgctxt_len + msgid_len];
>                      ^
> ...
> Configure environment:  CC=sunCC CXX=sunCC CFLAGS=-xarch=amd64  
> CXXFLAGS=-xarch=amd64  LDFLAGS="-L/usr/local/lib64 -R/usr/local/lib64"
> 
> sunCC -DHAVE_CONFIG_H -I. -I../..  -I../../intl   -xarch=amd64 -c xalloc-die.c
> "gettext.h", line 172: Error: An integer constant expression is required 
> within the array subscript operator.
> "gettext.h", line 218: Error: An integer constant expression is required 
> within the array subscript operator.
> 2 Error(s) detected.

Fixed.

Bruno


2006-10-25  Bruno Haible  <address@hidden>

        * lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Define to
        false for PGI C++ and Sun C++ compilers.
        Reported by Nelson H. F. Beebe <address@hidden>.

diff -c -3 -r1.8 gettext.h
*** lib/gettext.h       17 Oct 2006 12:50:48 -0000      1.8
--- lib/gettext.h       25 Oct 2006 16:13:12 -0000
***************
*** 163,170 ****
  
  #include <string.h>
  
  #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
!   (__GNUC__ >= 3 || defined __cplusplus)
  
  #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
  #include <stdlib.h>
--- 163,174 ----
  
  #include <string.h>
  
+ /* GCC supports variable-size arrays in C and C++ mode.
+    ISO C++ supports variable-size arrays, but some older PGI and Sun compilers
+    don't.  */
  #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
!   (__GNUC__ >= 3 \
!    || (defined __cplusplus && !(defined __PGI || defined __SUNPRO_CC)))
  
  #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
  #include <stdlib.h>




reply via email to

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