Version: (using KDE KDE 3.4.0) Installed from: Compiled From Sources Compiler: gcc 3.4.3 OS: Solaris Compile log: make[4]: Entering directory `/home/contrib/src/konstruct/kde/kdebindings/work/kdebindings-3.4.0/smoke/qt' creating libsmokeqt_la.all_cpp.cpp ... ... In file included from libsmokeqt_la.all_cpp.cpp:10: x_8.cpp: In static member function `static void x_QGlobalSpace::x_274(Smoke::StackItem*)': x_8.cpp:2170: error: ISO C++ forbids declaration of `type name' with no type x_8.cpp:2170: error: ISO C++ forbids declaration of `type name' with no type x_8.cpp:2170: error: expected primary-expression before "const" x_8.cpp:2170: error: expected `)' before "const" x_8.cpp:2170: error: expected `)' before ';' token x_8.cpp: In static member function `static void x_QGlobalSpace::x_275(Smoke::StackItem*)': x_8.cpp:2175: error: ISO C++ forbids declaration of `type name' with no type x_8.cpp:2175: error: ISO C++ forbids declaration of `type name' with no type x_8.cpp:2175: error: expected primary-expression before "const" x_8.cpp:2175: error: expected `)' before "const" x_8.cpp:2175: error: expected `)' before ';' token
On Saturday 16 April 2005 00:01, Joachim Feise wrote: [bugs.kde.org quoted mail] Please can you post the actal code that doesn't compile? I can't tell what the problem is from just the error message. -- Richard
The actual code causing the problem: static void x_274(Smoke::Stack x) { // operator+(const QString&, const std::string&) const QString xret = (*(const QString *)x[1].s_voidp + *(const std::string *)x[2].s_voidp); x[0].s_voidp = (void*)new QString(xret); } static void x_275(Smoke::Stack x) { // operator+(const std::string&, const QString&) const QString xret = (*(const std::string *)x[1].s_voidp + *(const QString *)x[2].s_voidp); x[0].s_voidp = (void*)new QString(xret); }
On Saturday 16 April 2005 01:54, Joachim Feise wrote: [bugs.kde.org quoted mail] It looks as though the header for std::string doesn't get included on Solaris. But I really can't see any use for being able to convert between QStrings and std::strings in a language binding - it would only make sense if you were writing a program in C++. So the best solution is probably to not generate bindings for any methods containing std::strings. -- Richard
CVS commit by rdale: * Don't generate bindings for any methods with std::string args, as the code doesn't build on Solaris CCBUG:103988 M +1 -0 kalyptusCxxToSmoke.pm 1.112 --- kdebindings/kalyptus/kalyptusCxxToSmoke.pm #1.111:1.112 @@ -551,4 +551,5 @@ or $arg->{ArgType} eq 'FILE*' # won't be able to handle that I think or $arg->{ArgType} eq 'const KKeyNative&' # + or $arg->{ArgType} =~ 'std::string' # or $arg->{ArgType} =~ /Node\s*\*/ # ) {
> I really can't see any use for being able to convert between QStrings and > std::strings in a language binding Right. But the fix also removes any method that takes a std::string - even one where there would be no QString equivalent for the method... In Qt/KDE this is unlikely, just wondering about people who would want to use smoke to wrap other libs. I wonder if a missing #include <string> was the problem.
CVS commit by rdale: * After a comment by David Faure that it wasn'\''t a good idea to always skip methods with std::string args, now only methods within '\''#ifndef QT_NO_STL .. #endif'\'' will be skipped. The should be a better fix for bug 103988. CCBUG:103988 M +2 -1 kalyptus 1.93 M +0 -1 kalyptusCxxToSmoke.pm 1.113 --- kdebindings/kalyptus/kalyptus #1.92:1.93 @@ -576,4 +576,5 @@ ($p =~ m/^#\s*if\s+defined\(_WS_MAC_/ and $qt_embedded) or ($p =~ m/^#\s*if\s+defined\(Q_INCOMPATIBLE_3_0_ADDONS/ and $qt_embedded) or + $p =~ m/^#\s*ifndef\s+QT_NO_STL/ or $p =~ m/^#\s*if\s+defined\s*\(Q_OS_/ or $p =~ m/^#\s*if\s+defined\(Q_CC_/ or --- kdebindings/kalyptus/kalyptusCxxToSmoke.pm #1.112:1.113 @@ -551,5 +551,4 @@ or $arg->{ArgType} eq 'FILE*' # won't be able to handle that I think or $arg->{ArgType} eq 'const KKeyNative&' # - or $arg->{ArgType} =~ 'std::string' # or $arg->{ArgType} =~ /Node\s*\*/ # ) {
On Saturday 16 April 2005 10:10, David Faure wrote: [bugs.kde.org quoted mail] Yes, in qstring.h '<string>' is only included if QT_NO_STL wasn't defined: #ifndef QT_NO_STL #if defined ( Q_CC_MSVC_NET ) && _MSV_VER < 1310 // Avoids nasty warning for xlocale, line 450 # pragma warning ( push ) # pragma warning ( disable : 4189 ) # include <string> # pragma warning ( pop ) #else # include <string> #endif #if defined(Q_WRONG_SB_CTYPE_MACROS) && defined(_SB_CTYPE_MACROS) #undef _SB_CTYPE_MACROS #endif #endif Then the two concatenate methods were defined: #ifndef QT_NO_STL Q_EXPORT inline const QString operator+(const QString& s1, const std::string& s2) { return s1 + QString(s2); } Q_EXPORT inline const QString operator+(const std::string& s1, const QString& s2) { QString tmp(s2); return QString(tmp.prepend(s1)); } #endif So kalyptus wasn't skipping over the '#ifndef QT_NO_STL', and was including the concatenate methods. So I'll fix kalyptus so it skips over the #ifndef instead just ditching any method with a std::string arg type. A better fix would be to include a configuration check for whether or not Qt had been built with STL support or not, and conditionally skip stuff like the above. -- Richard
I applied the fix from http://bugs.kde.org/show_bug.cgi?id=103988#c6 and it compiles fine now. Thanks.
On Saturday 16 April 2005 13:59, Richard Dale wrote: > So I'll fix kalyptus so it skips over the #ifndef > instead just ditching any method with a std::string arg type. Good fix, thanks very much.
should be marked as fixed then.