Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys/sys
Am 05.04.2025 um 02:07 schrieb Taylor R Campbell:
>> Module Name: src
>> Committed By: rillig
>> Date: Fri Apr 4 20:52:32 UTC 2025
>>
>> Modified Files:
>> src/sys/sys: cdefs.h
>>
>> Log Message:
>> sys/cdefs.h: fix __predict_true and __predict_false for lint
>>
>> -#define __predict_true(exp) __builtin_expect((exp) ? 1 : 0, 1)
>> -#define __predict_false(exp) __builtin_expect((exp) ? 1 : 0, 0)
>> +#define __predict_true(exp) __builtin_expect(/*CONSTCOND*/(exp) ? 1 : 0, 1)
>> +#define __predict_false(exp) __builtin_expect(/*CONSTCOND*/(exp) ? 1 : 0, 0)
>
> This seems wrong to me. Why should we tell lint that _every_ input to
> __predict_true/false is constant?
>
> What lint objected to in this case is that ALIGNED_POINTER(...) is
> always 1 on x86. But it's not always 1 on all architectures.
Agreed.
Would it be narrow enough to add /*CONSTCOND*/ to the definition of
ALIGNED_POINTER on i386 and amd64? Or would you consider this still too
broad?
The next alternative would be to mark each call to ALIGNED_POINTER as
/*CONSTCOND*/, but that would be additional work in several places.
Roland
Home |
Main Index |
Thread Index |
Old Index