From: Chris Frey Date: May 4 2005 9:55am Subject: [PATCH] gcc 4.0.0 fixes List-Archive: http://lists.mysql.com/plusplus/4348 Message-Id: <20050504095555.GA20116@netdirect.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Hi there, Some fixes here that make mysql++ compile more cleanly with the new GCC 4.0.0. I'm liking this compiler so far. Seems fast too. This fixes: - some virtual destructors for classes that have virtual functions. - warnings about unused arguments - cast warnings The fixes in the .cpp files aren't that important, since it only happens once, but the .h files can affect user code. This also affects the ABI in some places (?). - Chris Index: software/mysql++/lib/datetime.h diff -u software/mysql++/lib/datetime.h:1.4 software/mysql++/lib/datetime.h:1.5 --- software/mysql++/lib/datetime.h:1.4 Mon May 2 06:25:53 2005 +++ software/mysql++/lib/datetime.h Wed May 4 04:59:10 2005 @@ -22,6 +22,8 @@ virtual std::ostream& out_stream(std::ostream&) const = 0; operator std::string (); + + virtual ~mysql_dt_base() {} }; /// \if INTERNAL @@ -37,6 +39,8 @@ bool operator <= (const T &other) const {return compare(other) <= 0;} bool operator > (const T &other) const {return compare(other) > 0;} bool operator >= (const T &other) const {return compare(other) >= 0;} + + virtual ~DTbase() {} }; /// \endif Index: software/mysql++/lib/null.h diff -u software/mysql++/lib/null.h:1.4 software/mysql++/lib/null.h:1.5 --- software/mysql++/lib/null.h:1.4 Mon May 2 06:25:53 2005 +++ software/mysql++/lib/null.h Wed May 4 04:59:10 2005 @@ -89,8 +89,8 @@ typedef void value_type; public: Null () : is_null(false) { } - Null (const null_type &n) : is_null(true) { } - Null& operator = (const null_type &n) { is_null = true; return *this; } + Null (const null_type &) : is_null(true) { } + Null& operator = (const null_type &) { is_null = true; return *this; } }; /// \endif Index: software/mysql++/lib/resiter.h diff -u software/mysql++/lib/resiter.h:1.5 software/mysql++/lib/resiter.h:1.6 --- software/mysql++/lib/resiter.h:1.5 Mon May 2 06:25:53 2005 +++ software/mysql++/lib/resiter.h Wed May 4 04:59:10 2005 @@ -56,6 +56,8 @@ reverse_iterator rbegin() const { return reverse_iterator(end()); } reverse_iterator rend() const { return reverse_iterator(begin()); } + + virtual ~const_subscript_container() {} }; Index: software/mysql++/lib/sql_query.cpp diff -u software/mysql++/lib/sql_query.cpp:1.4 software/mysql++/lib/sql_query.cpp:1.5 --- software/mysql++/lib/sql_query.cpp:1.4 Mon May 2 06:25:53 2005 +++ software/mysql++/lib/sql_query.cpp Wed May 4 04:59:10 2005 @@ -48,7 +48,7 @@ if (option == 'r' || (option == 'q' && S.is_string)) { char *s = new char[S.size() * 2 + 1]; - mysql_escape_string(s, S.c_str(), (unsigned long) S.size()); + mysql_escape_string(s, S.c_str(), static_cast (S.size())); SQLString *ss = new SQLString("'"); *ss += s; *ss += "'"; Index: software/mysql++/lib/manip.cpp diff -u software/mysql++/lib/manip.cpp:1.3 software/mysql++/lib/manip.cpp:1.4 --- software/mysql++/lib/manip.cpp:1.3 Mon May 2 06:25:53 2005 +++ software/mysql++/lib/manip.cpp Wed May 4 04:59:10 2005 @@ -19,7 +19,7 @@ } else { char *s = new char[in.size() * 2 + 1]; - mysql_escape_string(s, in.c_str(), (unsigned long)in.size()); + mysql_escape_string(s, in.c_str(), static_cast (in.size())); SQLString in2 = SQLString("'") + s + "'"; in2.processed = true; *p.qparms << in2; @@ -37,7 +37,7 @@ ostream& operator<<(quote_type1 o, const string& in) { char *s = new char[in.size() * 2 + 1]; - mysql_escape_string(s, in.c_str(), (unsigned long)in.size()); + mysql_escape_string(s, in.c_str(), static_cast (in.size())); *o.ostr << "'" << s << "'"; delete[] s; return *o.ostr; @@ -60,7 +60,7 @@ { if (in.escape_q()) { char *s = new char[in.size() * 2 + 1]; - mysql_escape_string(s, in.c_str(), (unsigned long)in.size()); + mysql_escape_string(s, in.c_str(), static_cast (in.size())); if (in.quote_q()) *o.ostr << "'" << s << "'"; else @@ -97,7 +97,7 @@ if (in.escape_q()) { char *s = new char[in.size() * 2 + 1]; - mysql_escape_string(s, in.c_str(), (unsigned long)in.size()); + mysql_escape_string(s, in.c_str(), static_cast (in.size())); if (in.quote_q()) o << "'" << s << "'"; else @@ -148,7 +148,7 @@ } if (in.escape_q()) { char *s = new char[in.size() * 2 + 1]; - mysql_escape_string(s, in.c_str(), (unsigned long)in.size()); + mysql_escape_string(s, in.c_str(), static_cast (in.size())); if (in.quote_q()) static_cast(o) << "'" << s << "'"; else @@ -283,7 +283,7 @@ } else { char *s = new char[in.size() * 2 + 1]; - mysql_escape_string(s, in.c_str(), (unsigned long)in.size()); + mysql_escape_string(s, in.c_str(), static_cast (in.size())); SQLString in2 = s; in2.processed = true; *p.qparms << in2; @@ -301,7 +301,7 @@ ostream& operator<<(escape_type1 o, const string& in) { char *s = new char[in.size() * 2 + 1]; - mysql_escape_string(s, in.c_str(), (unsigned long)in.size()); + mysql_escape_string(s, in.c_str(), static_cast (in.size())); *o.ostr << s; delete[] s; return *o.ostr; @@ -325,7 +325,7 @@ { if (in.escape_q()) { char *s = new char[in.size() * 2 + 1]; - mysql_escape_string(s, in.c_str(), (unsigned long)in.size()); + mysql_escape_string(s, in.c_str(), static_cast (in.size())); delete[] s; } else {