On Thu, Jun 23, 2011 at 11:59:17AM +0200, Jim Meyering wrote:
Angus Salkeld wrote:
> char changes size on different arches.
Hi Angus,
Have you encountered an actual system on which "sizeof char" is not 1?
No, I get that sizeof(char) is 1 on pretty much all systems.
(I was more concerned with sizeof(char*) vs. sizeof(uint32_t*)
I was trying to solve a sparc 64 compile warning. But since re-checking
it seems I have failed :(
On sparc64 sizeof(char*) == 8 and sizeof(int*) is 4 (I expected uint8_t
to be 4 but it much be 8).
The warning is:
log_blackbox.c: In function 'qb_log_blackbox_print_from_file':
log_blackbox.c:171:13: warning: cast increases required alignment of target type
[-Wcast-align]
log_blackbox.c:175:14: warning: cast increases required alignment of target type
[-Wcast-align]
log_blackbox.c:182:16: warning: cast increases required alignment of target type
[-Wcast-align]
sparc64:
http://sparc.koji.fedoraproject.org/koji/getfile?taskID=112209&name=b...
sparcv9:
http://sparc.koji.fedoraproject.org/koji/getfile?taskID=112210&name=b...
The test fails on sparcv9 - but I am not sure how to get at the logs.
Any way I am very interested in the "correcct" way of fixing that
warning.
-Angus
> diff --git a/lib/log_blackbox.c b/lib/log_blackbox.c
> index 1e21f74..60f9e52 100644
> --- a/lib/log_blackbox.c
> +++ b/lib/log_blackbox.c
> @@ -135,7 +135,7 @@ void qb_log_blackbox_print_from_file(const char *bb_filename)
> {
> qb_ringbuffer_t *instance;
> ssize_t bytes_read;
> - char chunk[512];
> + uint8_t chunk[512];
> int fd;
> char time_buf[64];
>
> @@ -151,10 +151,10 @@ void qb_log_blackbox_print_from_file(const char *bb_filename)
> }
>
> do {
> - char *ptr;
> + uint8_t *ptr;
> uint32_t *lineno;
> uint32_t *fn_size;
> - char *function;
> + uint8_t *function;
> time_t *timestamp;
> /*uint32_t *log_size;*/
_______________________________________________
quarterback-devel mailing list
quarterback-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/quarterback-devel