Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -Werror=free-nonheap-object warning as error and add support for RVCT 4.1 ARM compiler #2268

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions include/rapidjson/allocators.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,7 @@ class MemoryPoolAllocator {
}
Clear();
BaseAllocator *a = shared_->ownBaseAllocator;
if (shared_->ownBuffer) {
baseAllocator_->Free(shared_);
}
baseAllocator_->Free(shared_->ownBuffer ? shared_ : nullptr);
RAPIDJSON_DELETE(a);
}

Expand Down
4 changes: 4 additions & 0 deletions include/rapidjson/prettywriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(c++98-compat)
#endif

#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6000000)
RAPIDJSON_DIAG_OFF(550) // variable was set but never used
#endif

RAPIDJSON_NAMESPACE_BEGIN

//! Combination of PrettyWriter format flags.
Expand Down
16 changes: 16 additions & 0 deletions include/rapidjson/rapidjson.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@
# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN
# elif defined(RAPIDJSON_DOXYGEN_RUNNING)
# define RAPIDJSON_ENDIAN
// Detect with armcc macros
# elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6000000)
# if defined(__BIG_ENDIAN)
# define RAPIDJSON_ENDIAN RAPIDJSON_BIGENDIAN
# else
# define RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN
# endif
# else
# error Unknown machine endianness detected. User needs to define RAPIDJSON_ENDIAN.
# endif
Expand Down Expand Up @@ -561,6 +568,15 @@ RAPIDJSON_NAMESPACE_END
#define RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PRAGMA(push)
#define RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_PRAGMA(pop)

#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6000000)

#define RAPIDJSON_PRAGMA(x) _Pragma(RAPIDJSON_STRINGIFY(x))
#define RAPIDJSON_DIAG_PRAGMA(x) RAPIDJSON_PRAGMA(diag_##x)

#define RAPIDJSON_DIAG_OFF(x) RAPIDJSON_DIAG_PRAGMA(suppress x)
#define RAPIDJSON_DIAG_PUSH /* ignored */
#define RAPIDJSON_DIAG_POP /* ignored */

#else

#define RAPIDJSON_DIAG_OFF(x) /* ignored */
Expand Down
3 changes: 3 additions & 0 deletions include/rapidjson/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ RAPIDJSON_DIAG_OFF(c++98-compat-pedantic)
RAPIDJSON_DIAG_OFF(variadic-macros)
#elif defined(_MSC_VER)
RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6000000)
RAPIDJSON_DIAG_OFF(1300) // inherits implicit virtual
RAPIDJSON_DIAG_OFF(2815) // empty dependent statement in while-statement
#endif

RAPIDJSON_NAMESPACE_BEGIN
Expand Down
2 changes: 2 additions & 0 deletions include/rapidjson/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ RAPIDJSON_DIAG_OFF(c++98-compat)
#elif defined(_MSC_VER)
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6000000)
RAPIDJSON_DIAG_OFF(111) // statement is unreachable
#endif

RAPIDJSON_NAMESPACE_BEGIN
Expand Down