[CRIU] [PATCH] cr: introduced the macro P() to convert an integer to unsigned long
    Alexander Kartashov 
    alekskartashov at parallels.com
       
    Thu Jan 17 01:34:55 EST 2013
    
    
  
On 01/16/2013 07:27 PM, Pavel Emelyanov wrote:
>>   			     vma_entry_len(vma_entry),
>> >  			     vma_entry->prot);
>> >  	}
>> >diff --git a/pipes.c b/pipes.c
>> >index 16a2454..8b801b8 100644
>> >--- a/pipes.c
>> >+++ b/pipes.c
>> >@@ -186,7 +186,7 @@ int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst **hash
>> >  
>> >  		if (ret == 0 || ret > iov.iov_len /* sanity */) {
>> >  			pr_err("%#x: Wanted to restore %lu bytes, but got %d\n", id,
>> >-					iov.iov_len, ret);
>> >+					P(iov.iov_len), ret);
> printf format to fix
>
I expected this comment. Take a look at the following modelling program:
#include <stdio.h>
int main() {
size_t v = 1;
printf("%lu\n", v);
return 0;
}
It compiles on x86_64 successfully but the ARM compiler says:
2.c: In function ‘main’:
2.c:7:2: error: format ‘%lu’ expects argument of type ‘long unsigned 
int’, but argument 2 has type ‘size_t’ [-Werror=format]
cc1: all warnings being treated as errors
If we change the format specified to %u the ARM compiler is happy but 
x86_64 isn't:
2.c: In function ‘main’:
2.c:7:2: error: format ‘%u’ expects argument of type ‘unsigned int’, but 
argument 2 has type ‘size_t’ [-Werror=format]
cc1: all warnings being treated as errors
Moreover we can't use explicit size specifier because the size of size_t 
is different on x86 an ARM.
-- 
Sincerely yours,
Alexander Kartashov
Intern
Core team
www.parallels.com
Skype: aleksandr.kartashov
Email: alekskartashov at parallels.com
    
    
More information about the CRIU
mailing list