Skip to content

Commit c3c1387

Browse files
author
Mike Essenmacher
committed
Update for Clang
Signed-off-by: Mike Essenmacher <[email protected]>
1 parent d7bec67 commit c3c1387

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

src/Runtime/jni/jnilog.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ enum { LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_FATAL };
4040
* it means the output, with a trailing '\0', fits in the buffer. \
4141
*/ \
4242
while (__i < __l && \
43-
(__k = snprintf(__p, __j, (format), ((type *)(data))[__i])) < __j) {\
43+
(__k = snprintf(__p, __j, (format), \
44+
((type *)(data))[__i])) < __j) { \
4445
assert(__k >= 0 && "snprintf write error to __p"); \
4546
__p += __k; \
4647
__j -= __k; \
@@ -73,24 +74,28 @@ enum { LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_FATAL };
7374
break; \
7475
case ONNX_TYPE_UINT16: \
7576
case ONNX_TYPE_INT16: \
76-
LOG_BUF_C_TYPE(const short, (hex) ? " %04x" : " %d", (buf), (data), (n));\
77+
LOG_BUF_C_TYPE( \
78+
const short, (hex) ? " %04x" : " %d", (buf), (data), (n)); \
7779
break; \
7880
case ONNX_TYPE_UINT32: \
7981
case ONNX_TYPE_INT32: \
8082
LOG_BUF_C_TYPE(const int, (hex) ? " %08x" : " %d", (buf), (data), (n)); \
8183
break; \
8284
case ONNX_TYPE_UINT64: \
8385
case ONNX_TYPE_INT64: \
84-
LOG_BUF_C_TYPE(const long, (hex) ? " %016x" : " %ld", (buf), (data), (n));\
86+
LOG_BUF_C_TYPE( \
87+
const long, (hex) ? " %016x" : " %ld", (buf), (data), (n)); \
8588
break; \
8689
case ONNX_TYPE_FLOAT16: \
8790
LOG_BUF_C_TYPE(const short, " %04x", (buf), (data), (n)); \
8891
break; \
8992
case ONNX_TYPE_FLOAT: \
90-
LOG_BUF_C_TYPE(const float, (hex) ? " %08x" : " %f", (buf), (data), (n));\
93+
LOG_BUF_C_TYPE( \
94+
const float, (hex) ? " %08x" : " %f", (buf), (data), (n)); \
9195
break; \
9296
case ONNX_TYPE_DOUBLE: \
93-
LOG_BUF_C_TYPE(const double, (hex) ? " %016x" : " %lf", (buf), (data), (n));\
97+
LOG_BUF_C_TYPE( \
98+
const double, (hex) ? " %016x" : " %lf", (buf), (data), (n)); \
9499
break; \
95100
default: { \
96101
int __a = sprintf((buf), " unsupported data type %d ", (type)); \
@@ -102,7 +107,7 @@ enum { LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_FATAL };
102107
#define LOG_BUF(type, buf, data, n) \
103108
LOG_BUF_ONNX_TYPE((type), (buf), (data), (n), 0)
104109
#define LOG_XBUF(type, buf, data, n) \
105-
LOG_BUF_ONNX_TYPE((type),(buf), (data), (n), 1)
110+
LOG_BUF_ONNX_TYPE((type), (buf), (data), (n), 1)
106111

107112
#define LOG_CHAR_BUF(buf, data, n) \
108113
LOG_BUF_C_TYPE(const char, "%c", (buf), (data), (n))
@@ -127,7 +132,7 @@ enum { LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_FATAL };
127132
#define LOG_DOUBLE_BUF(buf, data, n) \
128133
LOG_BUF_C_TYPE(const double, " %lf", (buf), (data), (n))
129134
#define LOG_DOUBLE_XBUF(buf, data, n) \
130-
LOG_BUF_C_TYPE(const double, " %016x", (buf), (data),(n))
135+
LOG_BUF_C_TYPE(const double, " %016x", (buf), (data), (n))
131136

132137
/* Main macro for log output */
133138
#define LOG_PRINTF(level, ...) \

src/Runtime/jni/jniwrapper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern OMTensorList *run_main_graph(OMTensorList *);
3737
* this call simply returns NULL.
3838
*/
3939
#define CHECK_CALL(type, var, call, success, ...) \
40-
type (var) = (call); \
40+
type(var) = (call); \
4141
do { \
4242
if (!(success)) { \
4343
LOG_PRINTF(LOG_ERROR, __VA_ARGS__); \
@@ -78,7 +78,7 @@ extern OMTensorList *run_main_graph(OMTensorList *);
7878
* log error and throw Java exception if the call failed.
7979
*/
8080
#define JNI_TYPE_VAR_CALL(env, type, var, call, success, ecpt, ...) \
81-
JNI_CALL((env), type (var) = (call), (success), (ecpt), __VA_ARGS__);
81+
JNI_CALL((env), type(var) = (call), (success), (ecpt), __VA_ARGS__);
8282

8383
/* Make a native library call, check success condition,
8484
* log error and throw Java exception if native code failed.
@@ -108,7 +108,7 @@ extern OMTensorList *run_main_graph(OMTensorList *);
108108
* if the call failed. Also check success condition.
109109
*/
110110
#define LIB_TYPE_VAR_CALL(type, var, call, success, env, ecpt, ...) \
111-
LIB_CALL(type (var) = (call), (success), (env), (ecpt), __VA_ARGS__);
111+
LIB_CALL(type(var) = (call), (success), (env), (ecpt), __VA_ARGS__);
112112

113113
/* Debug output of OMTensor fields */
114114
#define OMT_DEBUG( \

src/Support/SmallFPConversion.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
//
2626
// might violate the rules about strict aliasing in C++.
2727
#define BIT_CAST(TO_TYPE, TO, FROM) \
28-
TO_TYPE (TO); \
28+
TO_TYPE(TO); \
2929
static_assert(sizeof(TO) == sizeof(FROM), "only bit cast same sizes"); \
3030
memcpy(&(TO), &(FROM), sizeof(FROM))
3131

0 commit comments

Comments
 (0)