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