Re: turning g_assert* into warnings

2007-10-15 Thread Federico Mena Quintero
On Fri, 2007-10-12 at 11:52 +0200, Tim Janik wrote: i'd like to propose to turn g_assert and friends like g_assert_not_reached into warnings instead of errors. i'll give a bit of background before the details though. the main reasons we use g_return_if_fail massively throughout the glib and

Re: turning g_assert* into warnings

2007-10-15 Thread Stefan Kost
hi, Marco Barisione schrieb: Il giorno ven, 12/10/2007 alle 15.16 +0200, Tim Janik ha scritto: please reread my reasoning about G_DISABLE_ASSERT, there already is no behavior of g_assert() you could rely on. (and some distributions do build their binaries with G_DISABLE_ASSERT and/or

turning g_assert* into warnings

2007-10-12 Thread Tim Janik
hey All. i'd like to propose to turn g_assert and friends like g_assert_not_reached into warnings instead of errors. i'll give a bit of background before the details though. the main reasons we use g_return_if_fail massively throughout the glib and gtk+ code base is that it catches API misuses

Re: turning g_assert* into warnings

2007-10-12 Thread Mathias Hasselmann
Am Freitag, den 12.10.2007, 11:52 +0200 schrieb Tim Janik: note that in practice, this shouldn't change anything for programmers (except for the ability to write better code ;) because of G_DISABLE_ASSERT, programmers can already not rely on failing assertions to abort their programs (only

Re: turning g_assert* into warnings

2007-10-12 Thread Yevgen Muntyan
Hey, Why not introduce a new check, some g_check_stuff() which would do what you propose? And let g_assert() be what it is, a glib analog of C assert(). When an assertion fails, you can't possibly expect the code to function in any meaningful way, e.g. int idx; g_assert (idx = 0);

Re: turning g_assert* into warnings

2007-10-12 Thread Dave Benson
c) programs that aren't 100% bug free could possibly trigger these warnings during production. aborting would take all the end user data with it, created/modified images, text documents, etc. issuing just a warnig preserves the possibility to still save crucial data if the

Re: turning g_assert* into warnings

2007-10-12 Thread Tim Janik
On Fri, 12 Oct 2007, Yevgen Muntyan wrote: Hey, Why not introduce a new check, some g_check_stuff() which would do what you propose? And let g_assert() be what it is, a glib analog of C assert(). When an assertion fails, you can't possibly expect the code to function in any meaningful way,

Re: turning g_assert* into warnings

2007-10-12 Thread Emmanuele Bassi
On Fri, 2007-10-12 at 14:40 +0200, Mathias Hasselmann wrote: So I guess what you really want is some kind of g_soft_assert or some g_warn_if_fail. +1 on a g_warn_if_fail() API addition. ciao, Emmanuele. -- Emmanuele Bassi, W: http://www.emmanuelebassi.net B: http://log.emmanuelebassi.net

Re: turning g_assert* into warnings

2007-10-12 Thread Brian J. Tarricone
Tim Janik wrote: hey All. i'd like to propose to turn g_assert and friends like g_assert_not_reached into warnings instead of errors. i'll give a bit of background before the details though. Like Mathias, I was in a bit of hell no! mode when I first read this. After reading your

Re: turning g_assert* into warnings

2007-10-12 Thread Kalle Vahlman
2007/10/12, Tim Janik [EMAIL PROTECTED]: hey All. i'd like to propose to turn g_assert and friends like g_assert_not_reached into warnings instead of errors. i'll give a bit of background before the details though. [snip] While the reasoning to make programs seem less crashy sounds

Re: turning g_assert* into warnings

2007-10-12 Thread Marco Barisione
Il giorno ven, 12/10/2007 alle 15.16 +0200, Tim Janik ha scritto: please reread my reasoning about G_DISABLE_ASSERT, there already is no behavior of g_assert() you could rely on. (and some distributions do build their binaries with G_DISABLE_ASSERT and/or G_DISABLE_CHECKS defined). What

Re: turning g_assert* into warnings

2007-10-12 Thread Morten Welinder
That's pretty much a no-go. g_assert_warning is marked G_GNUC_NORETURN. If you return from such a function, there is no telling what incorrect assumption the following code was compiled with, i.e., things that the compiler thought were in registers all of a sudden are not. Crash. Burn. Toast.

Re: turning g_assert* into warnings

2007-10-12 Thread Tim Janik
On Fri, 12 Oct 2007, Owen Taylor wrote: On Fri, 2007-10-12 at 11:52 +0200, Tim Janik wrote: i'd like to propose to turn g_assert and friends like g_assert_not_reached into warnings instead of errors. i'll give a bit of background before the details though. This is an incompatible change.

Re: turning g_assert* into warnings

2007-10-12 Thread Owen Taylor
On Fri, 2007-10-12 at 11:52 +0200, Tim Janik wrote: i'd like to propose to turn g_assert and friends like g_assert_not_reached into warnings instead of errors. i'll give a bit of background before the details though. This is an incompatible change. The contract now is that unless you compile

Re: turning g_assert* into warnings

2007-10-12 Thread BJörn Lindqvist
On 10/12/07, Emmanuele Bassi [EMAIL PROTECTED] wrote: On Fri, 2007-10-12 at 14:40 +0200, Mathias Hasselmann wrote: So I guess what you really want is some kind of g_soft_assert or some g_warn_if_fail. +1 on a g_warn_if_fail() API addition. What is wrong with: if (!everything_is_ok)

Re: turning g_assert* into warnings

2007-10-12 Thread Yevgen Muntyan
BJörn Lindqvist wrote: On 10/12/07, Emmanuele Bassi [EMAIL PROTECTED] wrote: On Fri, 2007-10-12 at 14:40 +0200, Mathias Hasselmann wrote: So I guess what you really want is some kind of g_soft_assert or some g_warn_if_fail. +1 on a g_warn_if_fail() API addition.