[CRIU] [PATCH] crtools.c: fix compilation by clang

Andrey Wagin avagin at gmail.com
Fri May 1 03:37:42 PDT 2015


2015-05-01 11:30 GMT+03:00 Tycho Andersen <tycho.andersen at canonical.com>:
> Hi Kir,
>
> On Thu, Apr 30, 2015 at 04:25:44PM -0700, Kir Kolyshkin wrote:
>> Fix the following error:
>>
>> >   LINK     arch/x86/syscalls.built-in.o
>> > arch/x86/crtools.c:36:20: error: unused function '__check_code_syscall'
>> >       [-Werror,-Wunused-function]
>> > static inline void __check_code_syscall(void)
>>
>> As the function consists of a few BUILD_BUG_ONs, it gets optimized out.
>> Let's add __attribute__((__used__)) so clang stops complaining.
>>
>> Signed-off-by: Kir Kolyshkin <kir at openvz.org>
>> ---
>>  arch/x86/crtools.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/crtools.c b/arch/x86/crtools.c
>> index d721ac8..4e7b090 100644
>> --- a/arch/x86/crtools.c
>> +++ b/arch/x86/crtools.c
>> @@ -33,7 +33,7 @@ const char code_syscall[] = {
>>
>>  const int code_syscall_size = round_up(sizeof(code_syscall), sizeof(long));
>>
>> -static inline void __check_code_syscall(void)
>> +static inline __used void __check_code_syscall(void)
>
> Isn't it actually unused? I can't find it via grep.

Maybe it's here only for BUILD_BUG_ON?
>
> Tycho
>
>>  {
>>       BUILD_BUG_ON(sizeof(code_syscall) != BUILTIN_SYSCALL_SIZE);
>>       BUILD_BUG_ON(!is_log2(sizeof(code_syscall)));
>> --
>> 1.9.3
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list