Skip to content

Commit

Permalink
Merge 42e2212 into 4874f09
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Oct 19, 2020
2 parents 4874f09 + 42e2212 commit 66085c2
Show file tree
Hide file tree
Showing 52 changed files with 578 additions and 154 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Expand Up @@ -79,6 +79,7 @@ jobs:
- name: zapcc test
run: |
make -C test clean
make -C test showcxxmacros
make -C test showcxxversion
make -C test check_stdlib
make -C test -j1 IUTEST_REQUIRE_PYTHON=1
Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -96,7 +96,8 @@ script:
- cd ./test
- |
if [ "${COVERITY_SCAN}" != '1' ] && [ "${USE_CMAKE}" != '1' ]; then
make -j4 showcxxversion ${USE_FUSED} default &&
make showcxxversion &&
make -j4 ${USE_FUSED} default &&
make test ${USE_FUSED} &&
make report
fi
Expand Down
3 changes: 2 additions & 1 deletion include/gtest/switch/iutest_switch_core.hpp
Expand Up @@ -240,7 +240,8 @@

#define IUTEST_THROUGH_ANALYSIS_ASSUME(expr, todo) \
IUTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if( bool b = true ) { \
if( bool iu_b_ = true ) { \
(void)iu_b_; \
__analysis_assume(expr); \
goto IUTEST_PP_CAT(iutest_label_analysis_assume, __LINE__); \
} else \
Expand Down
22 changes: 11 additions & 11 deletions include/impl/iutest_charcode.ipp
Expand Up @@ -185,7 +185,7 @@ IUTEST_IPP_INLINE ::std::string IUTEST_ATTRIBUTE_UNUSED_ AnyStringToMultiByteStr
#if defined(IUTEST_OS_WINDOWS) && IUTEST_MBS_CODE == IUTEST_MBS_CODE_WINDOWS31J
return win::WideStringToMultiByteString(str);
#else
const size_t length = wcslen(str) * MB_CUR_MAX + 1;
const size_t length = wcslen(str) * static_cast<size_t>(MB_CUR_MAX) + 1;
char* mbs = new char [length];
IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_BEGIN()
const size_t written = wcstombs(mbs, str, length - 1);
Expand Down Expand Up @@ -242,7 +242,7 @@ IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_END()
return ret;
#else
IUTEST_PRAGMA_WARN_PUSH()
IUTEST_PRAGMA_WARN_CAST_ALIGN()
IUTEST_PRAGMA_WARN_DISABLE_CAST_ALIGN()
return AnyStringToUTF8(reinterpret_cast<const wchar_t*>(str), num);
IUTEST_PRAGMA_WARN_POP()
#endif
Expand Down Expand Up @@ -358,36 +358,36 @@ IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_END()
return ret;
}

IUTEST_IPP_INLINE ::std::string IUTEST_ATTRIBUTE_UNUSED_ MultiByteStringToUTF8(const char* src, int num)
IUTEST_IPP_INLINE ::std::string IUTEST_ATTRIBUTE_UNUSED_ MultiByteStringToUTF8(const char* str, int num)
{
#if (defined(__STDC_ISO_10646__) || defined(_MSC_VER)) && !defined(IUTEST_OS_WINDOWS_MOBILE)
if( num == -1 )
{
num = static_cast<int>(strlen(src));
num = static_cast<int>(strlen(str));
}
::std::string str;
const char* p = src;
::std::string ret;
const char* p = str;
//char* locale = setlocale(LC_CTYPE, "JPN");
for(const char* end = src + num; p < end; )
for(const char* end = str + num; p < end; )
{
wchar_t wc=0;
const int len = iu_mbtowc(&wc, p, MB_CUR_MAX);
if( len > 1 )
{
str += AnyStringToUTF8(&wc, 1);
ret += AnyStringToUTF8(&wc, 1);
p += len;
}
else
{
str += *p;
ret += *p;
++p;
}
}
//setlocale(LC_CTYPE, locale);
return str;
return ret;
#else
IUTEST_UNUSED_VAR(num);
return src;
return str;
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions include/impl/iutest_debug.ipp
Expand Up @@ -24,10 +24,10 @@
# if _MSC_VER >= 1900
IUTEST_PRAGMA_MSC_WARN_PUSH()
IUTEST_PRAGMA_MSC_WARN_DISABLE(4091)
# include <dbghelp.h>
# include <DbgHelp.h>
IUTEST_PRAGMA_MSC_WARN_POP()
# else
# include <dbghelp.h>
# include <DbgHelp.h>
# endif
//# pragma comment (lib, "dbghelp.lib")
# endif
Expand Down
2 changes: 1 addition & 1 deletion include/impl/iutest_default_printer.ipp
Expand Up @@ -70,7 +70,7 @@ IUTEST_IPP_INLINE void DefaultResultPrintListener::OnTestStart(const TestInfo& t
IUTEST_IPP_INLINE void DefaultResultPrintListener::OnTestPartResult(const TestPartResult& test_part_result)
{
//if( test_part_result.type() == TestPartResult::kSuccess ) return;
const std::string msg = test_part_result.make_newline_message();;
const std::string msg = test_part_result.make_newline_message();
#if defined(_MSC_VER) && !defined(IUTEST_OS_WINDOWS_MOBILE)
OutputDebugStringA(msg.c_str());
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/impl/iutest_default_xml_generator.ipp
Expand Up @@ -357,7 +357,7 @@ IUTEST_IPP_INLINE ::std::string DefaultXmlGeneratorListener::EscapeXml(const cha
{
#if !defined(IUTEST_OS_WINDOWS_MOBILE)
wchar_t wc = 0;
const int len = detail::iu_mbtowc(&wc, src, MB_CUR_MAX);
const int len = detail::iu_mbtowc(&wc, src, static_cast<size_t>(MB_CUR_MAX));
if( len > 1 )
{
msg += detail::AnyStringToUTF8(&wc, 1);
Expand Down
2 changes: 1 addition & 1 deletion include/impl/iutest_port.ipp
Expand Up @@ -279,7 +279,7 @@ IUTEST_IPP_INLINE size_t FindLastPathSeparatorPosition(const char* path, size_t
{
return ::std::string::npos;
}
return p - path;
return static_cast<size_t>(p - path);
}

IUTEST_IPP_INLINE bool SetEnvironmentVariable(const char* name, const char* value)
Expand Down
4 changes: 2 additions & 2 deletions include/impl/iutest_time.ipp
Expand Up @@ -116,8 +116,8 @@ IUTEST_IPP_INLINE TimeInMillisec GetTimeInMillis()
return IUTEST_GetMillisec();

#elif IUTEST_HAS_CXX_HDR_CHRONO
return ::std::chrono::duration_cast< ::std::chrono::milliseconds >(
::std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
return static_cast<TimeInMillisec>(::std::chrono::duration_cast< ::std::chrono::milliseconds >(
::std::chrono::high_resolution_clock::now().time_since_epoch() ).count());

#elif IUTEST_HAS_GETTIMEOFDAY
timeval tv;
Expand Down
6 changes: 3 additions & 3 deletions include/internal/iutest_charcode.hpp
Expand Up @@ -42,7 +42,7 @@ namespace detail
*/
inline ::std::string AnyStringToMultiByteString(const char* str, int num = -1)
{
return num < 0 ? str : ::std::string(str, num);
return num < 0 ? str : ::std::string(str, static_cast<size_t>(num));
}

/**
Expand Down Expand Up @@ -103,7 +103,7 @@ ::std::string AnyStringToMultiByteString(const char32_t* str, int num = -1);

/**
* @brief 文字列から ::std::wstring へ変換
* @param [in] c_str = 入力
* @param [in] str = 入力
* @return wstring
*/
::std::wstring MultiByteStringToWideString(const char* str);
Expand All @@ -114,7 +114,7 @@ ::std::wstring MultiByteStringToWideString(const char* str);
* @param [in] num = 入力バッファサイズ
* @return UTF8 文字列
*/
::std::string MultiByteStringToUTF8(const char* src, int num=-1);
::std::string MultiByteStringToUTF8(const char* str, int num=-1);

/**
* @brief ワイド文字列から ::std::string へ変換
Expand Down
2 changes: 1 addition & 1 deletion include/internal/iutest_core_impl.hpp
Expand Up @@ -149,7 +149,7 @@ class UnitTestImpl
IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_BEGIN()

// _invalid_parameter_handler
static void OnInvalidParameter(const wchar_t * expression, const wchar_t * function
IUTEST_ATTRIBUTE_NORETURN_ static void OnInvalidParameter(const wchar_t * expression, const wchar_t * function
, const wchar_t * file, unsigned int line, uintptr_t pReserved);

IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_END()
Expand Down
4 changes: 2 additions & 2 deletions include/internal/iutest_internal.hpp
Expand Up @@ -462,8 +462,8 @@
#if defined(IUTEST_ANALYSIS_ASSUME_DELEGATE)
#define IUTEST_THROUGH_ANALYSIS_ASSUME_(expr, todo) \
IUTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if( bool b = true ) { \
IUTEST_UNUSED_VAR(b); \
if( bool iu_b_ = true ) { \
IUTEST_UNUSED_VAR(iu_b_); \
IUTEST_ANALYSIS_ASSUME_DELEGATE(expr); \
goto IUTEST_PP_CAT(iutest_label_analysis_assume, __LINE__); \
} else \
Expand Down
4 changes: 2 additions & 2 deletions include/internal/iutest_option_message.hpp
Expand Up @@ -104,8 +104,8 @@ inline void iuOptionMessage::ShowVersion()
/** @private */
#define IIUT_SHOW_MACRO(macro) IIUT_SHOW_MACRO_I(#macro, IUTEST_PP_TOSTRING(macro))
#define IIUT_SHOW_MACRO_I(name, value) detail::iuConsole::output("#define %s %s\n", name, value)
#define IIUT_SHOW_ENABLE_MACRO(macro) IUTEST_PP_IF(macro, IIUT_SHOW_MACRO_I(#macro, IUTEST_PP_TOSTRING(macro)), IUTEST_PP_EMPTY())
#define IIUT_SHOW_DISABLE_MACRO(macro) IUTEST_PP_IF(macro, IUTEST_PP_EMPTY(), IIUT_SHOW_MACRO_I(#macro, IUTEST_PP_TOSTRING(macro)))
#define IIUT_SHOW_ENABLE_MACRO(macro) IUTEST_PP_IF(macro, IIUT_SHOW_MACRO_I(#macro, IUTEST_PP_TOSTRING(macro)), (void)(0))
#define IIUT_SHOW_DISABLE_MACRO(macro) IUTEST_PP_IF(macro, (void)(0), IIUT_SHOW_MACRO_I(#macro, IUTEST_PP_TOSTRING(macro)))

/** @private */
#define IIUT_SHOW_FEATURE_MACROS(m) \
Expand Down
2 changes: 1 addition & 1 deletion include/internal/iutest_platform.hpp
Expand Up @@ -27,7 +27,7 @@
# if !defined(WIN32_LEAN_AND_MEAN)
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# include <Windows.h>
# if defined(_WIN32_WCE)
# define IUTEST_OS_WINDOWS_MOBILE 1
# define IUTEST_PLATFORM "Windows CE"
Expand Down
3 changes: 2 additions & 1 deletion include/internal/iutest_pp.hpp
Expand Up @@ -716,7 +716,8 @@
#define IIUT_PP_IS_EMPTY_II(x) IIUT_PP_IS_EMPTY_II_ x
#define IIUT_PP_IS_EMPTY_II_(a, b) b

#define IUTEST_PP_EMPTY()
#define IUTEST_PP_EMPTY() IUTEST_PP_EMPTY_()
#define IUTEST_PP_EMPTY_()
#define IIUT_PP_EMPTY_TAG() , 0
#define IIUT_PP_EMPTY_TAG_IIUT_PP_EMPTY_TAG 1, 1 IUTEST_PP_EMPTY

Expand Down

0 comments on commit 66085c2

Please sign in to comment.