bug-gnu-utils
[Top][All Lists]
Advanced

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

BUG in libintl - gettext should not be defined as macros


From: Christian Casteyde
Subject: BUG in libintl - gettext should not be defined as macros
Date: Tue, 28 May 2002 22:53:02 +0200
User-agent: KMail/1.4.1

(also send to kdevelop team for record)

I noticed that kdevelop 3.0.1 do not compile with gcc 3.1 & gettext 0.11.2
with -O flag because :
1. this cause the __OPTIMIZE__ macro to be defined ;
2. that cause the gettexte function to be defined as a macro ;
3. that prevents code such as the following to compile if optimized :

#include <libintl.h>

class A
{
public:
        char *gettext()
        {
                return "az";
        }
};

int main(void)
{
        A a;
        a.gettext();
        return 0;
}

(compile with gcc -O1 test.cc and get :

gettext.cpp:6: parse error before `,' token
gettext.cpp:7: `char*dcgettext' redeclared as different kind of symbol
/usr/include/libintl.h:47: previous declaration of `char* dcgettext(const
   char*, const char*, int)'
gettext.cpp:7: initializer list being treated as compound expression
gettext.cpp:7: syntax error before `{' token
gettext.cpp: In function `int main()':
gettext.cpp:15: parse error before `,' token

In fact, this is legal code, gettext is not reserved and
should be used as member functions.

Such code is used in c++ file generated from lex file 
kdevelop/classparser/tokenize.l of the kdevelop project.
Definitely not a gcc 3.1 bug, nor a kdevelop one.

cc Kdevelop team for workaround
(rename member func or prevent -O on that file).

CC




reply via email to

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