Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
994fdf8f
Commit
994fdf8f
authored
Jul 08, 2014
by
Milo Yip
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #55 from pah/fixes/pragma-warning
Add RAPIDJSON_DIAG_* macros to handle compiler warnings
parents
9ff95ca2
6aa601cd
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
77 additions
and
32 deletions
+77
-32
document.h
include/rapidjson/document.h
+7
-13
encodedstream.h
include/rapidjson/encodedstream.h
+3
-3
encodings.h
include/rapidjson/encodings.h
+3
-3
prettywriter.h
include/rapidjson/prettywriter.h
+3
-3
rapidjson.h
include/rapidjson/rapidjson.h
+47
-0
perftest.h
test/perftest/perftest.h
+4
-2
rapidjsontest.cpp
test/perftest/rapidjsontest.cpp
+3
-3
readertest.cpp
test/unittest/readertest.cpp
+3
-3
unittest.h
test/unittest/unittest.h
+4
-2
No files found.
include/rapidjson/document.h
View file @
994fdf8f
...
...
@@ -6,13 +6,11 @@
#include <new> // placement new
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4127) // conditional expression is constant
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF
(
4127
)
// conditional expression is constant
#elif defined(__GNUC__)
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF
(
effc
++
)
#endif
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
...
...
@@ -1168,12 +1166,8 @@ GenericValue<Encoding,Allocator>::GenericValue(const GenericValue<Encoding,Sourc
}
// namespace rapidjson
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#ifdef __GNUC__
#pragma GCC diagnostic pop
#if defined(_MSC_VER) || defined(__GNUC__)
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_DOCUMENT_H_
include/rapidjson/encodedstream.h
View file @
994fdf8f
...
...
@@ -4,8 +4,8 @@
#include "rapidjson.h"
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF
(
effc
++
)
#endif
namespace
rapidjson
{
...
...
@@ -264,7 +264,7 @@ private:
}
// namespace rapidjson
#ifdef __GNUC__
#pragma GCC diagnostic pop
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_FILESTREAM_H_
include/rapidjson/encodings.h
View file @
994fdf8f
...
...
@@ -4,8 +4,8 @@
#include "rapidjson.h"
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF
(
effc
++
)
#endif
namespace
rapidjson
{
...
...
@@ -530,7 +530,7 @@ struct Transcoder<Encoding, Encoding> {
}
// namespace rapidjson
#ifdef __GNUC__
#pragma GCC diagnostic pop
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_ENCODINGS_H_
include/rapidjson/prettywriter.h
View file @
994fdf8f
...
...
@@ -4,8 +4,8 @@
#include "writer.h"
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF
(
effc
++
)
#endif
namespace
rapidjson
{
...
...
@@ -184,7 +184,7 @@ private:
}
// namespace rapidjson
#ifdef __GNUC__
#pragma GCC diagnostic pop
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_RAPIDJSON_H_
include/rapidjson/rapidjson.h
View file @
994fdf8f
...
...
@@ -156,9 +156,56 @@ template<int x> struct StaticAssertTest {};
// Helpers
//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN
#define RAPIDJSON_MULTILINEMACRO_BEGIN do {
#define RAPIDJSON_MULTILINEMACRO_END \
}
while
((
void
)
0
,
0
)
// adopted from Boost
#define RAPIDJSON_VERSION_CODE(x,y,z) \
(((
x
)
*
100000
)
+
((
y
)
*
100
)
+
(
z
))
// token stringification
#define RAPIDJSON_STRINGIFY(x) RAPIDJSON_DO_STRINGIFY(x)
#define RAPIDJSON_DO_STRINGIFY(x) #x
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_DIAG_PUSH/POP, RAPIDJSON_DIAG_OFF
#if defined(__clang__) || (defined(__GNUC__) && RAPIDJSON_VERSION_CODE(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) >= RAPIDJSON_VERSION_CODE(4,2,0))
#define RAPIDJSON_PRAGMA(x) _Pragma(RAPIDJSON_STRINGIFY(x))
#define RAPIDJSON_DIAG_PRAGMA(x) RAPIDJSON_PRAGMA(GCC diagnostic x)
#define RAPIDJSON_DIAG_OFF(x) \
RAPIDJSON_DIAG_PRAGMA
(
ignored
RAPIDJSON_STRINGIFY
(
RAPIDJSON_JOIN
(
-
W
,
x
)))
// push/pop support in Clang and GCC>=4.6
#if defined(__clang__) || (defined(__GNUC__) && RAPIDJSON_VERSION_CODE(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) >= RAPIDJSON_VERSION_CODE(4,6,0))
#define RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PRAGMA(push)
#define RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_PRAGMA(pop)
#else // GCC >= 4.2, < 4.6
#define RAPIDJSON_DIAG_PUSH
/* ignored */
#define RAPIDJSON_DIAG_POP
/* ignored */
#endif
#elif defined(_MSC_VER)
// pragma (MSVC specific)
#define RAPIDJSON_PRAGMA(x) __pragma(x)
#define RAPIDJSON_DIAG_PRAGMA(x) RAPIDJSON_PRAGMA(warning(x))
#define RAPIDJSON_DIAG_OFF(x) RAPIDJSON_DIAG_PRAGMA(disable: x)
#define RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PRAGMA(push)
#define RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_PRAGMA(pop)
#else
#define RAPIDJSON_DIAG_OFF(x)
/* ignored */
#define RAPIDJSON_DIAG_PUSH
/* ignored */
#define RAPIDJSON_DIAG_POP
/* ignored */
#endif // RAPIDJSON_DIAG_*
//!@endcond
///////////////////////////////////////////////////////////////////////////////
...
...
test/perftest/perftest.h
View file @
994fdf8f
...
...
@@ -29,14 +29,16 @@
# define __STDC_CONSTANT_MACROS 1 // required by C++ standard
#endif
#ifdef __GNUC__
#if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
#if defined(__clang__) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Weffc++"
#endif
#include "gtest/gtest.h"
#if
def __GNUC__
#if
defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#pragma GCC diagnostic pop
#endif
...
...
test/perftest/rapidjsontest.cpp
View file @
994fdf8f
...
...
@@ -172,8 +172,8 @@ TEST_F(RapidJson, DocumentTraverse) {
}
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF
(
effc
++
)
#endif
struct
ValueCounter
:
public
BaseReaderHandler
<>
{
...
...
@@ -186,7 +186,7 @@ struct ValueCounter : public BaseReaderHandler<> {
};
#ifdef __GNUC__
#pragma GCC diagnostic pop
RAPIDJSON_DIAG_POP
#endif
TEST_F
(
RapidJson
,
DocumentAccept
)
{
...
...
test/unittest/readertest.cpp
View file @
994fdf8f
...
...
@@ -6,8 +6,8 @@
using
namespace
rapidjson
;
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF
(
effc
++
)
#endif
template
<
bool
expect
>
...
...
@@ -707,5 +707,5 @@ TEST(Reader, Parse_IStreamWrapper_StringStream) {
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
RAPIDJSON_DIAG_POP
#endif
test/unittest/unittest.h
View file @
994fdf8f
...
...
@@ -13,14 +13,16 @@
#pragma warning(disable : 4996) // 'function': was declared deprecated
#endif
#ifdef __GNUC__
#if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
#if defined(__clang__) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Weffc++"
#endif
#include "gtest/gtest.h"
#if
def __GNUC__
#if
defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#pragma GCC diagnostic pop
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment