Skip to content

Commit 167cf75

Browse files
Fix PRINTF_ARGS Coverity issues
Fixes: ``` test/acl_device_test.cpp:350:7: Type: Invalid type in argument to printf format specifier (PRINTF_ARGS) test/acl_device_test.cpp:350:7: invalid_type: Argument "value" to format specifier "%8x" was expected to have type "unsigned int" but has type "unsigned long". src/acl_hal.cpp:123:3: path: Condition "debug_mode > 0", taking true branch. src/acl_hal.cpp:126:5: printf_function: Calling "vprintf" which uses a "printf"-style format string. [Note: The source code implementation of the function has been overridden by a builtin model.] test/acl_device_test.cpp:360:7: Type: Invalid type in argument to printf format specifier (PRINTF_ARGS) test/acl_device_test.cpp:360:7: invalid_type: Argument "value" to format specifier "%8x" was expected to have type "unsigned int" but has type "unsigned long". src/acl_hal.cpp:123:3: path: Condition "debug_mode > 0", taking true branch. src/acl_hal.cpp:126:5: printf_function: Calling "vprintf" which uses a "printf"-style format string. [Note: The source code implementation of the function has been overridden by a builtin model.] ```
1 parent 7a81c63 commit 167cf75

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

test/acl_context_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <acl_types.h>
2020
#include <acl_util.h>
2121

22+
#include <inttypes.h>
2223
#include <stdio.h>
2324
#include <stdlib.h>
2425
#include <string>
@@ -766,7 +767,7 @@ MT_TEST(Context, create_context_multi) {
766767
ACL_LOCKED(CHECK(acl_context_is_valid(context0)));
767768
ACL_LOCKED(CHECK(acl_is_valid_ptr(context0)));
768769

769-
ACL_LOCKED(acl_print_debug_msg(" newly created context0 <%lu>\n",
770+
ACL_LOCKED(acl_print_debug_msg(" newly created context0 <%" PRIu32 ">\n",
770771
acl_ref_count(context0)));
771772

772773
status = CL_INVALID_DEVICE;

test/acl_device_test.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include <acl_types.h>
1919
#include <acl_util.h>
2020

21+
#include <inttypes.h>
22+
2123
#include "acl_hal_test.h"
2224
#include "acl_test.h"
2325

@@ -347,7 +349,7 @@ MT_TEST(DeviceInfo, basic) {
347349
CHECK_EQUAL(sizeof(cl_bitfield), size_ret);
348350
cl_bitfield *ptr = (cl_bitfield *)&str[0];
349351
cl_bitfield value = *ptr;
350-
ACL_LOCKED(acl_print_debug_msg("queue prop %8x\n", value));
352+
ACL_LOCKED(acl_print_debug_msg("queue prop %8" PRIx64 "\n", value));
351353
CHECK_EQUAL(CL_QUEUE_PROFILING_ENABLE |
352354
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
353355
value);
@@ -357,7 +359,7 @@ MT_TEST(DeviceInfo, basic) {
357359
CHECK_EQUAL(sizeof(cl_bitfield), size_ret);
358360
cl_bitfield *ptr = (cl_bitfield *)&str[0];
359361
cl_bitfield value = *ptr;
360-
ACL_LOCKED(acl_print_debug_msg("fp config %8x\n", value));
362+
ACL_LOCKED(acl_print_debug_msg("fp config %8" PRIx64 "\n", value));
361363
CHECK_EQUAL((CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST), value);
362364
}
363365
// Check sanity of device avail

0 commit comments

Comments
 (0)