mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
Add a macro to make gcc warn if a function result is ignored. (#145466,
2005-12-04 Matthias Clasen <mclasen@redhat.com> * glib/gmacros.h (G_GNUC_WARN_UNUSED_RESULT): Add a macro to make gcc warn if a function result is ignored. (#145466, Arjan van de Ven, Alex Larsson) * glib/gmem.h: Add the new attribute to g_realloc and g_try_realloc.
This commit is contained in:
parent
36c836435b
commit
00f952f8e8
@ -1,3 +1,12 @@
|
|||||||
|
2005-12-04 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmacros.h (G_GNUC_WARN_UNUSED_RESULT): Add a macro
|
||||||
|
to make gcc warn if a function result is ignored. (#145466,
|
||||||
|
Arjan van de Ven, Alex Larsson)
|
||||||
|
|
||||||
|
* glib/gmem.h: Add the new attribute to g_realloc and
|
||||||
|
g_try_realloc.
|
||||||
|
|
||||||
2005-12-03 Matthias Clasen <mclasen@redhat.com>
|
2005-12-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/glib.symbols:
|
* glib/glib.symbols:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2005-12-04 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmacros.h (G_GNUC_WARN_UNUSED_RESULT): Add a macro
|
||||||
|
to make gcc warn if a function result is ignored. (#145466,
|
||||||
|
Arjan van de Ven, Alex Larsson)
|
||||||
|
|
||||||
|
* glib/gmem.h: Add the new attribute to g_realloc and
|
||||||
|
g_try_realloc.
|
||||||
|
|
||||||
2005-12-03 Matthias Clasen <mclasen@redhat.com>
|
2005-12-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/glib.symbols:
|
* glib/glib.symbols:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2005-12-04 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gmacros.h (G_GNUC_WARN_UNUSED_RESULT): Add a macro
|
||||||
|
to make gcc warn if a function result is ignored. (#145466,
|
||||||
|
Arjan van de Ven, Alex Larsson)
|
||||||
|
|
||||||
|
* glib/gmem.h: Add the new attribute to g_realloc and
|
||||||
|
g_try_realloc.
|
||||||
|
|
||||||
2005-12-03 Matthias Clasen <mclasen@redhat.com>
|
2005-12-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/glib.symbols:
|
* glib/glib.symbols:
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2005-12-04 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/tmpl/macros_misc.sgml: Document G_GNUC_WARN_UNUSED_RESULT.
|
||||||
|
|
||||||
2005-12-03 Matthias Clasen <mclasen@redhat.com>
|
2005-12-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/tmpl/caches.sgml: Document g_cache_value_foreach
|
* glib/tmpl/caches.sgml: Document g_cache_value_foreach
|
||||||
|
@ -323,6 +323,7 @@ G_GNUC_PRINTF
|
|||||||
G_GNUC_SCANF
|
G_GNUC_SCANF
|
||||||
G_GNUC_FORMAT
|
G_GNUC_FORMAT
|
||||||
G_GNUC_NULL_TERMINATED
|
G_GNUC_NULL_TERMINATED
|
||||||
|
G_GNUC_WARN_UNUSED_RESULT
|
||||||
G_GNUC_FUNCTION
|
G_GNUC_FUNCTION
|
||||||
G_GNUC_PRETTY_FUNCTION
|
G_GNUC_PRETTY_FUNCTION
|
||||||
G_GNUC_NO_INSTRUMENT
|
G_GNUC_NO_INSTRUMENT
|
||||||
|
@ -250,6 +250,16 @@ See the GNU C documentation for details.
|
|||||||
Since: 2.8
|
Since: 2.8
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### MACRO G_GNUC_WARN_UNUSED_RESULT ##### -->
|
||||||
|
<para>
|
||||||
|
Expands to the GNU C <literal>warn_unused_ersult</literal> function attribute
|
||||||
|
if the compiler is <command>gcc</command>, or "" if it isn't. This function
|
||||||
|
attribute makes the compiler emit a warning if the result of a function call
|
||||||
|
is ignored. See the GNU C documentation for details.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
Since: 2.10
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO G_GNUC_FUNCTION ##### -->
|
<!-- ##### MACRO G_GNUC_FUNCTION ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
@ -95,6 +95,13 @@
|
|||||||
#define G_GNUC_DEPRECATED
|
#define G_GNUC_DEPRECATED
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
|
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||||
|
#define G_GNUC_WARN_UNUSED_RESULT \
|
||||||
|
__attribute__((warn_unused_result))
|
||||||
|
#else
|
||||||
|
#define G_GNUC_WARN_UNUSED_RESULT
|
||||||
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
|
/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
|
||||||
* macros, so we can refer to them as strings unconditionally.
|
* macros, so we can refer to them as strings unconditionally.
|
||||||
* usage not-recommended since gcc-3.0
|
* usage not-recommended since gcc-3.0
|
||||||
|
@ -47,12 +47,12 @@ typedef struct _GMemVTable GMemVTable;
|
|||||||
gpointer g_malloc (gulong n_bytes) G_GNUC_MALLOC;
|
gpointer g_malloc (gulong n_bytes) G_GNUC_MALLOC;
|
||||||
gpointer g_malloc0 (gulong n_bytes) G_GNUC_MALLOC;
|
gpointer g_malloc0 (gulong n_bytes) G_GNUC_MALLOC;
|
||||||
gpointer g_realloc (gpointer mem,
|
gpointer g_realloc (gpointer mem,
|
||||||
gulong n_bytes);
|
gulong n_bytes) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
void g_free (gpointer mem);
|
void g_free (gpointer mem);
|
||||||
gpointer g_try_malloc (gulong n_bytes) G_GNUC_MALLOC;
|
gpointer g_try_malloc (gulong n_bytes) G_GNUC_MALLOC;
|
||||||
gpointer g_try_malloc0 (gulong n_bytes) G_GNUC_MALLOC;
|
gpointer g_try_malloc0 (gulong n_bytes) G_GNUC_MALLOC;
|
||||||
gpointer g_try_realloc (gpointer mem,
|
gpointer g_try_realloc (gpointer mem,
|
||||||
gulong n_bytes);
|
gulong n_bytes) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
|
||||||
/* Convenience memory allocators
|
/* Convenience memory allocators
|
||||||
|
Loading…
Reference in New Issue
Block a user