8000 Merge branch 'master' into parse-free-function · ROMSDEV/ArduinoJson@de02f9d · GitHub
[go: up one dir, main page]

Skip to content

Commit de02f9d

Browse files
committed
Merge branch 'master' into parse-free-function
2 parents ae2a966 + 729bf0a commit de02f9d

File tree

2 files changed

+18
-33
lines changed
  • src/ArduinoJson/Data
    • < 8000 a class="fgColor-default prc-Link-Link-85e08" data-muted="true" href="#diff-efe6fbe404f6cac5edca589105b2b468048be1db5151503c4fc0aa7b8ee66c37" muted="" role="presentation" tabindex="-1">JsonBuffer.hpp

2 files changed

+18
-33
lines changed

src/ArduinoJson/Data/JsonBuffer.hpp

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@
1717
#include "../TypeTraits/IsArray.hpp"
1818
#include "NonCopyable.hpp"
1919

20-
#if defined(__clang__)
21-
#pragma clang diagnostic push
22-
#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
23-
#elif defined(__GNUC__)
24-
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
25-
#pragma GCC diagnostic push
26-
#endif
27-
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
28-
#endif
29-
3020
namespace ArduinoJson {
3121
namespace Internals {
3222
// Handles the memory management (done in derived classes) and calls the
@@ -35,11 +25,6 @@ namespace Internals {
3525
// fixed memory allocation.
3626
class JsonBuffer : Internals::NonCopyable {
3727
public:
38-
// CAUTION: NO VIRTUAL DESTRUCTOR!
39-
// If we add a virtual constructor the Arduino compiler will add malloc() and
40-
// free() to the binary, adding 706 useless bytes.
41-
// virtual ~JsonBuffer() {}
42-
4328
// Duplicates a string
4429
//
4530
// char* strdup(TValue);
@@ -63,6 +48,11 @@ class JsonBuffer : Internals::NonCopyable {
6348
virtual void *alloc(size_t size) = 0;
6449

6550
protected:
51+
// CAUTION: NO VIRTUAL DESTRUCTOR!
52+
// If we add a virtual constructor the Arduino compiler will add malloc()
53+
// and free() to the binary, adding 706 useless bytes.
54+
~JsonBuffer() {}
55+
6656
// Preserve aligment if necessary
6757
static FORCE_INLINE size_t round_size_up(size_t bytes) {
6858
#if ARDUINOJSON_ENABLE_ALIGNMENT
@@ -75,11 +65,3 @@ class JsonBuffer : Internals::NonCopyable {
7565
};
7666
}
7767
}
78-
79-
#if defined(__clang__)
80-
#pragma clang diagnostic pop
81-
#elif defined(__GNUC__)
82-
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
83-
#pragma GCC diagnostic pop
84-
#endif
85-
#endif

src/ArduinoJson/Data/StaticJsonBuffer.hpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@
1010
#include "../TypeTraits/Max.hpp"
1111
#include "JsonBuffer.hpp"
1212

13-
#if defined(__clang__)
14-
#pragma clang diagnostic push
15-
#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
16-
#elif defined(__GNUC__)
17-
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
18-
#pragma GCC diagnostic push
19-
#endif
20-
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
21-
#endif
22-
2313
namespace ArduinoJson {
2414
namespace Internals {
2515
class StaticJsonBufferBase : public JsonBuffer {
@@ -82,6 +72,9 @@ class StaticJsonBufferBase : public JsonBuffer {
8272
return String(this);
8373
}
8474

75+
protected:
76+
~StaticJsonBufferBase() {}
77+
8578
private:
8679
void alignNextAlloc() {
8780
_size = round_size_up(_size);
@@ -102,6 +95,16 @@ class StaticJsonBufferBase : public JsonBuffer {
10295
size_t _size;
10396
};
10497

98+
#if defined(__clang__)
99+
#pragma clang diagnostic push
100+
#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
101+
#elif defined(__GNUC__)
102+
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
103+
#pragma GCC diagnostic push
104+
#endif
105+
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
106+
#endif
107+
105108
// Implements a JsonBuffer with fixed memory allocation.
106109
// The template paramenter CAPACITY specifies the capacity of the buffer in
107110
// bytes.

0 commit comments

Comments
 (0)
0