X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/57a6839dcb3bba09e8228b822b290604668416fe..340931cb2e044a2141d11567dd0f782524e32994:/icuSources/test/cintltst/tracetst.c diff --git a/icuSources/test/cintltst/tracetst.c b/icuSources/test/cintltst/tracetst.c index b22ba596..4ea7f0e2 100644 --- a/icuSources/test/cintltst/tracetst.c +++ b/icuSources/test/cintltst/tracetst.c @@ -1,3 +1,5 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /******************************************************************** * COPYRIGHT: * Copyright (c) 2003-2013, International Business Machines Corporation and @@ -47,10 +49,11 @@ addUTraceTest(TestNode** root) /* * Macro for assert style tests. */ -#define TEST_ASSERT(expr) \ -if (!(expr)) { \ - log_err("FAILED Assertion \"" #expr "\" at %s:%d.\n", __FILE__, __LINE__); \ -} +#define TEST_ASSERT(expr) UPRV_BLOCK_MACRO_BEGIN { \ + if (!(expr)) { \ + log_err("FAILED Assertion \"" #expr "\" at %s:%d.\n", __FILE__, __LINE__); \ + } \ +} UPRV_BLOCK_MACRO_END /* @@ -75,7 +78,7 @@ static void test_format(const char *format, int32_t bufCap, int32_t indent, char expectedResult[300]; /* check that local buffers are big enough for the test case */ - if (sizeof(buf) <= bufCap) { + if ((int32_t)sizeof(buf) <= bufCap) { log_err("At file:line %s:%d, requested bufCap too large.\n"); return; } @@ -113,6 +116,7 @@ static UBool gFnNameError = FALSE; static UBool gFnFormatError = FALSE; static void U_CALLCONV testTraceEntry(const void *context, int32_t fnNumber) { + (void)context; // suppress compiler warnings about unused variable const char *fnName; const char *bogusFnName; @@ -130,6 +134,7 @@ static void U_CALLCONV testTraceEntry(const void *context, int32_t fnNumber) { static void U_CALLCONV testTraceExit(const void *context, int32_t fnNumber, const char *fmt, va_list args) { + (void)context; // suppress compiler warnings about unused variable char buf[1000]; const char *fnName; const char *bogusFnName; @@ -156,6 +161,9 @@ static void U_CALLCONV testTraceExit(const void *context, int32_t fnNumber, static void U_CALLCONV testTraceData(const void *context, int32_t fnNumber, int32_t level, const char *fmt, va_list args) { + // suppress compiler warnings about unused variables + (void)context; + (void)level; char buf[1000]; const char *fnName; const char *bogusFnName; @@ -179,7 +187,8 @@ static void U_CALLCONV testTraceData(const void *context, int32_t fnNumber, int3 /* printf(" %s() %s\n", fnName, buf); */ } -static UConverter * psuedo_ucnv_open(const char *name, UErrorCode * err) +#if !ENABLE_TRACING_ORIG_VAL +static UConverter * pseudo_ucnv_open(const char *name, UErrorCode * err) { UTRACE_ENTRY_OC(UTRACE_UCNV_LOAD); @@ -188,13 +197,13 @@ static UConverter * psuedo_ucnv_open(const char *name, UErrorCode * err) UTRACE_EXIT_PTR_STATUS(NULL, *err); return NULL; } -static void psuedo_ucnv_close(UConverter * cnv) +static void pseudo_ucnv_close(UConverter * cnv) { UTRACE_ENTRY_OC(UTRACE_UCNV_UNLOAD); UTRACE_DATA1(UTRACE_OPEN_CLOSE, "unload converter %p", cnv); UTRACE_EXIT_VALUE((int32_t)TRUE); } - +#endif /* * TestTraceAPI @@ -274,9 +283,9 @@ static void TestTraceAPI() { TEST_ASSERT(U_SUCCESS(status)); ucnv_close(cnv); #else - cnv = psuedo_ucnv_open(NULL, &status); + cnv = pseudo_ucnv_open(NULL, &status); TEST_ASSERT(U_SUCCESS(status)); - psuedo_ucnv_close(cnv); + pseudo_ucnv_close(cnv); #endif TEST_ASSERT(gTraceEntryCount > 0); TEST_ASSERT(gTraceExitCount > 0); @@ -337,7 +346,7 @@ static void TestTraceAPI() { /* Null ptrs for strings, vectors */ test_format("Null string - %s", 50, 0, "Null string - *NULL*", __LINE__, NULL); - test_format("Null string - %S", 50, 0, "Null string - *NULL*", __LINE__, NULL); + test_format("Null string - %S", 50, 0, "Null string - *NULL*", __LINE__, NULL, -1); test_format("Null vector - %vc", 50, 0, "Null vector - *NULL* [00000002]", __LINE__, NULL, 2); test_format("Null vector - %vC", 50, 0, "Null vector - *NULL* [00000002]", __LINE__, NULL, 2); test_format("Null vector - %vd", 50, 0, "Null vector - *NULL* [00000002]", __LINE__, NULL, 2);