Re: function attributes



On Fri, 5 Oct 2001, Matthias Clasen wrote:

> While extending the documentation of the gcc function attribute macros,
> I found that many of the functions in glib which are marked as G_GNUC_CONST
> are not actually const functions according to the definition found in the
> GNU C manual
> (http://gcc.gnu.org/onlinedocs/gcc-3.0.1/gcc_5.html#SEC93), since they are
> either
> derefencing pointer arguments or read global memory. These functions should
> probably be
> declared pure instead of const.

yep, i partly adressed that in an earlier mail:

Date: Fri, 11 May 2001 01:15:49 +0200 (CEST)
To: Gtk+ Developers <gtk-devel-list gnome org>
Subject: G_GNUC_CONST with _get_type() usage
Message-ID: <Pine LNX 4 21 0105110108010 10868-100000 birgrave birnet private>

> g_unichar_*, g_ascii_*, g_spaced_primes_closest, g_quark_to_string (these
> access global memory)
> g_int_equal (dereferences pointer arguments)
> 
> Furthermore, _glib_gettext could be marked as G_GNUC_FORMAT(1) and
> g_malloc and friends and a lot of the functions returning newly-allocated
> strings could
> be marked G_GNUC_MALLOC after defining G_GNUC_MALLOC to be
> __attribute__((malloc)).
> 
> I have put this in bugzilla as #61780.

i'd love to see (review) a patch that actually fixes the current
issues with GNUC function attribute misusages (and amends missing
attributions).

> 
> Matthias
> 

---
ciaoTJ





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]