From: Heesub Shin Date: Thu, 13 Apr 2017 02:23:50 +0000 (+0900) Subject: testcase: fix compilation error X-Git-Tag: 1.1_Public_Release~614^2~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3aa52456895bc52e6a420a156f731832f906fc10;p=rtos%2Ftinyara.git testcase: fix compilation error TC_ASSERT_EQ_CLEANUP() was written wrongly and causes compilation errors as following: CC: ta_tc/systemio/itc/itc_uart.c In file included from ta_tc/systemio/itc/itc_internal.h:22:0, from ta_tc/systemio/itc/itc_uart.c:34: ta_tc/systemio/itc/itc_uart.c: In function 'itc_iotbus_uart_write_read_p': ta_tc/systemio/itc/itc_uart.c:163:51: error: suggest parentheses around comparison in operand of '!=' [-Werror=parentheses] TC_ASSERT_EQ_CLEANUP("iotbus_uart_write", ret < 0, false, "Not able to write", iotbus_uart_stop(h_uart)); ^ ta_tc/systemio/itc/../../../tc_common.h:48:6: note: in definition of macro 'TC_ASSERT_EQ_CLEANUP' if (var != ref) {\ ^ ta_tc/systemio/itc/itc_uart.c:168:50: error: suggest parentheses around comparison in operand of '!=' [-Werror=parentheses] TC_ASSERT_EQ_CLEANUP("iotbus_uart_read", ret < 0, false, "Not able to read", iotbus_uart_stop(h_uart)); ^ ta_tc/systemio/itc/../../../tc_common.h:48:6: note: in definition of macro 'TC_ASSERT_EQ_CLEANUP' if (var != ref) {\ ^ cc1: all warnings being treated as errors This commit fixes this. Change-Id: I5b026b59e5e04925bec1c732cbb7de549d76fb7b Signed-off-by: Heesub Shin --- diff --git a/apps/examples/testcase/tc_common.h b/apps/examples/testcase/tc_common.h index e56eedb..0c10e22 100644 --- a/apps/examples/testcase/tc_common.h +++ b/apps/examples/testcase/tc_common.h @@ -45,7 +45,7 @@ int total_fail; #define TC_ASSERT_EQ_CLEANUP(api_name, var, ref, error, freeResource) \ {\ - if (var != ref) {\ + if ((var) != (ref)) {\ printf("\n[%s][Line : %d] FAIL, %s : API error returned = %s [%d] ", __func__, __LINE__, api_name, error, #var); \ total_fail++; \ freeResource; \ @@ -55,15 +55,15 @@ int total_fail; #define TC_ASSERT_EQ(api_name, var, ref) \ {\ - if (var != ref) {\ - printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) and (%s == 0x%x) are not equal\n", __func__, __LINE__, api_name, #var, (int)var, #ref, (int)ref); \ + if ((var) != (ref)) {\ + printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) and (%s == 0x%x) are not equal\n", __func__, __LINE__, api_name, #var, (int)(var), #ref, (int)(ref)); \ total_fail++; \ } \ } #define TC_ASSERT_NEQ_CLEANUP(api_name, var, ref, error, freeResource) \ {\ - if (var == ref) {\ + if ((var) == (ref)) {\ printf("\n[%s][Line : %d] FAIL, %s : API error returned = %s [%d] ", __func__, __LINE__, api_name, error, #var); \ total_fail++; \ freeResource; \ @@ -73,8 +73,8 @@ int total_fail; #define TC_ASSERT_NEQ(api_name, var, ref) \ {\ - if (var == ref) {\ - printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) and (%s == 0x%x) are equal\n", __func__, __LINE__, api_name, #var, (int)var, #ref, (int)ref); \ + if ((var) == (ref)) {\ + printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) and (%s == 0x%x) are equal\n", __func__, __LINE__, api_name, #var, (int)(var), #ref, (int)(ref)); \ total_fail++; \ return; \ } \ @@ -82,7 +82,7 @@ int total_fail; #define TC_ASSERT_GT_CLEANUP(api_name, var, ref, error, freeResource) \ {\ - if (var <= ref) {\ + if ((var) <= (ref)) {\ printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) is not greater than (%s == 0x%x)\n", __func__, __LINE__, api_name, error, #var); \ total_fail++; \ freeResource; \ @@ -92,8 +92,8 @@ int total_fail; #define TC_ASSERT_GT(api_name, var, ref) \ {\ - if (var <= ref) {\ - printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) is not greater than (%s == 0x%x)\n", __func__, __LINE__, api_name, #var, (int)var, #ref, (int)ref); \ + if ((var) <= (ref)) {\ + printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) is not greater than (%s == 0x%x)\n", __func__, __LINE__, api_name, #var, (int)(var), #ref, (int)(ref)); \ total_fail++; \ return; \ } \ @@ -101,7 +101,7 @@ int total_fail; #define TC_ASSERT_GEQ_CLEANUP(api_name, var, ref, error, freeResource) \ {\ - if (var < ref) {\ + if ((var) < (ref)) {\ printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) is not greater than or euqal to (%s == 0x%x)\n", __func__, __LINE__, api_name, error, #var); \ total_fail++; \ freeResource; \ @@ -111,8 +111,8 @@ int total_fail; #define TC_ASSERT_GEQ(api_name, var, ref) \ {\ - if (var < ref) {\ - printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) is not greater than or equal to (%s == 0x%x)\n", __func__, __LINE__, api_name, #var, (int)var, #ref, (int)ref); \ + if ((var) < (ref)) {\ + printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) is not greater than or equal to (%s == 0x%x)\n", __func__, __LINE__, api_name, #var, (int)(var), #ref, (int)(ref)); \ total_fail++; \ return; \ } \ @@ -120,8 +120,8 @@ int total_fail; #define TC_ASSERT_LT(api_name, var, ref) \ {\ - if (var >= ref) {\ - printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) is not lower than (%s == 0x%x)\n", __func__, __LINE__, api_name, #var, (int)var, #ref, (int)ref); \ + if ((var) >= (ref)) {\ + printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) is not lower than (%s == 0x%x)\n", __func__, __LINE__, api_name, #var, (int)(var), #ref, (int)(ref)); \ total_fail++; \ return; \ } \ @@ -129,8 +129,8 @@ int total_fail; #define TC_ASSERT_LEQ(api_name, var, ref) \ {\ - if (var > ref) {\ - printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) is not lower than or equal to (%s == 0x%x)\n", __func__, __LINE__, api_name, #var, (int)var, #ref, (int)ref); \ + if ((var) > (ref)) {\ + printf("\n[%s][Line : %d] FAIL, %s : Values (%s == 0x%x) is not lower than or equal to (%s == 0x%x)\n", __func__, __LINE__, api_name, #var, (int)(var), #ref, (int)(ref)); \ total_fail++; \ return; \ } \ @@ -138,7 +138,7 @@ int total_fail; #define TC_ASSERT_NOT_NULL(api_name, handle) \ {\ - if (handle == NULL) {\ + if ((handle) == NULL) {\ printf("\n[%s][Line : %d] FAIL , %s : API returned NULL ", __func__, __LINE__, api_name); \ total_fail++; \ return; \ @@ -153,7 +153,7 @@ int total_fail; #define TC_FREE_MEMORY(buffer) \ {\ - if (buffer != NULL) {\ + if ((buffer) != NULL) {\ free(buffer); \ buffer = NULL; \ } \