Skip to content

Commit 274f5eb

Browse files
authored
Suppress potentially uninitialized warnings under MSVC (#40)
* Added pragmas for MSVC and Clang to disable "maybe-unitialized" warnings * Fixed duplicated #endif * Add * Excluded clang on windows from Travis-CI
1 parent ec3cc69 commit 274f5eb

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ language: cpp
33
os:
44
- linux
55
- osx
6+
- windows
67

78
compiler:
89
- gcc
910
- clang
1011

1112
script:
1213
- $CXX -std=c++11 -Wall -Wextra -pedantic -Wno-attributes -I. test/test.cpp
14+
15+
jobs:
16+
exclude:
17+
- os: windows
18+
compiler: clang

tinyutf8.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,16 @@
5252
#endif
5353
#endif
5454

55-
//! Remove -Wmaybe-uninitialized, since it is wrong for all cases in this file
56-
#if defined (__GNUC__)
55+
//! Remove Warning "-Wmaybe-uninitialized" (GCC/Clang) resp. "C4703" (MSVC), since it is wrong for all cases in this file
56+
#if defined (__clang__)
57+
#pragma clang diagnostic ignored "-Wmaybe-uninitialized"
58+
#pragma clang diagnostic push
59+
#elif defined (__GNUC__)
5760
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
5861
#pragma GCC diagnostic push
62+
#elif defined (_MSC_VER)
63+
#pragma warning(push)
64+
#pragma warning(disable:4703)
5965
#endif
6066

6167
namespace tiny_utf8_detail
@@ -4425,8 +4431,12 @@ std::istream& operator>>( std::istream& stream , utf8_string& str ){
44254431

44264432
#endif // TINY_UTF8_FORWARD_DECLARE_ONLY
44274433

4428-
#if defined (__GNUC__)
4434+
#if defined (__clang__)
4435+
#pragma clang diagnostic pop
4436+
#elif defined (__GNUC__)
44294437
#pragma GCC diagnostic pop
4438+
#elif defined (_MSC_VER)
4439+
#pragma warning(pop)
44304440
#endif
44314441

44324442
#endif // _TINY_UTF8_H_

0 commit comments

Comments
 (0)