Re: GCC 3.4 warnings

Stephane Konstantaropoulos <[email protected]> Thu, 23 Sep 2004 10:33:42 +0200
Newsgroups gmane.comp.gnome.devtools.gob.general
Message-ID <[email protected]>
George a écrit :

>On Sat, Sep 18, 2004 at 10:21:02PM +0200, Stephane Konstantaropoulos wrote:
>  
>
>>Hello,
>>
>>I just updated to gcc 3.4 and it gives lots of warnings when compiling.
>>
>>I use gob2 2.0.9
>>
>>Notably the finalize() bit, when I declare "destroywith
>>gtk_widget_destroy" it warns loud saying this:
>>
>>lum-skin-textbox.gob: In function `___finalize':
>>lum-skin-textbox.gob:67: warning: function called through a non-
>>compatible type
>>lum-skin-textbox.gob:67: note: if this code is reached, the program will
>>abort
>>
>>This does not look good, so I have to write the finalize function myself
>>with correct types and it goes.
>>
>>Would it not be better to just avoid casting the "destroywith" function
>>and let the programmer use the right one for the type he is destroying?
>>GCC wil warn on a type mismatch there anyway.
>>
>>What do you think?
>>    
>>
>
>Well the problem is that it's ok for there to be some type mismatch.  For
>example gtk_widget_destroy (you should really call that with unrefwith not
>destroywith BTW) can be used to destroy a GtkButton.  If there wasn't a cast
>then we'd get a type-mismatch and you'd still need to write your own
>"wrapper" to remedy the problem.  C++ tries to be too smart for it's own
>good.  I changed the code to use the reinterpret_cast nonsense when --for-cpp
>is used which should work much better and it really should fix this problem.
>
>2.0.10 will be out shortly with this change.
>
>George
>
>  
>

Thank you George,

but this problem occurs in C, not in C++. It did not occur with GCC 3.3
and I do not use gob with --for-cpp.

Stephane
signature.asc (application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBUoprsZFoeToEeG4RAjvQAJ9Y6vuBNc9qaErj9HrHuENwuPFkdgCfeUAH
rfugJQ1SaL+IO4Sq9TtBJes=
=0BTu
-----END PGP SIGNATURE-----