[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] stat: fix up __attribute__ (const) declarations
From: |
Pádraig Brady |
Subject: |
Re: [PATCH 3/4] stat: fix up __attribute__ (const) declarations |
Date: |
Wed, 5 Jun 2019 23:45:16 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 05/06/19 16:59, Dominique Martinet wrote:
> Pádraig Brady wrote on Mon, Jun 03, 2019 at 03:55:51AM +0100:
>> * src/stat.c (format_to_mask): Functions that inspect
>> memory of pointer arguments must not be declared const.
>> Also use the _GL_ATTRIBUTE_PURE defines which will be
>> set appropriately per compiler.
>> ---
>> src/stat.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/stat.c b/src/stat.c
>> index fe52e0f..3e8f531 100644
>> --- a/src/stat.c
>> +++ b/src/stat.c
>> @@ -1078,7 +1078,7 @@ print_esc_char (char c)
>> putchar (c);
>> }
>>
>> -static size_t __attribute__((pure))
>> +static size_t _GL_ATTRIBUTE_PURE
>> format_code_offset (char const* directive)
>> {
>> size_t len = strspn (directive + 1, printf_flags);
>> @@ -1456,7 +1456,7 @@ fmt_to_mask (char fmt)
>> return 0;
>> }
>>
>> -static unsigned int __attribute__((const))
>> +static unsigned int _GL_ATTRIBUTE_PURE
>
> This one was probably meant to be _GL_ATTRIBUTE_CONST
No I meant to change to the less stringent PURE
since the function inspects through a passed pointer.
cheers,
Pádraig
- [PATCH V6 adjustments], Pádraig Brady, 2019/06/02
- [PATCH 1/4] stat: adjustments to statx defines, Pádraig Brady, 2019/06/02
- [PATCH 3/4] stat: fix up __attribute__ (const) declarations, Pádraig Brady, 2019/06/02
- [PATCH 2/4] stat: refactor printf directive parsing, Pádraig Brady, 2019/06/02
- [PATCH 4/4] stat: remove print_statx() and reuse print_stat(), Pádraig Brady, 2019/06/02
- Re: [PATCH V6 adjustments], Jeff Layton, 2019/06/05