bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] acl-internal.h: remove _GL_ATTRIBUTE_CONST on void function


From: Pádraig Brady
Subject: Re: [PATCH] acl-internal.h: remove _GL_ATTRIBUTE_CONST on void function
Date: Mon, 25 Jun 2018 22:10:06 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 25/06/18 18:20, Bruno Haible wrote:
> Hi Jim,
> 
>> diff --git a/lib/acl-internal.h b/lib/acl-internal.h
>> index 6c65e65e5..0669d83c4 100644
>> --- a/lib/acl-internal.h
>> +++ b/lib/acl-internal.h
>> @@ -293,10 +293,6 @@ struct permission_context {
>>
>>  int get_permissions (const char *, int, mode_t, struct permission_context 
>> *);
>>  int set_permissions (struct permission_context *, const char *, int);
>> -void free_permission_context (struct permission_context *)
>> -#if ! (defined USE_ACL && (HAVE_ACL_GET_FILE || defined GETACL))
>> -    _GL_ATTRIBUTE_CONST
>> -#endif
>> -  ;
>> +void free_permission_context (struct permission_context *);
>>
>>  _GL_INLINE_HEADER_END
>>
> 
> Now, on Ubuntu 16.04, with gcc 5.4.0, I get this compilation error in
> coreutils:
> 
>   CC       lib/acl-internal.o
> lib/acl-internal.c: In function 'free_permission_context':
> lib/acl-internal.c:479:1: error: function might be candidate for attribute 
> 'const' [-Werror=suggest-attribute=const]
>  free_permission_context (struct permission_context *ctx)
>  ^
> cc1: all warnings being treated as errors
> Makefile:9618: recipe for target 'lib/acl-internal.o' failed
> make[2]: *** [lib/acl-internal.o] Error 1
> make[2]: Leaving directory '/media/develdata/devel/COREUTILS/coreutils'
> 
> 
> One version of GCC wants the 'const' attribute, another one complains
> about it...
> 
> Isn't it time to disable either -Werror or -Wattribute?

I suggest using:

 -Wno-error=suggest-attribute=pure
 -Wno-error=suggest-attribute=const
 -Wno-error=suggest-attribute=noreturn
 -Wno-error=suggest-attribute=format
 -Wno-error=suggest-attribute=cold
 -Wno-error=suggest-attribute=malloc

That way is a compromise for these never giving a failure,
but these warnings tending to zero on newer compilers

cheers,
Pádraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]