2018-05-25 プライバシーポリシーを改訂いたしました。
  • R/O
  • SSH
  • HTTPS

iutest: コミット


コミットメタ情報

リビジョン1302 (tree)
日時2018-01-29 09:42:59
作者srz_zumix

ログメッセージ

fix error

git@e711e991616a28f325869fd1563eb79c6b218de3
https://github.com/srz-zumix/iutest/commit/e711e991616a28f325869fd1563eb79c6b218de3


move to type_traits

git@6add67d93a3e235f77122137cb1993710ad75b39


fix cppcheck warning

git@df8398bacedecf68cb0cc2fb0736a8eaa7e82296


update rocro cppcheck suppress setting

git@dca76b8dacd2492f9ea3ceb301f53e117c3a5f72


fix cppcheck warning

git@e1f2e50452729665b0188015a2c7fdcbaec1eaa9


Merge remote-tracking branch 'origin/master' into develop

git@ddc5b9b82427533a18b6fd90b897ad801209b513


update rocro cppcheck ignore setting

git@ef35946724deb1c310c5c646920c707f94c1d39f


fix cppcheck warning

git@af44c487c8d1b540b657f007550a8fd1a7bc96b4


fix cppcheck warning

git@4cd7bd62e410b077fc0da96cc4c1bdda374981f3


fix unused variable

git@f88be0bcf841df34cd0b0a5dbb6e02a7d22b17db

変更サマリ

差分

--- trunk/include/internal/iutest_console.hpp (revision 1301)
+++ trunk/include/internal/iutest_console.hpp (revision 1302)
@@ -123,14 +123,12 @@
123123 var::m_pLogger = logger;
124124 return pre;
125125 }
126-private:
127- static inline void color_output_impl(Color color, const char* fmt, va_list va);
128- static inline bool IsShouldUseColor(bool use_color);
129- static inline bool HasColorConsole();
130126
131-private:
132- static inline bool IsStringEqual(const char* str1, const char* str2) { return strcmp(str1, str2) == 0; }
133-
127+public:
128+ /**
129+ * @brief 色付き表示が無効かどうか
130+ * @return 真偽値
131+ */
134132 static bool IsColorModeOff()
135133 {
136134 #if defined(INCG_IRIS_IUTEST_HPP_) && !defined(IUTEST_USE_GTEST)
@@ -139,6 +137,10 @@
139137 return IUTEST_FLAG(color) == "no";
140138 #endif
141139 }
140+ /**
141+ * @brief 色付き表示が有効かどうか
142+ * @return 真偽値
143+ */
142144 static bool IsColorModeOn()
143145 {
144146 #if defined(INCG_IRIS_IUTEST_HPP_) && !defined(IUTEST_USE_GTEST)
@@ -147,6 +149,10 @@
147149 return IUTEST_FLAG(color) == "yes";
148150 #endif
149151 }
152+ /**
153+ * @brief 色付き表示が ANSI エスケープかどうか
154+ * @return 真偽値
155+ */
150156 static bool IsColorModeAnsi()
151157 {
152158 #if defined(INCG_IRIS_IUTEST_HPP_) && !defined(IUTEST_USE_GTEST)
@@ -155,6 +161,12 @@
155161 return false;
156162 #endif
157163 }
164+
165+private:
166+ static inline void color_output_impl(Color color, const char* fmt, va_list va);
167+ static inline bool IsShouldUseColor(bool use_color);
168+ static inline bool HasColorConsole();
169+ static inline bool IsStringEqual(const char* str1, const char* str2) { return strcmp(str1, str2) == 0; }
158170 };
159171
160172 inline void iuConsole::output(const char *fmt, ...)
--- trunk/include/internal/iutest_internal_defs.hpp (revision 1301)
+++ trunk/include/internal/iutest_internal_defs.hpp (revision 1302)
@@ -118,8 +118,6 @@
118118 namespace detail
119119 {
120120
121-typedef void void_t; // default template 引数用 (一部のコンパイラで = void だとエラーになるため)
122-
123121 //======================================================================
124122 // function
125123
@@ -315,64 +313,6 @@
315313 };
316314
317315 /**
318- * @brief enable_if
319-*/
320-#if !defined(IUTEST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
321-
322-template<bool B, typename T>
323-struct enable_if
324-{
325- typedef T type;
326-};
327-template<typename T>
328-struct enable_if<false, T> {};
329-
330-#else
331-
332-namespace helper
333-{
334-
335-template<bool B>
336-struct enable_if_impl_
337-{
338- template<typename T>struct inner { typedef T type; };
339-};
340-template<>
341-struct enable_if_impl_<false>
342-{
343- template<typename T>struct inner {};
344-};
345-
346-} // end of namespace helper
347-
348-template<bool B, typename T>
349-struct enable_if : public helper::enable_if_impl_<B>::template inner<T>
350-{
351-};
352-
353-#endif
354-
355-template<class COND, typename T = void_t>
356-struct enable_if_t : public enable_if<COND::value, T> {};
357-
358-/**
359- * @brief disable_if
360-*/
361-template<bool B, typename T>
362-struct disable_if : public enable_if<!B, T> {};
363-template<class COND, typename T = void_t>
364-struct disable_if_t : public disable_if<COND::value, T> {};
365-
366-template<typename T>
367-struct enabler_t
368-{
369- static void* value;
370-};
371-template<typename T>void* enabler_t<T>::value = NULL;
372-
373-typedef enabler_t<void> enabler;
374-
375-/**
376316 * @brief 型名の取得
377317 */
378318 template<typename T>
--- trunk/include/internal/iutest_string.hpp (revision 1301)
+++ trunk/include/internal/iutest_string.hpp (revision 1302)
@@ -179,14 +179,14 @@
179179 return ret;
180180 }
181181
182+IUTEST_PRAGMA_CONSTEXPR_CALLED_AT_RUNTIME_WARN_DISABLE_BEGIN()
183+
182184 inline bool IsEmpty(const char* p) { return p == NULL || *p == '\0'; }
183185 inline IUTEST_CXX_CONSTEXPR bool IsSpace(char ch) { return ch == ' ' || ch =='\t'; }
184186 inline const char* NullableString(const char* str) { return str == NULL ? "" : str; }
185187 inline IUTEST_CXX_CONSTEXPR const char* SkipSpace(const char* p)
186188 {
187-IUTEST_PRAGMA_CONSTEXPR_CALLED_AT_RUNTIME_WARN_DISABLE_BEGIN()
188189 return p == NULL ? NULL : (IsSpace(*p) ? SkipSpace(++p) : p);
189-IUTEST_PRAGMA_CONSTEXPR_CALLED_AT_RUNTIME_WARN_DISABLE_END()
190190 }
191191 inline IUTEST_CXX_CONSTEXPR const char* FindComma(const char* p)
192192 {
@@ -306,7 +306,6 @@
306306 template<typename T>
307307 inline ::std::string ToHexString(T value)
308308 {
309-IUTEST_PRAGMA_CONSTEXPR_CALLED_AT_RUNTIME_WARN_DISABLE_BEGIN()
310309 const size_t kN = sizeof(T)*2;
311310 char buf[kN + 1] = {0};
312311 for( size_t i=0; i < kN; ++i )
@@ -315,7 +314,6 @@
315314 }
316315 buf[kN] = '\0';
317316 return buf;
318-IUTEST_PRAGMA_CONSTEXPR_CALLED_AT_RUNTIME_WARN_DISABLE_END()
319317 }
320318
321319 inline ::std::string FormatIntWidth2(int value)
@@ -384,6 +382,8 @@
384382 return "";
385383 }
386384
385+IUTEST_PRAGMA_CONSTEXPR_CALLED_AT_RUNTIME_WARN_DISABLE_END()
386+
387387 //======================================================================
388388 // declare
389389 #if !IUTEST_HAS_STRINGSTREAM && !IUTEST_HAS_STRSTREAM
--- trunk/include/internal/iutest_type_traits.hpp (revision 1301)
+++ trunk/include/internal/iutest_type_traits.hpp (revision 1302)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2012-2017, Takazumi Shirayanagi\n
9+ * Copyright (C) 2012-2018, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -59,14 +59,74 @@
5959 namespace iutest_type_traits
6060 {
6161
62+typedef void void_t; // default template 引数用 (一部のコンパイラで = void だとエラーになるため)
63+
6264 /**
6365 * @brief identity
6466 */
6567 template<typename T>struct identity { typedef T type; };
6668
69+/**
70+ * @brief enable_if
71+*/
6772 #if !defined(IUTEST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
6873
74+template<bool B, typename T>
75+struct enable_if
76+{
77+ typedef T type;
78+};
79+template<typename T>
80+struct enable_if<false, T> {};
81+
82+#else
83+
84+namespace helper
85+{
86+
87+template<bool B>
88+struct enable_if_impl_
89+{
90+ template<typename T>struct inner { typedef T type; };
91+};
92+template<>
93+struct enable_if_impl_<false>
94+{
95+ template<typename T>struct inner {};
96+};
97+
98+} // end of namespace helper
99+
100+template<bool B, typename T>
101+struct enable_if : public helper::enable_if_impl_<B>::template inner<T>
102+{
103+};
104+
105+#endif
106+
107+template<class COND, typename T = void_t>
108+struct enable_if_t : public enable_if<COND::value, T> {};
109+
69110 /**
111+ * @brief disable_if
112+*/
113+template<bool B, typename T>
114+struct disable_if : public enable_if<!B, T> {};
115+template<class COND, typename T = void_t>
116+struct disable_if_t : public disable_if<COND::value, T> {};
117+
118+template<typename T>
119+struct enabler_t
120+{
121+ static void* value;
122+};
123+template<typename T>void* enabler_t<T>::value = NULL;
124+
125+typedef enabler_t<void> enabler;
126+
127+#if !defined(IUTEST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
128+
129+/**
70130 * @brief add const to pointer
71131 */
72132 template<typename T>
--- trunk/include/iutest_printers.hpp (revision 1301)
+++ trunk/include/iutest_printers.hpp (revision 1302)
@@ -191,13 +191,13 @@
191191
192192 template<typename T>
193193 inline void DefaultPtrPrintTo(T* ptr, iu_ostream* os
194- , typename enable_if_t< is_convertible<T*, const void*> >::type*& = enabler::value)
194+ , typename iutest_type_traits::enable_if_t< is_convertible<T*, const void*> >::type*& = iutest_type_traits::enabler::value)
195195 {
196196 *os << ptr;
197197 }
198198 template<typename T>
199199 inline void DefaultPtrPrintTo(T* ptr, iu_ostream* os
200- , typename disable_if_t< is_convertible<T*, const void*> >::type*& = enabler::value)
200+ , typename iutest_type_traits::disable_if_t< is_convertible<T*, const void*> >::type*& = iutest_type_traits::enabler::value)
201201 {
202202 *os << reinterpret_cast<const void*>(reinterpret_cast<type_least_t<8>::UInt>(ptr));
203203 }
@@ -303,7 +303,7 @@
303303
304304 template<typename T, int I, int SIZE>
305305 inline void PrintTupleElemTo(const T& t, iu_ostream* os
306- , typename detail::enable_if<I == 0, void>::type*& = detail::enabler::value)
306+ , typename iutest_type_traits::enable_if<I == 0, void>::type*& = iutest_type_traits::enabler::value)
307307 {
308308 IUTEST_UNUSED_VAR(t);
309309 IUTEST_UNUSED_VAR(os);
@@ -310,13 +310,13 @@
310310 }
311311 template<typename T, int I, int SIZE>
312312 inline void PrintTupleElemTo(const T& t, iu_ostream* os
313- , typename detail::enable_if<I == 1, void>::type*& = detail::enabler::value)
313+ , typename iutest_type_traits::enable_if<I == 1, void>::type*& = iutest_type_traits::enabler::value)
314314 {
315315 PrintTo(tuples::get<SIZE-I>(t), os);
316316 }
317317 template<typename T, int I, int SIZE>
318318 inline void PrintTupleElemTo(const T& t, iu_ostream* os
319- , typename detail::enable_if<(I&(~1)) != 0, void>::type*& = detail::enabler::value)
319+ , typename iutest_type_traits::enable_if<(I&(~1)) != 0, void>::type*& = iutest_type_traits::enabler::value)
320320 {
321321 PrintTo(tuples::get<SIZE-I>(t), os);
322322 *os << ", ";
--- trunk/rocro.yml (revision 1301)
+++ trunk/rocro.yml (revision 1302)
@@ -44,11 +44,18 @@
4444 - unusedFunction
4545 - "knownConditionTrueFalse:*/iutest_internal_defs.hpp"
4646 - "noExplicitConstructor:*/iutest_defs.hpp"
47+ - "noExplicitConstructor:*/iutest_any.hpp"
48+ - "unusedStructMember:*/iutest_constant.hpp"
49+ - "unusedStructMember:*/iutest_defs.hpp"
50+ - "unusedStructMember:*/iutest_type_traits.hpp"
4751 - unmatchedSuppression
4852 --max-configs: 20
4953 #--force:
5054 ignore:
5155 - test/spi_tests_decl.cpp
56+ - test/benchmark/*.cpp
57+ - tools/paiza.io/*.cpp
58+ - tools/wandbox/*.cpp
5259 - projects/**/*.c
5360 - projects/**/*.cpp
5461 thresholds:
旧リポジトリブラウザで表示