clang-format: set IndentPPDirectives to AfterHash

This commit is contained in:
Benoit Blanchon
2021-06-16 21:08:01 +02:00
parent 1d24caf066
commit 4e261068a1
23 changed files with 251 additions and 249 deletions

View File

@ -4,6 +4,7 @@ BasedOnStyle: Google
Standard: Cpp03 Standard: Cpp03
AllowShortFunctionsOnASingleLine: Empty AllowShortFunctionsOnASingleLine: Empty
IncludeBlocks: Preserve IncludeBlocks: Preserve
IndentPPDirectives: AfterHash
# Always break after if to get accurate coverage # Always break after if to get accurate coverage
AllowShortIfStatementsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false

View File

@ -6,11 +6,11 @@
#include <ArduinoJson.h> #include <ArduinoJson.h>
#if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ >= 8 #if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ >= 8
#error This test requires sizeof(long) < 8 # error This test requires sizeof(long) < 8
#endif #endif
#if !ARDUINOJSON_HAS_LONG_LONG #if !ARDUINOJSON_HAS_LONG_LONG
#error This test requires C++11 # error This test requires C++11
#endif #endif
ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(long long) ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(long long)

View File

@ -6,11 +6,11 @@
#include <ArduinoJson.h> #include <ArduinoJson.h>
#if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ >= 8 #if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ >= 8
#error This test requires sizeof(long) < 8 # error This test requires sizeof(long) < 8
#endif #endif
#if !ARDUINOJSON_HAS_LONG_LONG #if !ARDUINOJSON_HAS_LONG_LONG
#error This test requires C++11 # error This test requires C++11
#endif #endif
int main() { int main() {

View File

@ -6,7 +6,7 @@
#include <catch.hpp> #include <catch.hpp>
#if defined(__clang__) #if defined(__clang__)
#define CONFLICTS_WITH_BUILTIN_OPERATOR # define CONFLICTS_WITH_BUILTIN_OPERATOR
#endif #endif
TEST_CASE("unsigned char[]") { TEST_CASE("unsigned char[]") {

View File

@ -7,11 +7,11 @@
#include "ArduinoJson/Configuration.hpp" #include "ArduinoJson/Configuration.hpp"
#if !ARDUINOJSON_DEBUG #if !ARDUINOJSON_DEBUG
#ifdef __clang__ # ifdef __clang__
#pragma clang system_header # pragma clang system_header
#elif defined __GNUC__ # elif defined __GNUC__
#pragma GCC system_header # pragma GCC system_header
#endif # endif
#endif #endif
#include "ArduinoJson/Array/ArrayRef.hpp" #include "ArduinoJson/Array/ArrayRef.hpp"

View File

@ -10,8 +10,8 @@
#include <ArduinoJson/Variant/VariantTo.hpp> #include <ArduinoJson/Variant/VariantTo.hpp>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push) # pragma warning(push)
#pragma warning(disable : 4522) # pragma warning(disable : 4522)
#endif #endif
namespace ARDUINOJSON_NAMESPACE { namespace ARDUINOJSON_NAMESPACE {
@ -189,5 +189,5 @@ class ElementProxy : public VariantOperators<ElementProxy<TArray> >,
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(pop) # pragma warning(pop)
#endif #endif

View File

@ -5,251 +5,252 @@
#pragma once #pragma once
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
#define ARDUINOJSON_HAS_LONG_LONG 1 # define ARDUINOJSON_HAS_LONG_LONG 1
#define ARDUINOJSON_HAS_NULLPTR 1 # define ARDUINOJSON_HAS_NULLPTR 1
#define ARDUINOJSON_HAS_RVALUE_REFERENCES 1 # define ARDUINOJSON_HAS_RVALUE_REFERENCES 1
#else #else
#define ARDUINOJSON_HAS_LONG_LONG 0 # define ARDUINOJSON_HAS_LONG_LONG 0
#define ARDUINOJSON_HAS_NULLPTR 0 # define ARDUINOJSON_HAS_NULLPTR 0
#define ARDUINOJSON_HAS_RVALUE_REFERENCES 0 # define ARDUINOJSON_HAS_RVALUE_REFERENCES 0
#endif #endif
#if defined(_MSC_VER) && !ARDUINOJSON_HAS_LONG_LONG #if defined(_MSC_VER) && !ARDUINOJSON_HAS_LONG_LONG
#define ARDUINOJSON_HAS_INT64 1 # define ARDUINOJSON_HAS_INT64 1
#else #else
#define ARDUINOJSON_HAS_INT64 0 # define ARDUINOJSON_HAS_INT64 0
#endif #endif
// Small or big machine? // Small or big machine?
#ifndef ARDUINOJSON_EMBEDDED_MODE #ifndef ARDUINOJSON_EMBEDDED_MODE
#if defined(ARDUINO) /* Arduino*/ \ # if defined(ARDUINO) /* Arduino*/ \
|| defined(__IAR_SYSTEMS_ICC__) /* IAR Embedded Workbench */ \ || defined(__IAR_SYSTEMS_ICC__) /* IAR Embedded Workbench */ \
|| defined(__XC) /* MPLAB XC compiler */ \ || defined(__XC) /* MPLAB XC compiler */ \
|| defined(__ARMCC_VERSION) /* Keil ARM Compiler */ \ || defined(__ARMCC_VERSION) /* Keil ARM Compiler */ \
|| defined(__AVR) /* Atmel AVR8/GNU C Compiler */ || defined(__AVR) /* Atmel AVR8/GNU C Compiler */
#define ARDUINOJSON_EMBEDDED_MODE 1 # define ARDUINOJSON_EMBEDDED_MODE 1
#else # else
#define ARDUINOJSON_EMBEDDED_MODE 0 # define ARDUINOJSON_EMBEDDED_MODE 0
#endif # endif
#endif #endif
// Auto enable std::stream if the right headers are here and no conflicting // Auto enable std::stream if the right headers are here and no conflicting
// macro is defined // macro is defined
#if !defined(ARDUINOJSON_ENABLE_STD_STREAM) && defined(__has_include) #if !defined(ARDUINOJSON_ENABLE_STD_STREAM) && defined(__has_include)
#if __has_include(<istream>) && \ # if __has_include(<istream>) && \
__has_include(<ostream>) && \ __has_include(<ostream>) && \
!defined(min) && \ !defined(min) && \
!defined(max) !defined(max)
#define ARDUINOJSON_ENABLE_STD_STREAM 1 # define ARDUINOJSON_ENABLE_STD_STREAM 1
#else # else
#define ARDUINOJSON_ENABLE_STD_STREAM 0 # define ARDUINOJSON_ENABLE_STD_STREAM 0
#endif # endif
#endif #endif
// Auto enable std::string if the right header is here and no conflicting // Auto enable std::string if the right header is here and no conflicting
// macro is defined // macro is defined
#if !defined(ARDUINOJSON_ENABLE_STD_STRING) && defined(__has_include) #if !defined(ARDUINOJSON_ENABLE_STD_STRING) && defined(__has_include)
#if __has_include(<string>) && !defined(min) && !defined(max) # if __has_include(<string>) && !defined(min) && !defined(max)
#define ARDUINOJSON_ENABLE_STD_STRING 1 # define ARDUINOJSON_ENABLE_STD_STRING 1
#else # else
#define ARDUINOJSON_ENABLE_STD_STRING 0 # define ARDUINOJSON_ENABLE_STD_STRING 0
#endif # endif
#endif #endif
#if ARDUINOJSON_EMBEDDED_MODE #if ARDUINOJSON_EMBEDDED_MODE
// Store floats by default to reduce the memory usage (issue #134) // Store floats by default to reduce the memory usage (issue #134)
#ifndef ARDUINOJSON_USE_DOUBLE # ifndef ARDUINOJSON_USE_DOUBLE
#define ARDUINOJSON_USE_DOUBLE 0 # define ARDUINOJSON_USE_DOUBLE 0
#endif # endif
// Store longs by default, because they usually match the size of a float. // Store longs by default, because they usually match the size of a float.
#ifndef ARDUINOJSON_USE_LONG_LONG # ifndef ARDUINOJSON_USE_LONG_LONG
#define ARDUINOJSON_USE_LONG_LONG 0 # define ARDUINOJSON_USE_LONG_LONG 0
#endif # endif
// Embedded systems usually don't have std::string // Embedded systems usually don't have std::string
#ifndef ARDUINOJSON_ENABLE_STD_STRING # ifndef ARDUINOJSON_ENABLE_STD_STRING
#define ARDUINOJSON_ENABLE_STD_STRING 0 # define ARDUINOJSON_ENABLE_STD_STRING 0
#endif # endif
// Embedded systems usually don't have std::stream // Embedded systems usually don't have std::stream
#ifndef ARDUINOJSON_ENABLE_STD_STREAM # ifndef ARDUINOJSON_ENABLE_STD_STREAM
#define ARDUINOJSON_ENABLE_STD_STREAM 0 # define ARDUINOJSON_ENABLE_STD_STREAM 0
#endif # endif
// Limit nesting as the stack is likely to be small // Limit nesting as the stack is likely to be small
#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT # ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
#define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10 # define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10
#endif # endif
// Number of bits to store the pointer to next node // Number of bits to store the pointer to next node
// (saves RAM but limits the number of values in a document) // (saves RAM but limits the number of values in a document)
#ifndef ARDUINOJSON_SLOT_OFFSET_SIZE # ifndef ARDUINOJSON_SLOT_OFFSET_SIZE
#if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 2 # if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 2
// Address space == 16-bit => max 127 values // Address space == 16-bit => max 127 values
#define ARDUINOJSON_SLOT_OFFSET_SIZE 1 # define ARDUINOJSON_SLOT_OFFSET_SIZE 1
#else # else
// Address space > 16-bit => max 32767 values // Address space > 16-bit => max 32767 values
#define ARDUINOJSON_SLOT_OFFSET_SIZE 2 # define ARDUINOJSON_SLOT_OFFSET_SIZE 2
#endif # endif
#endif # endif
#else // ARDUINOJSON_EMBEDDED_MODE #else // ARDUINOJSON_EMBEDDED_MODE
// On a computer we have plenty of memory so we can use doubles // On a computer we have plenty of memory so we can use doubles
#ifndef ARDUINOJSON_USE_DOUBLE # ifndef ARDUINOJSON_USE_DOUBLE
#define ARDUINOJSON_USE_DOUBLE 1 # define ARDUINOJSON_USE_DOUBLE 1
#endif # endif
// Use long long when available // Use long long when available
#ifndef ARDUINOJSON_USE_LONG_LONG # ifndef ARDUINOJSON_USE_LONG_LONG
#if ARDUINOJSON_HAS_LONG_LONG || ARDUINOJSON_HAS_INT64 # if ARDUINOJSON_HAS_LONG_LONG || ARDUINOJSON_HAS_INT64
#define ARDUINOJSON_USE_LONG_LONG 1 # define ARDUINOJSON_USE_LONG_LONG 1
#else # else
#define ARDUINOJSON_USE_LONG_LONG 0 # define ARDUINOJSON_USE_LONG_LONG 0
#endif # endif
#endif # endif
// On a computer, we can use std::string // On a computer, we can use std::string
#ifndef ARDUINOJSON_ENABLE_STD_STRING # ifndef ARDUINOJSON_ENABLE_STD_STRING
#define ARDUINOJSON_ENABLE_STD_STRING 1 # define ARDUINOJSON_ENABLE_STD_STRING 1
#endif # endif
// On a computer, we can assume std::stream // On a computer, we can assume std::stream
#ifndef ARDUINOJSON_ENABLE_STD_STREAM # ifndef ARDUINOJSON_ENABLE_STD_STREAM
#define ARDUINOJSON_ENABLE_STD_STREAM 1 # define ARDUINOJSON_ENABLE_STD_STREAM 1
#endif # endif
// On a computer, the stack is large so we can increase nesting limit // On a computer, the stack is large so we can increase nesting limit
#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT # ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
#define ARDUINOJSON_DEFAULT_NESTING_LIMIT 50 # define ARDUINOJSON_DEFAULT_NESTING_LIMIT 50
#endif # endif
// Number of bits to store the pointer to next node // Number of bits to store the pointer to next node
#ifndef ARDUINOJSON_SLOT_OFFSET_SIZE # ifndef ARDUINOJSON_SLOT_OFFSET_SIZE
#define ARDUINOJSON_SLOT_OFFSET_SIZE 4 # define ARDUINOJSON_SLOT_OFFSET_SIZE 4
#endif # endif
#endif // ARDUINOJSON_EMBEDDED_MODE #endif // ARDUINOJSON_EMBEDDED_MODE
#ifdef ARDUINO #ifdef ARDUINO
#include <Arduino.h> # include <Arduino.h>
// Enable support for Arduino's String class // Enable support for Arduino's String class
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING # ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1 # define ARDUINOJSON_ENABLE_ARDUINO_STRING 1
#endif # endif
// Enable support for Arduino's Stream class // Enable support for Arduino's Stream class
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM # ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1 # define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1
#endif # endif
// Enable support for Arduino's Print class // Enable support for Arduino's Print class
#ifndef ARDUINOJSON_ENABLE_ARDUINO_PRINT # ifndef ARDUINOJSON_ENABLE_ARDUINO_PRINT
#define ARDUINOJSON_ENABLE_ARDUINO_PRINT 1 # define ARDUINOJSON_ENABLE_ARDUINO_PRINT 1
#endif # endif
#else // ARDUINO #else // ARDUINO
// Disable support for Arduino's String class // Disable support for Arduino's String class
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING # ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 0 # define ARDUINOJSON_ENABLE_ARDUINO_STRING 0
#endif # endif
// Disable support for Arduino's Stream class // Disable support for Arduino's Stream class
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM # ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0 # define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0
#endif # endif
// Disable support for Arduino's Print class // Disable support for Arduino's Print class
#ifndef ARDUINOJSON_ENABLE_ARDUINO_PRINT # ifndef ARDUINOJSON_ENABLE_ARDUINO_PRINT
#define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0 # define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0
#endif # endif
#endif // ARDUINO #endif // ARDUINO
#ifndef ARDUINOJSON_ENABLE_PROGMEM #ifndef ARDUINOJSON_ENABLE_PROGMEM
#if defined(PROGMEM) && defined(pgm_read_byte) && defined(pgm_read_dword) && \ # if defined(PROGMEM) && defined(pgm_read_byte) && defined(pgm_read_dword) && \
defined(pgm_read_ptr) && defined(pgm_read_float) defined(pgm_read_ptr) && defined(pgm_read_float)
#define ARDUINOJSON_ENABLE_PROGMEM 1 # define ARDUINOJSON_ENABLE_PROGMEM 1
#else # else
#define ARDUINOJSON_ENABLE_PROGMEM 0 # define ARDUINOJSON_ENABLE_PROGMEM 0
#endif # endif
#endif #endif
// Convert unicode escape sequence (\u0123) to UTF-8 // Convert unicode escape sequence (\u0123) to UTF-8
#ifndef ARDUINOJSON_DECODE_UNICODE #ifndef ARDUINOJSON_DECODE_UNICODE
#define ARDUINOJSON_DECODE_UNICODE 1 # define ARDUINOJSON_DECODE_UNICODE 1
#endif #endif
// Ignore comments in input // Ignore comments in input
#ifndef ARDUINOJSON_ENABLE_COMMENTS #ifndef ARDUINOJSON_ENABLE_COMMENTS
#define ARDUINOJSON_ENABLE_COMMENTS 0 # define ARDUINOJSON_ENABLE_COMMENTS 0
#endif #endif
// Support NaN in JSON // Support NaN in JSON
#ifndef ARDUINOJSON_ENABLE_NAN #ifndef ARDUINOJSON_ENABLE_NAN
#define ARDUINOJSON_ENABLE_NAN 0 # define ARDUINOJSON_ENABLE_NAN 0
#endif #endif
// Support Infinity in JSON // Support Infinity in JSON
#ifndef ARDUINOJSON_ENABLE_INFINITY #ifndef ARDUINOJSON_ENABLE_INFINITY
#define ARDUINOJSON_ENABLE_INFINITY 0 # define ARDUINOJSON_ENABLE_INFINITY 0
#endif #endif
// Control the exponentiation threshold for big numbers // Control the exponentiation threshold for big numbers
// CAUTION: cannot be more that 1e9 !!!! // CAUTION: cannot be more that 1e9 !!!!
#ifndef ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD #ifndef ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD
#define ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD 1e7 # define ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD 1e7
#endif #endif
// Control the exponentiation threshold for small numbers // Control the exponentiation threshold for small numbers
#ifndef ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD #ifndef ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD
#define ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD 1e-5 # define ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD 1e-5
#endif #endif
#ifndef ARDUINOJSON_LITTLE_ENDIAN #ifndef ARDUINOJSON_LITTLE_ENDIAN
#if defined(_MSC_VER) || \ # if defined(_MSC_VER) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \ (defined(__BYTE_ORDER__) && \
defined(__LITTLE_ENDIAN__) || defined(__i386) || defined(__x86_64) __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
#define ARDUINOJSON_LITTLE_ENDIAN 1 defined(__LITTLE_ENDIAN__) || defined(__i386) || defined(__x86_64)
#else # define ARDUINOJSON_LITTLE_ENDIAN 1
#define ARDUINOJSON_LITTLE_ENDIAN 0 # else
#endif # define ARDUINOJSON_LITTLE_ENDIAN 0
# endif
#endif #endif
#ifndef ARDUINOJSON_ENABLE_ALIGNMENT #ifndef ARDUINOJSON_ENABLE_ALIGNMENT
#if defined(__AVR) # if defined(__AVR)
#define ARDUINOJSON_ENABLE_ALIGNMENT 0 # define ARDUINOJSON_ENABLE_ALIGNMENT 0
#else # else
#define ARDUINOJSON_ENABLE_ALIGNMENT 1 # define ARDUINOJSON_ENABLE_ALIGNMENT 1
#endif # endif
#endif #endif
#ifndef ARDUINOJSON_TAB #ifndef ARDUINOJSON_TAB
#define ARDUINOJSON_TAB " " # define ARDUINOJSON_TAB " "
#endif #endif
#ifndef ARDUINOJSON_ENABLE_STRING_DEDUPLICATION #ifndef ARDUINOJSON_ENABLE_STRING_DEDUPLICATION
#define ARDUINOJSON_ENABLE_STRING_DEDUPLICATION 1 # define ARDUINOJSON_ENABLE_STRING_DEDUPLICATION 1
#endif #endif
#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 #ifndef ARDUINOJSON_DEBUG
#ifdef __PLATFORMIO_BUILD_DEBUG__ # ifdef __PLATFORMIO_BUILD_DEBUG__
#define ARDUINOJSON_DEBUG 1 # define ARDUINOJSON_DEBUG 1
#else # else
#define ARDUINOJSON_DEBUG 0 # define ARDUINOJSON_DEBUG 0
#endif # endif
#endif #endif
#if ARDUINOJSON_HAS_NULLPTR && defined(nullptr) #if ARDUINOJSON_HAS_NULLPTR && defined(nullptr)
#error nullptr is defined as a macro. Remove the faulty #define or #undef nullptr # error nullptr is defined as a macro. Remove the faulty #define or #undef nullptr
// See https://github.com/bblanchon/ArduinoJson/issues/1355 // See https://github.com/bblanchon/ArduinoJson/issues/1355
#endif #endif

View File

@ -9,7 +9,7 @@
#include <ArduinoJson/Polyfills/static_array.hpp> #include <ArduinoJson/Polyfills/static_array.hpp>
#if ARDUINOJSON_ENABLE_STD_STREAM #if ARDUINOJSON_ENABLE_STD_STREAM
#include <ostream> # include <ostream>
#endif #endif
namespace ARDUINOJSON_NAMESPACE { namespace ARDUINOJSON_NAMESPACE {

View File

@ -40,17 +40,17 @@ struct BoundedReader {
#include <ArduinoJson/Deserialization/Readers/VariantReader.hpp> #include <ArduinoJson/Deserialization/Readers/VariantReader.hpp>
#if ARDUINOJSON_ENABLE_ARDUINO_STREAM #if ARDUINOJSON_ENABLE_ARDUINO_STREAM
#include <ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp> # include <ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp>
#endif #endif
#if ARDUINOJSON_ENABLE_ARDUINO_STRING #if ARDUINOJSON_ENABLE_ARDUINO_STRING
#include <ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp> # include <ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp>
#endif #endif
#if ARDUINOJSON_ENABLE_PROGMEM #if ARDUINOJSON_ENABLE_PROGMEM
#include <ArduinoJson/Deserialization/Readers/FlashReader.hpp> # include <ArduinoJson/Deserialization/Readers/FlashReader.hpp>
#endif #endif
#if ARDUINOJSON_ENABLE_STD_STREAM #if ARDUINOJSON_ENABLE_STD_STREAM
#include <ArduinoJson/Deserialization/Readers/StdStreamReader.hpp> # include <ArduinoJson/Deserialization/Readers/StdStreamReader.hpp>
#endif #endif

View File

@ -12,10 +12,10 @@
// we choose to ignore the problem to reduce the size of the code // we choose to ignore the problem to reduce the size of the code
// Garbage in => Garbage out // Garbage in => Garbage out
#if defined(__GNUC__) #if defined(__GNUC__)
#if __GNUC__ >= 7 # if __GNUC__ >= 7
#pragma GCC diagnostic push # pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" # pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif # endif
#endif #endif
namespace ARDUINOJSON_NAMESPACE { namespace ARDUINOJSON_NAMESPACE {
@ -61,7 +61,7 @@ class Codepoint {
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE
#if defined(__GNUC__) #if defined(__GNUC__)
#if __GNUC__ >= 8 # if __GNUC__ >= 8
#pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif # endif
#endif #endif

View File

@ -10,17 +10,17 @@
#ifndef ARDUINOJSON_NAMESPACE #ifndef ARDUINOJSON_NAMESPACE
#define ARDUINOJSON_NAMESPACE \ # define ARDUINOJSON_NAMESPACE \
ARDUINOJSON_CONCAT4( \ ARDUINOJSON_CONCAT4( \
ARDUINOJSON_CONCAT4(ArduinoJson, ARDUINOJSON_VERSION_MAJOR, \ ARDUINOJSON_CONCAT4(ArduinoJson, ARDUINOJSON_VERSION_MAJOR, \
ARDUINOJSON_VERSION_MINOR, \ ARDUINOJSON_VERSION_MINOR, \
ARDUINOJSON_VERSION_REVISION), \ ARDUINOJSON_VERSION_REVISION), \
_, \ _, \
ARDUINOJSON_HEX_DIGIT(ARDUINOJSON_ENABLE_PROGMEM, \ ARDUINOJSON_HEX_DIGIT( \
ARDUINOJSON_USE_LONG_LONG, ARDUINOJSON_USE_DOUBLE, \ ARDUINOJSON_ENABLE_PROGMEM, ARDUINOJSON_USE_LONG_LONG, \
ARDUINOJSON_ENABLE_STRING_DEDUPLICATION), \ ARDUINOJSON_USE_DOUBLE, ARDUINOJSON_ENABLE_STRING_DEDUPLICATION), \
ARDUINOJSON_HEX_DIGIT( \ ARDUINOJSON_HEX_DIGIT( \
ARDUINOJSON_ENABLE_NAN, ARDUINOJSON_ENABLE_INFINITY, \ ARDUINOJSON_ENABLE_NAN, ARDUINOJSON_ENABLE_INFINITY, \
ARDUINOJSON_ENABLE_COMMENTS, ARDUINOJSON_DECODE_UNICODE)) ARDUINOJSON_ENABLE_COMMENTS, ARDUINOJSON_DECODE_UNICODE))
#endif #endif

View File

@ -22,11 +22,11 @@ typedef unsigned long UInt;
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE
#if ARDUINOJSON_HAS_LONG_LONG && !ARDUINOJSON_USE_LONG_LONG #if ARDUINOJSON_HAS_LONG_LONG && !ARDUINOJSON_USE_LONG_LONG
#define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T) \ # define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T) \
static_assert(sizeof(T) <= sizeof(ARDUINOJSON_NAMESPACE::Integer), \ static_assert(sizeof(T) <= sizeof(ARDUINOJSON_NAMESPACE::Integer), \
"To use 64-bit integers with ArduinoJson, you must set " \ "To use 64-bit integers with ArduinoJson, you must set " \
"ARDUINOJSON_USE_LONG_LONG to 1. See " \ "ARDUINOJSON_USE_LONG_LONG to 1. See " \
"https://arduinojson.org/v6/api/config/use_long_long/"); "https://arduinojson.org/v6/api/config/use_long_long/");
#else #else
#define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T) # define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T)
#endif #endif

View File

@ -5,13 +5,13 @@
#pragma once #pragma once
#if defined(__clang__) #if defined(__clang__)
#pragma clang diagnostic push # pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion" # pragma clang diagnostic ignored "-Wconversion"
#elif defined(__GNUC__) #elif defined(__GNUC__)
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
#pragma GCC diagnostic push # pragma GCC diagnostic push
#endif # endif
#pragma GCC diagnostic ignored "-Wconversion" # pragma GCC diagnostic ignored "-Wconversion"
#endif #endif
#include <ArduinoJson/Numbers/Float.hpp> #include <ArduinoJson/Numbers/Float.hpp>
@ -99,9 +99,9 @@ TOut convertNumber(TIn value) {
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE
#if defined(__clang__) #if defined(__clang__)
#pragma clang diagnostic pop # pragma clang diagnostic pop
#elif defined(__GNUC__) #elif defined(__GNUC__)
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
#pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif # endif
#endif #endif

View File

@ -12,8 +12,8 @@
#include <ArduinoJson/Variant/VariantTo.hpp> #include <ArduinoJson/Variant/VariantTo.hpp>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push) # pragma warning(push)
#pragma warning(disable : 4522) # pragma warning(disable : 4522)
#endif #endif
namespace ARDUINOJSON_NAMESPACE { namespace ARDUINOJSON_NAMESPACE {
@ -198,5 +198,5 @@ class MemberProxy : public VariantOperators<MemberProxy<TObject, TStringRef> >,
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(pop) # pragma warning(pop)
#endif #endif

View File

@ -7,8 +7,8 @@
#include <ArduinoJson/Configuration.hpp> #include <ArduinoJson/Configuration.hpp>
#if ARDUINOJSON_DEBUG #if ARDUINOJSON_DEBUG
#include <assert.h> # include <assert.h>
#define ARDUINOJSON_ASSERT(X) assert(X) # define ARDUINOJSON_ASSERT(X) assert(X)
#else #else
#define ARDUINOJSON_ASSERT(X) ((void)0) # define ARDUINOJSON_ASSERT(X) ((void)0)
#endif #endif

View File

@ -6,49 +6,49 @@
#ifdef _MSC_VER // Visual Studio #ifdef _MSC_VER // Visual Studio
#define FORCE_INLINE // __forceinline causes C4714 when returning std::string # define FORCE_INLINE // __forceinline causes C4714 when returning std::string
#define NO_INLINE __declspec(noinline) # define NO_INLINE __declspec(noinline)
#ifndef ARDUINOJSON_DEPRECATED # ifndef ARDUINOJSON_DEPRECATED
#define ARDUINOJSON_DEPRECATED(msg) __declspec(deprecated(msg)) # define ARDUINOJSON_DEPRECATED(msg) __declspec(deprecated(msg))
#endif # endif
#elif defined(__GNUC__) // GCC or Clang #elif defined(__GNUC__) // GCC or Clang
#define FORCE_INLINE __attribute__((always_inline)) # define FORCE_INLINE __attribute__((always_inline))
#define NO_INLINE __attribute__((noinline)) # define NO_INLINE __attribute__((noinline))
#ifndef ARDUINOJSON_DEPRECATED # ifndef ARDUINOJSON_DEPRECATED
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
#define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated(msg))) # define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated(msg)))
#else # else
#define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated)) # define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated))
#endif # endif
#endif # endif
#else // Other compilers #else // Other compilers
#define FORCE_INLINE # define FORCE_INLINE
#define NO_INLINE # define NO_INLINE
#ifndef ARDUINOJSON_DEPRECATED # ifndef ARDUINOJSON_DEPRECATED
#define ARDUINOJSON_DEPRECATED(msg) # define ARDUINOJSON_DEPRECATED(msg)
#endif # endif
#endif #endif
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
#define NOEXCEPT noexcept # define NOEXCEPT noexcept
#else #else
#define NOEXCEPT throw() # define NOEXCEPT throw()
#endif #endif
#if defined(__has_attribute) #if defined(__has_attribute)
#if __has_attribute(no_sanitize) # if __has_attribute(no_sanitize)
#define ARDUINOJSON_NO_SANITIZE(check) __attribute__((no_sanitize(check))) # define ARDUINOJSON_NO_SANITIZE(check) __attribute__((no_sanitize(check)))
# else
# define ARDUINOJSON_NO_SANITIZE(check)
# endif
#else #else
#define ARDUINOJSON_NO_SANITIZE(check) # define ARDUINOJSON_NO_SANITIZE(check)
#endif
#else
#define ARDUINOJSON_NO_SANITIZE(check)
#endif #endif

View File

@ -7,8 +7,8 @@
#include "type_traits.hpp" #include "type_traits.hpp"
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push) # pragma warning(push)
#pragma warning(disable : 4310) # pragma warning(disable : 4310)
#endif #endif
namespace ARDUINOJSON_NAMESPACE { namespace ARDUINOJSON_NAMESPACE {
@ -41,5 +41,5 @@ struct numeric_limits<
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(pop) # pragma warning(pop)
#endif #endif

View File

@ -8,27 +8,27 @@
#if ARDUINOJSON_ENABLE_PROGMEM #if ARDUINOJSON_ENABLE_PROGMEM
#include <ArduinoJson/Polyfills/pgmspace_generic.hpp> # include <ArduinoJson/Polyfills/pgmspace_generic.hpp>
#ifndef ARDUINOJSON_DEFINE_STATIC_ARRAY # ifndef ARDUINOJSON_DEFINE_STATIC_ARRAY
#define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \ # define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \
static type const name[] PROGMEM = value; static type const name[] PROGMEM = value;
#endif # endif
#ifndef ARDUINOJSON_READ_STATIC_ARRAY # ifndef ARDUINOJSON_READ_STATIC_ARRAY
#define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) \ # define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) \
pgm_read<type>(name + index) pgm_read<type>(name + index)
#endif # endif
#else // i.e. ARDUINOJSON_ENABLE_PROGMEM == 0 #else // i.e. ARDUINOJSON_ENABLE_PROGMEM == 0
#ifndef ARDUINOJSON_DEFINE_STATIC_ARRAY # ifndef ARDUINOJSON_DEFINE_STATIC_ARRAY
#define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \ # define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \
static type const name[] = value; static type const name[] = value;
#endif # endif
#ifndef ARDUINOJSON_READ_STATIC_ARRAY # ifndef ARDUINOJSON_READ_STATIC_ARRAY
#define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) name[index] # define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) name[index]
#endif # endif
#endif #endif

View File

@ -7,9 +7,9 @@
#include "declval.hpp" #include "declval.hpp"
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push) # pragma warning(push)
// conversion from 'T' to 'To', possible loss of data // conversion from 'T' to 'To', possible loss of data
#pragma warning(disable : 4244) # pragma warning(disable : 4244)
#endif #endif
// clang-format off // clang-format off
@ -37,7 +37,7 @@ struct is_convertible {
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(pop) # pragma warning(pop)
#endif #endif
// clang-format off // clang-format off

View File

@ -31,17 +31,17 @@ class Writer {
#include <ArduinoJson/Serialization/Writers/StaticStringWriter.hpp> #include <ArduinoJson/Serialization/Writers/StaticStringWriter.hpp>
#if ARDUINOJSON_ENABLE_STD_STRING #if ARDUINOJSON_ENABLE_STD_STRING
#include <ArduinoJson/Serialization/Writers/StdStringWriter.hpp> # include <ArduinoJson/Serialization/Writers/StdStringWriter.hpp>
#endif #endif
#if ARDUINOJSON_ENABLE_ARDUINO_STRING #if ARDUINOJSON_ENABLE_ARDUINO_STRING
#include <ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp> # include <ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp>
#endif #endif
#if ARDUINOJSON_ENABLE_STD_STREAM #if ARDUINOJSON_ENABLE_STD_STREAM
#include <ArduinoJson/Serialization/Writers/StdStreamWriter.hpp> # include <ArduinoJson/Serialization/Writers/StdStreamWriter.hpp>
#endif #endif
#if ARDUINOJSON_ENABLE_ARDUINO_PRINT #if ARDUINOJSON_ENABLE_ARDUINO_PRINT
#include <ArduinoJson/Serialization/Writers/PrintWriter.hpp> # include <ArduinoJson/Serialization/Writers/PrintWriter.hpp>
#endif #endif

View File

@ -8,11 +8,11 @@
#include <ArduinoJson/Polyfills/type_traits.hpp> #include <ArduinoJson/Polyfills/type_traits.hpp>
#if ARDUINOJSON_ENABLE_ARDUINO_STRING #if ARDUINOJSON_ENABLE_ARDUINO_STRING
#include <Arduino.h> # include <Arduino.h>
#endif #endif
#if ARDUINOJSON_ENABLE_STD_STRING #if ARDUINOJSON_ENABLE_STD_STRING
#include <string> # include <string>
#endif #endif
namespace ARDUINOJSON_NAMESPACE { namespace ARDUINOJSON_NAMESPACE {

View File

@ -9,14 +9,14 @@
#include <ArduinoJson/Strings/SizedRamStringAdapter.hpp> #include <ArduinoJson/Strings/SizedRamStringAdapter.hpp>
#if ARDUINOJSON_ENABLE_STD_STRING #if ARDUINOJSON_ENABLE_STD_STRING
#include <ArduinoJson/Strings/StdStringAdapter.hpp> # include <ArduinoJson/Strings/StdStringAdapter.hpp>
#endif #endif
#if ARDUINOJSON_ENABLE_ARDUINO_STRING #if ARDUINOJSON_ENABLE_ARDUINO_STRING
#include <ArduinoJson/Strings/ArduinoStringAdapter.hpp> # include <ArduinoJson/Strings/ArduinoStringAdapter.hpp>
#endif #endif
#if ARDUINOJSON_ENABLE_PROGMEM #if ARDUINOJSON_ENABLE_PROGMEM
#include <ArduinoJson/Strings/FlashStringAdapter.hpp> # include <ArduinoJson/Strings/FlashStringAdapter.hpp>
#include <ArduinoJson/Strings/SizedFlashStringAdapter.hpp> # include <ArduinoJson/Strings/SizedFlashStringAdapter.hpp>
#endif #endif

View File

@ -13,11 +13,11 @@
// VariantData can't have a constructor (to be a POD), so we have no way to fix // VariantData can't have a constructor (to be a POD), so we have no way to fix
// this warning // this warning
#if defined(__GNUC__) #if defined(__GNUC__)
#if __GNUC__ >= 7 # if __GNUC__ >= 7
#pragma GCC diagnostic push # pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" # pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#pragma GCC diagnostic ignored "-Wuninitialized" # pragma GCC diagnostic ignored "-Wuninitialized"
#endif # endif
#endif #endif
namespace ARDUINOJSON_NAMESPACE { namespace ARDUINOJSON_NAMESPACE {
@ -362,7 +362,7 @@ class VariantData {
} // namespace ARDUINOJSON_NAMESPACE } // namespace ARDUINOJSON_NAMESPACE
#if defined(__GNUC__) #if defined(__GNUC__)
#if __GNUC__ >= 8 # if __GNUC__ >= 8
#pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif # endif
#endif #endif