Use uint64_t for string pointer
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 1 Nov 2022 14:48:21 +0000 (10:48 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 1 Nov 2022 14:48:21 +0000 (10:48 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/side/trace.h
src/tracer.c

index aa2d3aa2933e6838b61257c0f792c3f87f4d543a..e9e2d0ba6f87e8694e1a3087e44e9ba58fb88f8b 100644 (file)
@@ -215,7 +215,7 @@ struct side_attr_value {
 #if __HAVE_FLOAT128
                _Float128 side_float_binary128;
 #endif
-               const char *string;
+               uint64_t string;        /* const char * */
        } u;
 };
 
@@ -368,7 +368,7 @@ struct side_arg_dynamic_vec {
 #if __HAVE_FLOAT128
                                _Float128 side_float_binary128;
 #endif
-                               const char *string;
+                               uint64_t string;        /* const char * */
                        } u;
                } side_basic;
 
@@ -435,7 +435,7 @@ struct side_arg_vec {
 #if __HAVE_FLOAT128
                _Float128 side_float_binary128;
 #endif
-               const char *string;
+               uint64_t string;        /* const char * */
 
                /* Compound types */
                const struct side_arg_vec_description *side_struct;
@@ -522,7 +522,7 @@ struct side_tracer_dynamic_vla_visitor_ctx {
 #define side_attr_float_binary32(_val) { .type = SIDE_ATTR_TYPE_FLOAT_BINARY32, .u = { .side_float_binary32 = (_val) } }
 #define side_attr_float_binary64(_val) { .type = SIDE_ATTR_TYPE_FLOAT_BINARY64, .u = { .side_float_binary64 = (_val) } }
 #define side_attr_float_binary128(_val)        { .type = SIDE_ATTR_TYPE_FLOAT_BINARY128, .u = { .side_float_binary128 = (_val) } }
-#define side_attr_string(_val)         { .type = SIDE_ATTR_TYPE_STRING, .u = { .string = (_val) } }
+#define side_attr_string(_val)         { .type = SIDE_ATTR_TYPE_STRING, .u = { .string = (uintptr_t) (_val) } }
 
 /* Static field definition */
 
@@ -756,7 +756,7 @@ struct side_tracer_dynamic_vla_visitor_ctx {
 #define side_arg_float_binary64(_val)  { .type = SIDE_TYPE_FLOAT_BINARY64, .u = { .side_float_binary64 = (_val) } }
 #define side_arg_float_binary128(_val) { .type = SIDE_TYPE_FLOAT_BINARY128, .u = { .side_float_binary128 = (_val) } }
 
-#define side_arg_string(_val)          { .type = SIDE_TYPE_STRING, .u = { .string = (_val) } }
+#define side_arg_string(_val)          { .type = SIDE_TYPE_STRING, .u = { .string = (uintptr_t) (_val) } }
 #define side_arg_struct(_side_type)    { .type = SIDE_TYPE_STRUCT, .u = { .side_struct = (_side_type) } }
 #define side_arg_array(_side_type)     { .type = SIDE_TYPE_ARRAY, .u = { .side_array = (_side_type) } }
 #define side_arg_vla(_side_type)       { .type = SIDE_TYPE_VLA, .u = { .side_vla = (_side_type) } }
@@ -872,7 +872,7 @@ struct side_tracer_dynamic_vla_visitor_ctx {
                                .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
                                .byte_order = SIDE_TYPE_BYTE_ORDER_HOST, \
                                .u = { \
-                                       .string = (_val), \
+                                       .string = (uintptr_t) (_val), \
                                }, \
                        }, \
                }, \
index e8845866d2c4a03dbd7687047927de8a05d1c17c..478685c85f408ed6e5f75f32f396f24dc68e27c9 100644 (file)
@@ -173,7 +173,7 @@ void tracer_print_attr_type(const char *separator, const struct side_attr *attr)
                abort();
 #endif
        case SIDE_ATTR_TYPE_STRING:
-               printf("\"%s\"", attr->value.u.string);
+               printf("\"%s\"", (const char *)(uintptr_t) attr->value.u.string);
                break;
        default:
                fprintf(stderr, "ERROR: <UNKNOWN ATTRIBUTE TYPE>");
@@ -745,7 +745,7 @@ void tracer_print_type(const struct side_type_description *type_desc, const stru
        }
        case SIDE_TYPE_STRING:
                tracer_print_basic_type_header(type_desc);
-               printf("\"%s\"", item->u.string);
+               printf("\"%s\"", (const char *)(uintptr_t) item->u.string);
                break;
        case SIDE_TYPE_STRUCT:
                tracer_print_struct(type_desc, item->u.side_struct);
@@ -1473,7 +1473,7 @@ void tracer_print_dynamic(const struct side_arg_dynamic_vec *item)
        }
        case SIDE_DYNAMIC_TYPE_STRING:
                tracer_print_dynamic_basic_type_header(item);
-               printf("\"%s\"", item->u.side_basic.u.string);
+               printf("\"%s\"", (const char *)(uintptr_t) item->u.side_basic.u.string);
                break;
        case SIDE_DYNAMIC_TYPE_STRUCT:
                tracer_print_dynamic_struct(item->u.side_dynamic_struct);
This page took 0.025421 seconds and 4 git commands to generate.