From: Mathieu Desnoyers Date: Mon, 21 Feb 2011 23:43:55 +0000 (-0500) Subject: Fix 64-bit warnings X-Git-Tag: v0.1~193 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=380d60b1bd3c5d1a709dca3eeb8e718598fed235 Fix 64-bit warnings Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/metadata/ctf-parser.y b/formats/ctf/metadata/ctf-parser.y index cedac20f..cbdfa7fd 100644 --- a/formats/ctf/metadata/ctf-parser.y +++ b/formats/ctf/metadata/ctf-parser.y @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "ctf-scanner.h" #include "ctf-parser.h" @@ -153,7 +154,7 @@ static int lookup_type(struct ctf_scanner_scope *s, const char *id) { int ret; - ret = (int) g_hash_table_lookup(s->types, id); + ret = (int) (long) g_hash_table_lookup(s->types, id); printf_dbg("lookup %p %s %d\n", s, id, ret); return ret; } @@ -925,21 +926,21 @@ postfix_expression: { $$ = make_node(scanner, NODE_UNARY_EXPRESSION); $$->u.unary_expression.type = UNARY_UNSIGNED_CONSTANT; - sscanf(yylval.gs->s, "%llu", + sscanf(yylval.gs->s, "%" PRIu64, &$$->u.unary_expression.u.unsigned_constant); } | OCTAL_CONSTANT { $$ = make_node(scanner, NODE_UNARY_EXPRESSION); $$->u.unary_expression.type = UNARY_UNSIGNED_CONSTANT; - sscanf(yylval.gs->s, "0%llo", + sscanf(yylval.gs->s, "0%" PRIo64, &$$->u.unary_expression.u.unsigned_constant); } | HEXADECIMAL_CONSTANT { $$ = make_node(scanner, NODE_UNARY_EXPRESSION); $$->u.unary_expression.type = UNARY_UNSIGNED_CONSTANT; - sscanf(yylval.gs->s, "0x%llx", + sscanf(yylval.gs->s, "0x%" PRIx64, &$$->u.unary_expression.u.unsigned_constant); } | STRING_LITERAL_START DQUOTE @@ -1465,21 +1466,21 @@ type_specifier_or_integer_constant: { $$ = make_node(scanner, NODE_UNARY_EXPRESSION); $$->u.unary_expression.type = UNARY_UNSIGNED_CONSTANT; - sscanf(yylval.gs->s, "%llu", + sscanf(yylval.gs->s, "%" PRIu64, &$$->u.unary_expression.u.unsigned_constant); } | OCTAL_CONSTANT { $$ = make_node(scanner, NODE_UNARY_EXPRESSION); $$->u.unary_expression.type = UNARY_UNSIGNED_CONSTANT; - sscanf(yylval.gs->s, "0%llo", + sscanf(yylval.gs->s, "0%" PRIo64, &$$->u.unary_expression.u.unsigned_constant); } | HEXADECIMAL_CONSTANT { $$ = make_node(scanner, NODE_UNARY_EXPRESSION); $$->u.unary_expression.type = UNARY_UNSIGNED_CONSTANT; - sscanf(yylval.gs->s, "0x%llx", + sscanf(yylval.gs->s, "0x%" PRIx64, &$$->u.unary_expression.u.unsigned_constant); } ; diff --git a/formats/ctf/metadata/ctf-visitor-xml.c b/formats/ctf/metadata/ctf-visitor-xml.c index a4d8549f..54b5feb8 100644 --- a/formats/ctf/metadata/ctf-visitor-xml.c +++ b/formats/ctf/metadata/ctf-visitor-xml.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include "ctf-scanner.h" @@ -73,13 +74,13 @@ int ctf_visitor_print_unary_expression(FILE *fd, int depth, struct ctf_node *nod case UNARY_SIGNED_CONSTANT: print_tabs(fd, depth); fprintf(fd, "u.unary_expression.u.signed_constant); + fprintf(fd, "%" PRId64, node->u.unary_expression.u.signed_constant); fprintf(fd, " />\n"); break; case UNARY_UNSIGNED_CONSTANT: print_tabs(fd, depth); fprintf(fd, "u.unary_expression.u.signed_constant); + fprintf(fd, "%" PRIu64, node->u.unary_expression.u.signed_constant); fprintf(fd, " />\n"); break; case UNARY_SBRAC: diff --git a/tests/test-bitfield.c b/tests/test-bitfield.c index 045b7d94..fe886471 100644 --- a/tests/test-bitfield.c +++ b/tests/test-bitfield.c @@ -127,7 +127,7 @@ int run_test_unsigned(void) unsigned long l[TEST_LEN/sizeof(unsigned long)]; unsigned long long ll[TEST_LEN/sizeof(unsigned long long)]; } target; - uint64_t readval; + unsigned long long readval; unsigned int s, l; int err = 0; @@ -206,7 +206,7 @@ int run_test_signed(void) long l[TEST_LEN/sizeof(long)]; long long ll[TEST_LEN/sizeof(long long)]; } target; - int64_t readval; + long long readval; unsigned int s, l; int err = 0; @@ -318,7 +318,7 @@ int main(int argc, char **argv) unsigned long l[2]; unsigned long long ll[1]; } target; - uint64_t readval; + unsigned long long readval; if (argc > 1) src = atoi(argv[1]); diff --git a/types/enum.c b/types/enum.c index daf13507..38a972a9 100644 --- a/types/enum.c +++ b/types/enum.c @@ -202,7 +202,7 @@ void enum_signed_insert_value_to_quark_set(struct type_class_enum *enum_class, g_array_set_size(array, 1); g_array_index(array, GQuark, array->len - 1) = q; g_hash_table_insert(enum_class->table.value_to_quark_set, - (gconstpointer) v, array); + (gpointer) v, array); } else { g_array_set_size(array, array->len + 1); g_array_index(array, GQuark, array->len - 1) = q; @@ -222,7 +222,7 @@ void enum_unsigned_insert_value_to_quark_set(struct type_class_enum *enum_class, g_array_set_size(array, 1); g_array_index(array, GQuark, array->len - 1) = q; g_hash_table_insert(enum_class->table.value_to_quark_set, - (gconstpointer) v, array); + (gpointer) v, array); } else { g_array_set_size(array, array->len + 1); g_array_index(array, GQuark, array->len - 1) = q;