Minh Nguyen / ArduinoJson
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers attributes.hpp Source File

attributes.hpp

00001 // ArduinoJson - arduinojson.org
00002 // Copyright Benoit Blanchon 2014-2021
00003 // MIT License
00004 
00005 #pragma once
00006 
00007 #ifdef _MSC_VER  // Visual Studio
00008 
00009 #define FORCE_INLINE  // __forceinline causes C4714 when returning std::string
00010 #define NO_INLINE __declspec(noinline)
00011 #define DEPRECATED(msg) __declspec(deprecated(msg))
00012 
00013 #elif defined(__GNUC__)  // GCC or Clang
00014 
00015 #define FORCE_INLINE __attribute__((always_inline))
00016 #define NO_INLINE __attribute__((noinline))
00017 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
00018 #define DEPRECATED(msg) __attribute__((deprecated(msg)))
00019 #else
00020 #define DEPRECATED(msg) __attribute__((deprecated))
00021 #endif
00022 
00023 #else  // Other compilers
00024 
00025 #define FORCE_INLINE
00026 #define NO_INLINE
00027 #define DEPRECATED(msg)
00028 
00029 #endif
00030 
00031 #if __cplusplus >= 201103L
00032 #define NOEXCEPT noexcept
00033 #else
00034 #define NOEXCEPT throw()
00035 #endif
00036 
00037 #if defined(__has_attribute)
00038 #if __has_attribute(no_sanitize)
00039 #define ARDUINOJSON_NO_SANITIZE(check) __attribute__((no_sanitize(check)))
00040 #else
00041 #define ARDUINOJSON_NO_SANITIZE(check)
00042 #endif
00043 #else
00044 #define ARDUINOJSON_NO_SANITIZE(check)
00045 #endif