Fix 64-bit warnings
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 21 Feb 2011 23:43:55 +0000 (18:43 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 21 Feb 2011 23:43:55 +0000 (18:43 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/metadata/ctf-parser.y
formats/ctf/metadata/ctf-visitor-xml.c
tests/test-bitfield.c
types/enum.c

index cedac20fe47dfcbf9d55c510f04d7954bcff4094..cbdfa7fd6e2786625a22a7e0ef35f715293ebff1 100644 (file)
@@ -24,6 +24,7 @@
 #include <assert.h>
 #include <glib.h>
 #include <errno.h>
 #include <assert.h>
 #include <glib.h>
 #include <errno.h>
+#include <inttypes.h>
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
 #include <babeltrace/list.h>
 #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;
 
 {
        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;
 }
        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;
                {
                        $$ = 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;
                               &$$->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;
                               &$$->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
                               &$$->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;
                {
                        $$ = 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;
                               &$$->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;
                               &$$->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);
                }
        ;
                               &$$->u.unary_expression.u.unsigned_constant);
                }
        ;
index a4d8549f280aa22a3ee116ad54a568b9cb6d245c..54b5feb84d552e0e70cfb4fa11e2884723a64a86 100644 (file)
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <glib.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <glib.h>
+#include <inttypes.h>
 #include <errno.h>
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include <errno.h>
 #include <babeltrace/list.h>
 #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, "<unary_expression value=");
        case UNARY_SIGNED_CONSTANT:
                print_tabs(fd, depth);
                fprintf(fd, "<unary_expression value=");
-               fprintf(fd, "%lld", node->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, "<unary_expression value=");
                fprintf(fd, " />\n");
                break;
        case UNARY_UNSIGNED_CONSTANT:
                print_tabs(fd, depth);
                fprintf(fd, "<unary_expression value=");
-               fprintf(fd, "%llu", node->u.unary_expression.u.signed_constant);
+               fprintf(fd, "%" PRIu64, node->u.unary_expression.u.signed_constant);
                fprintf(fd, " />\n");
                break;
        case UNARY_SBRAC:
                fprintf(fd, " />\n");
                break;
        case UNARY_SBRAC:
index 045b7d9484760a0ccaff29d46714f70f35872761..fe88647146b2a1acf31a13a9f3636b36e38b1ef5 100644 (file)
@@ -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;
                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;
 
        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;
                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;
 
        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;
                unsigned long l[2];
                unsigned long long ll[1];
        } target;
-       uint64_t readval;
+       unsigned long long readval;
 
        if (argc > 1)
                src = atoi(argv[1]);
 
        if (argc > 1)
                src = atoi(argv[1]);
index daf135076e00f1684dcb47bba611affc57cbbfc2..38a972a9c300392c467e56840df3312dad657691 100644 (file)
@@ -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,
                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;
        } 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,
                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;
        } else {
                g_array_set_size(array, array->len + 1);
                g_array_index(array, GQuark, array->len - 1) = q;
This page took 0.028951 seconds and 4 git commands to generate.