BUG in libintl - gettext should not be defined as macros
Christian Casteyde
casteyde.christian at free.fr
Tue May 28 21:53:02 BST 2002
(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
-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«
More information about the KDevelop
mailing list