mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 14:36:16 +01:00
Remove the (no longer effective) empty if-branch.
* glib/gmessages.h (g_assert): (g_return_if_fail): (g_return_val_if_fail): Remove the (no longer effective) empty if-branch. * glib/gmacros.h: Change the definition of G_LIKELY, so that g_return_if_fail() and friends still trigger a gcc warning if the expr is an assignment.
This commit is contained in:
parent
129cfb8bf8
commit
827f3c4fa4
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2002-11-25 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* glib/gmessages.h (g_assert):
|
||||
(g_return_if_fail):
|
||||
(g_return_val_if_fail): Remove the (no longer effective) empty
|
||||
if-branch.
|
||||
|
||||
* glib/gmacros.h: Change the definition of G_LIKELY, so that
|
||||
g_return_if_fail() and friends still trigger a gcc warning if
|
||||
the expr is an assignment.
|
||||
|
||||
2002-11-23 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* configure.in: Generate docs/reference/*/version.xml.
|
||||
|
@ -1,3 +1,14 @@
|
||||
2002-11-25 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* glib/gmessages.h (g_assert):
|
||||
(g_return_if_fail):
|
||||
(g_return_val_if_fail): Remove the (no longer effective) empty
|
||||
if-branch.
|
||||
|
||||
* glib/gmacros.h: Change the definition of G_LIKELY, so that
|
||||
g_return_if_fail() and friends still trigger a gcc warning if
|
||||
the expr is an assignment.
|
||||
|
||||
2002-11-23 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* configure.in: Generate docs/reference/*/version.xml.
|
||||
|
@ -1,3 +1,14 @@
|
||||
2002-11-25 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* glib/gmessages.h (g_assert):
|
||||
(g_return_if_fail):
|
||||
(g_return_val_if_fail): Remove the (no longer effective) empty
|
||||
if-branch.
|
||||
|
||||
* glib/gmacros.h: Change the definition of G_LIKELY, so that
|
||||
g_return_if_fail() and friends still trigger a gcc warning if
|
||||
the expr is an assignment.
|
||||
|
||||
2002-11-23 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* configure.in: Generate docs/reference/*/version.xml.
|
||||
|
@ -1,3 +1,14 @@
|
||||
2002-11-25 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* glib/gmessages.h (g_assert):
|
||||
(g_return_if_fail):
|
||||
(g_return_val_if_fail): Remove the (no longer effective) empty
|
||||
if-branch.
|
||||
|
||||
* glib/gmacros.h: Change the definition of G_LIKELY, so that
|
||||
g_return_if_fail() and friends still trigger a gcc warning if
|
||||
the expr is an assignment.
|
||||
|
||||
2002-11-23 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* configure.in: Generate docs/reference/*/version.xml.
|
||||
|
@ -1,3 +1,14 @@
|
||||
2002-11-25 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* glib/gmessages.h (g_assert):
|
||||
(g_return_if_fail):
|
||||
(g_return_val_if_fail): Remove the (no longer effective) empty
|
||||
if-branch.
|
||||
|
||||
* glib/gmacros.h: Change the definition of G_LIKELY, so that
|
||||
g_return_if_fail() and friends still trigger a gcc warning if
|
||||
the expr is an assignment.
|
||||
|
||||
2002-11-23 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* configure.in: Generate docs/reference/*/version.xml.
|
||||
|
@ -1,3 +1,14 @@
|
||||
2002-11-25 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* glib/gmessages.h (g_assert):
|
||||
(g_return_if_fail):
|
||||
(g_return_val_if_fail): Remove the (no longer effective) empty
|
||||
if-branch.
|
||||
|
||||
* glib/gmacros.h: Change the definition of G_LIKELY, so that
|
||||
g_return_if_fail() and friends still trigger a gcc warning if
|
||||
the expr is an assignment.
|
||||
|
||||
2002-11-23 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* configure.in: Generate docs/reference/*/version.xml.
|
||||
|
@ -1,3 +1,14 @@
|
||||
2002-11-25 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* glib/gmessages.h (g_assert):
|
||||
(g_return_if_fail):
|
||||
(g_return_val_if_fail): Remove the (no longer effective) empty
|
||||
if-branch.
|
||||
|
||||
* glib/gmacros.h: Change the definition of G_LIKELY, so that
|
||||
g_return_if_fail() and friends still trigger a gcc warning if
|
||||
the expr is an assignment.
|
||||
|
||||
2002-11-23 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* configure.in: Generate docs/reference/*/version.xml.
|
||||
|
@ -208,10 +208,22 @@
|
||||
* The G_LIKELY and G_UNLIKELY macros let the programmer give hints to
|
||||
* the compiler about the expected result of an expression. Some compilers
|
||||
* can use this information for optimizations.
|
||||
*
|
||||
* The _G_BOOLEAN_EXPR macro is intended to trigger a gcc warning when
|
||||
* putting assignments in g_return_if_fail ().
|
||||
*/
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2)
|
||||
#define G_LIKELY(expr) __builtin_expect (!!(expr), 1)
|
||||
#define G_UNLIKELY(expr) __builtin_expect (!!(expr), 0)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
|
||||
#define _G_BOOLEAN_EXPR(expr) \
|
||||
__extension__ ({ \
|
||||
int _g_boolean_var_; \
|
||||
if (expr) \
|
||||
_g_boolean_var_ = 1; \
|
||||
else \
|
||||
_g_boolean_var_ = 0; \
|
||||
_g_boolean_var_; \
|
||||
})
|
||||
#define G_LIKELY(expr) __builtin_expect (_G_BOOLEAN_EXPR(expr), 1)
|
||||
#define G_UNLIKELY(expr) __builtin_expect (_G_BOOLEAN_EXPR(expr), 0)
|
||||
#else
|
||||
#define G_LIKELY(expr) expr
|
||||
#define G_UNLIKELY(expr) expr
|
||||
|
@ -201,7 +201,7 @@ GPrintFunc g_set_printerr_handler (GPrintFunc func);
|
||||
#ifdef __GNUC__
|
||||
|
||||
#define g_assert(expr) G_STMT_START{ \
|
||||
if (expr) { } else \
|
||||
if (!G_LIKELY (expr)) \
|
||||
g_log (G_LOG_DOMAIN, \
|
||||
G_LOG_LEVEL_ERROR, \
|
||||
"file %s: line %d (%s): assertion failed: (%s)", \
|
||||
@ -253,7 +253,7 @@ GPrintFunc g_set_printerr_handler (GPrintFunc func);
|
||||
#ifdef __GNUC__
|
||||
|
||||
#define g_return_if_fail(expr) G_STMT_START{ \
|
||||
if (G_LIKELY (expr)) { } else \
|
||||
if (!G_LIKELY (expr)) \
|
||||
{ \
|
||||
g_log (G_LOG_DOMAIN, \
|
||||
G_LOG_LEVEL_CRITICAL, \
|
||||
@ -266,7 +266,7 @@ GPrintFunc g_set_printerr_handler (GPrintFunc func);
|
||||
}; }G_STMT_END
|
||||
|
||||
#define g_return_val_if_fail(expr,val) G_STMT_START{ \
|
||||
if (G_LIKELY (expr)) { } else \
|
||||
if (!G_LIKELY (expr)) \
|
||||
{ \
|
||||
g_log (G_LOG_DOMAIN, \
|
||||
G_LOG_LEVEL_CRITICAL, \
|
||||
@ -299,7 +299,7 @@ GPrintFunc g_set_printerr_handler (GPrintFunc func);
|
||||
#else /* !__GNUC__ */
|
||||
|
||||
#define g_return_if_fail(expr) G_STMT_START{ \
|
||||
if (G_LIKELY (expr)) { } else \
|
||||
if (expr) { } else \
|
||||
{ \
|
||||
g_log (G_LOG_DOMAIN, \
|
||||
G_LOG_LEVEL_CRITICAL, \
|
||||
@ -311,7 +311,7 @@ GPrintFunc g_set_printerr_handler (GPrintFunc func);
|
||||
}; }G_STMT_END
|
||||
|
||||
#define g_return_val_if_fail(expr, val) G_STMT_START{ \
|
||||
if (G_LIKELY (expr)) { } else \
|
||||
if (expr) { } else \
|
||||
{ \
|
||||
g_log (G_LOG_DOMAIN, \
|
||||
G_LOG_LEVEL_CRITICAL, \
|
||||
|
Loading…
Reference in New Issue
Block a user