mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 03:52:16 +02:00
Enabled debug mode when PlatformIO builds in debug
This commit is contained in:
@ -7,7 +7,7 @@ project(ArduinoJson)
|
|||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
add_definitions(-DARDUINOJSON_DEBUG)
|
add_definitions(-DARDUINOJSON_DEBUG=1)
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
||||||
add_compile_options(-g -O0)
|
add_compile_options(-g -O0)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# CAUTION: this file is invoked by https://github.com/google/oss-fuzz
|
# CAUTION: this file is invoked by https://github.com/google/oss-fuzz
|
||||||
|
|
||||||
CXXFLAGS += -I../../src -DARDUINOJSON_DEBUG
|
CXXFLAGS += -I../../src -DARDUINOJSON_DEBUG=1
|
||||||
|
|
||||||
all: \
|
all: \
|
||||||
$(OUT)/json_fuzzer \
|
$(OUT)/json_fuzzer \
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef ARDUINOJSON_DEBUG
|
#include "ArduinoJson/Configuration.hpp"
|
||||||
|
|
||||||
|
#if ARDUINOJSON_DEBUG
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang system_header
|
#pragma clang system_header
|
||||||
#elif defined __GNUC__
|
#elif defined __GNUC__
|
||||||
@ -12,8 +14,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ArduinoJson/Namespace.hpp"
|
|
||||||
|
|
||||||
#include "ArduinoJson/Array/ArrayRef.hpp"
|
#include "ArduinoJson/Array/ArrayRef.hpp"
|
||||||
#include "ArduinoJson/Object/ObjectRef.hpp"
|
#include "ArduinoJson/Object/ObjectRef.hpp"
|
||||||
#include "ArduinoJson/Variant/VariantRef.hpp"
|
#include "ArduinoJson/Variant/VariantRef.hpp"
|
||||||
|
@ -210,3 +210,11 @@
|
|||||||
#ifndef ARDUINOJSON_STRING_BUFFER_SIZE
|
#ifndef ARDUINOJSON_STRING_BUFFER_SIZE
|
||||||
#define ARDUINOJSON_STRING_BUFFER_SIZE 32
|
#define ARDUINOJSON_STRING_BUFFER_SIZE 32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef ARDUINOJSON_DEBUG
|
||||||
|
#ifdef __PLATFORMIO_BUILD_DEBUG__
|
||||||
|
#define ARDUINOJSON_DEBUG 1
|
||||||
|
#else
|
||||||
|
#define ARDUINOJSON_DEBUG 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
@ -12,7 +12,7 @@ template <typename TReader>
|
|||||||
class Latch {
|
class Latch {
|
||||||
public:
|
public:
|
||||||
Latch(TReader reader) : _reader(reader), _loaded(false) {
|
Latch(TReader reader) : _reader(reader), _loaded(false) {
|
||||||
#ifdef ARDUINOJSON_DEBUG
|
#if ARDUINOJSON_DEBUG
|
||||||
_ended = false;
|
_ended = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ class Latch {
|
|||||||
void load() {
|
void load() {
|
||||||
ARDUINOJSON_ASSERT(!_ended);
|
ARDUINOJSON_ASSERT(!_ended);
|
||||||
int c = _reader.read();
|
int c = _reader.read();
|
||||||
#ifdef ARDUINOJSON_DEBUG
|
#if ARDUINOJSON_DEBUG
|
||||||
if (c <= 0)
|
if (c <= 0)
|
||||||
_ended = true;
|
_ended = true;
|
||||||
#endif
|
#endif
|
||||||
@ -47,7 +47,7 @@ class Latch {
|
|||||||
TReader _reader;
|
TReader _reader;
|
||||||
char _current;
|
char _current;
|
||||||
bool _loaded;
|
bool _loaded;
|
||||||
#ifdef ARDUINOJSON_DEBUG
|
#if ARDUINOJSON_DEBUG
|
||||||
bool _ended;
|
bool _ended;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef ARDUINOJSON_DEBUG
|
#include <ArduinoJson/Configuration.hpp>
|
||||||
|
|
||||||
|
#if ARDUINOJSON_DEBUG
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#define ARDUINOJSON_ASSERT(X) assert(X)
|
#define ARDUINOJSON_ASSERT(X) assert(X)
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user