dbTalk Databases Forums  

Patch to fix compile error.

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Patch to fix compile error. in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kevin Regan
 
Posts: n/a

Default Patch to fix compile error. - 04-04-2005 , 04:59 PM






------_=_NextPart_001_01C53961.8BFDEC37
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


We are seeing the following compiler warning (we exit on warnings):

/usr/mysql/mysql++-1.7.32-1/include/null.h: In member function
`mysqlpp::null_type:perator Type()':
/usr/mysql/mysql++-1.7.32-1/include/null.h:14: warning: no return =
statement in
function returning non-void

Here is a patch to fix it:

--- lib/null.h 2005-03-15 21:25:23.000000000 -0800
+++ lib/null.h.f5 2005-03-15 21:25:09.000000000 -0800
@@ -11,7 +11,7 @@
=20
class null_type {
public:
- template <class Type> operator Type () {throw BadNullConversion();}
+ template <class Type> operator Type () {if (1) throw =
BadNullConversion();else return Type();}
};
=20
//:=20

Sincerely,
Kevin Regan
k.regan (AT) f5 (DOT) com


------_=_NextPart_001_01C53961.8BFDEC37--

Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: Patch to fix compile error. - 04-05-2005 , 07:14 AM






Kevin Regan wrote:
Quote:
- template <class Type> operator Type () {throw BadNullConversion();}
+ template <class Type> operator Type () {if (1) throw BadNullConversion();else return Type();}
I rejected this once before, because it's UGLY. I'll accept:

template <class Type> operator Type ()
{
throw BadNullConversion();
return Type();
}

....if that fixes the warning.

Also, what compiler does this affect?

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Steve Roberts
 
Posts: n/a

Default RE: Patch to fix compile error. - 04-05-2005 , 09:50 AM



Yeah, sorry about the miscommunication among F5'ers. Compiler is GCC
3.2.3 for Centos (RHEL 3 renamed & redistributed).

I don't know that your change works but I bet it does. Will check
today.

-SR=20

Quote:
-----Original Message-----
From: Warren Young [mailto:mysqlpp (AT) etr-usa (DOT) com]=20
Sent: Tuesday, April 05, 2005 5:15 AM
To: MySQL++ Mailing List
Subject: Re: Patch to fix compile error.
=20
Kevin Regan wrote:
- template <class Type> operator Type () {throw=20
BadNullConversion();}
+ template <class Type> operator Type () {if (1) throw=20
+ BadNullConversion();else return Type();}
=20
I rejected this once before, because it's UGLY. I'll accept:
=20
template <class Type> operator Type ()
{
throw BadNullConversion();
return Type();
}
=20
...if that fixes the warning.
=20
Also, what compiler does this affect?
=20
--=20
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: =20
http://lists.mysql.com/plusplus?unsu...) f5 (DOT) com
=20
=20
--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #4  
Old   
Kevin Regan
 
Posts: n/a

Default RE: Patch to fix compile error. - 04-05-2005 , 09:51 AM



------_=_NextPart_001_01C539EE.E37F4585
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Hi Warren,

This is for:=20

Quote:
g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=3D/usr --mandir=3D/usr/share/man =
--infodir=3D/usr/share/info --enable-shared --enable-threads=3Dposix =
--disable-checking --with-system-zlib --enable-__cxa_atexit =
--host=3Di386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-49)

I'll test out the change below to see if it gets rid of the warning.

Thanks!
Kevin

-----Original Message-----
From: Warren Young [mailto:mysqlpp (AT) etr-usa (DOT) com]
Sent: Tue 4/5/2005 5:14 AM
To: MySQL++ Mailing List
Subject: Re: Patch to fix compile error.
=20
Kevin Regan wrote:
Quote:
- template <class Type> operator Type () {throw BadNullConversion();}
+ template <class Type> operator Type () {if (1) throw =
BadNullConversion();else return Type();}

I rejected this once before, because it's UGLY. I'll accept:

template <class Type> operator Type ()
{
throw BadNullConversion();
return Type();
}

....if that fixes the warning.

Also, what compiler does this affect?

--=20
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: =
http://lists.mysql.com/plusplus?unsu...) f5 (DOT) com



------_=_NextPart_001_01C539EE.E37F4585--


Reply With Quote
  #5  
Old   
Kevin Regan
 
Posts: n/a

Default RE: Patch to fix compile error. - 04-05-2005 , 10:02 AM



------_=_NextPart_001_01C539F0.166638BB
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


This fixes the problem.

Thanks!
Kevin

-----Original Message-----
From: Warren Young [mailto:mysqlpp (AT) etr-usa (DOT) com]
Sent: Tue 4/5/2005 5:14 AM
To: MySQL++ Mailing List
Subject: Re: Patch to fix compile error.
=20
Kevin Regan wrote:
Quote:
- template <class Type> operator Type () {throw BadNullConversion();}
+ template <class Type> operator Type () {if (1) throw =
BadNullConversion();else return Type();}

I rejected this once before, because it's UGLY. I'll accept:

template <class Type> operator Type ()
{
throw BadNullConversion();
return Type();
}

....if that fixes the warning.

Also, what compiler does this affect?

--=20
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: =
http://lists.mysql.com/plusplus?unsu...) f5 (DOT) com



------_=_NextPart_001_01C539F0.166638BB--


Reply With Quote
  #6  
Old   
Warren Young
 
Posts: n/a

Default Re: Patch to fix compile error. - 04-05-2005 , 11:02 AM



Kevin Regan wrote:
Quote:
This fixes the problem.
Okay. Let's try one more refinement, to see if we can get rid of that
spurious return. Try this, please:

template <class Type> operator Type() throw(BadNullConversion)
{
throw BadNullConversion();
}

I'm hoping that the addition of a throw-spec is all the compiler really
wants.

Alternately, if there's any way you can distill a short piece of test
code that will make this warning happen, I'll investigate further myself.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.