glob.c warnings
Eric Blake
eblake@redhat.com
Thu Sep 12 23:01:00 GMT 2013
ping
On 09/04/2013 05:05 PM, Eric Blake wrote:
> On 09/04/2013 06:31 AM, Eric Blake wrote:
>> [just now noticing an old thread]
>>
>> On 06/03/2013 05:05 AM, Colin Watson wrote:
>>> I get these warnings from a project using Gnulib 20130529:
>>>
>>> glob.c:165:1: warning: '__leaf__' attribute has no effect on unit local functions [-Wattributes]
>>> glob.c:213:1: warning: '__leaf__' attribute has no effect on unit local functions [-Wattributes]
>>> glob.c:214:1: warning: '__leaf__' attribute has no effect on unit local functions [-Wattributes]
>>>
>>> These are from uses of __THROW on static functions. Is it perhaps worth
>>> using (and defining if necessary) __THROWNL instead, which I think would
>>> pacify these warnings?
>>
>> What version of gcc and what CFLAGS were you using? Yes, this is
>> probably worth fixing.
>
> Indeed, reading
> http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html states under
> 'leaf' that "The attribute has no effect on functions defined within the
> current compilation unit.", and therefore __THROWNL is safe to use in
> place of __THROW. I propose the following patch to glibc, and will
> install a counterpart patch into gnulib:
>
> From c84321367fb6d1dc35c8d04e075f1315eddcc720 Mon Sep 17 00:00:00 2001
> From: Eric Blake <eblake@redhat.com>
> Date: Wed, 4 Sep 2013 17:02:47 -0600
> Subject: [PATCH] glob: silence -Wattribute warnings
>
> Colin Watson reported that some versions of gcc warn about
> attribute leaf used on a static function, since it has no
> effect on anything but external functions.
>
> * posix/glob.c (next_brace_sub, prefix_array, collated_compare):
> Use __THROWNL rather than __THROW on static functions.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> ChangeLog | 5 +++++
> posix/glob.c | 6 +++---
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 1f29127..32613ae 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2013-09-04 Eric Blake <eblake@redhat.com>
> +
> + * posix/glob.c (next_brace_sub, prefix_array, collated_compare):
> + Use __THROWNL rather than __THROW on static functions.
> +
> 2013-09-04 Joseph Myers <joseph@codesourcery.com>
>
> * conform/conformtest.pl (newtoken): Treat tokens not allowed as
> diff --git a/posix/glob.c b/posix/glob.c
> index 4c7dce5..ece71c1 100644
> --- a/posix/glob.c
> +++ b/posix/glob.c
> @@ -193,7 +193,7 @@
> # define GET_LOGIN_NAME_MAX() (-1)
> #endif
>
> -static const char *next_brace_sub (const char *begin, int flags) __THROW;
> +static const char *next_brace_sub (const char *begin, int flags) __THROWNL;
>
> #endif /* !defined _LIBC || !defined GLOB_ONLY_P */
>
> @@ -208,8 +208,8 @@ extern int __glob_pattern_type (const char *pattern,
> int quote)
> attribute_hidden;
>
> #if !defined _LIBC || !defined GLOB_ONLY_P
> -static int prefix_array (const char *prefix, char **array, size_t n)
> __THROW;
> -static int collated_compare (const void *, const void *) __THROW;
> +static int prefix_array (const char *prefix, char **array, size_t n)
> __THROWNL;
> +static int collated_compare (const void *, const void *) __THROWNL;
>
>
> /* Find the end of the sub-pattern in a brace expression. */
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20130912/3b8c9e0a/attachment.sig>
More information about the Libc-alpha
mailing list