-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix printf format string for int_32t #80
base: master
Are you sure you want to change the base?
Conversation
Nice. Could you also check these other Just fixed the windows CI, should be working now if you rebase. |
I hope a merge is okay. Tracing uses a feature which is NOT C99 so I can't test any changes (any definition of trace level won't compile). You are right, there are other occurrences, i just never used the connxr.c file. I will look into it. |
"Tracing uses a feature which is NOT C99". Had no idea about this. Since we want to keep this as portable as possible and C99 compliant can @nopeslide have a look into it? Not strictly related to this PR so moving this discussion to #81. Let me both know what you think. |
ae5e8f5
to
c7ae51d
Compare
Additional fixed test_utils.c and connxr.c. For tracing.h I need some help, it goes over my head. |
should be quite the same. |
@Coderitter-GmbH sorry for the delay I looked into the diff --git a/include/tracing.h b/include/tracing.h
index f5fcd77a..f138ad19 100644
--- a/include/tracing.h
+++ b/include/tracing.h
#define __PREAMBLE_ABORT(FD, LEVEL) \
@@ -651,10 +651,10 @@ if (COND) { \
} \
if (__TRACE_COND(LEVEL)) { \
__VAR(LEVEL, "TENSOR", TENSOR->name, " \"%s\"\n"); \
- __VAR(LEVEL, "TENSOR", TENSOR->data_type, " %d") \
+ __VAR(LEVEL, "TENSOR", TENSOR->data_type, " %" PRId32) \
if ((TENSOR->data_type) >= _n_tensor_types) { \
__PRINT(TRACE_SYMBOL_STDOUT, " (%s)\n", _tensor_types[0]) \
- __BOUND_ERROR(0, TENSOR->data_type, 0, _n_tensor_types, "%d") \
+ __BOUND_ERROR(0, TENSOR->data_type, 0, _n_tensor_types, "%" PRId32) \
__ERROR(0, "unknown data type") \
} else { \
__PRINT(TRACE_SYMBOL_STDOUT, " (%s)\n", \ all other occurrences of $ grep -Hn '%d' include/tracing.h
include/tracing.h:671: __VAR(LEVEL, "TENSOR", TENSOR->has_data_type, " %d\n") \
include/tracing.h:682: __VAR(LEVEL, "TENSOR", TENSOR->has_raw_data, " %d\n") \
include/tracing.h:687: __VAR(LEVEL, "TENSOR", TENSOR->has_data_location, "%d\n") \
include/tracing.h:688: __VAR(LEVEL, "TENSOR", TENSOR->data_location, " %d\n") \
include/tracing.h:705: __VAR(LEVEL, "ATTRIBUTE", ATTR->type, " %d") \
include/tracing.h:708: __BOUND_ERROR(0, ATTR->type, 0, _n_attribute_types, "%d") \
include/tracing.h:715: __VAR(LEVEL, "ATTRIBUTE", ATTR->has_type, " %d\n") \
include/tracing.h:716: __VAR(LEVEL, "ATTRIBUTE", ATTR->has_f, " %d\n") \
include/tracing.h:718: __VAR(LEVEL, "ATTRIBUTE", ATTR->has_i, " %d\n") \
include/tracing.h:720: __VAR(LEVEL, "ATTRIBUTE", ATTR->has_s, " %d\n") \
include/tracing.h:893: __VAR(LEVEL, "MODEL", MODEL->has_ir_version, " %d\n") \
include/tracing.h:906: __VAR(LEVEL, "MODEL", MODEL->has_model_version, "%d\n") \ see /** Boolean type. */
typedef int protobuf_c_boolean; and the other attribute are enums with the size of an int: #ifndef PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE
#define PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(enum_name) \
, _##enum_name##_IS_INT_SIZE = INT_MAX
#endif I have no idea what other side effects these system dependent definitions have. |
If I understood it correctly protobuf encodes numbers (regardless of type) with variable length, the resulting type is only a cast and therefore not system dependent. |
I will look into it. |
fixes #76