110 lines
2.9 KiB
C++
110 lines
2.9 KiB
C++
#pragma once
|
|
|
|
// Display the value of the __cplusplus constant.
|
|
#if 0
|
|
# define VALUE_TO_STRING(x) #x
|
|
# define VALUE(x) VALUE_TO_STRING(x)
|
|
# define VAR_NAME_VALUE(var) #var "=" VALUE(var)
|
|
# pragma message(VAR_NAME_VALUE(__cplusplus))
|
|
#endif
|
|
|
|
//#undef StaticAssertAvailable
|
|
//#undef typed_enum
|
|
//#undef DefaultTemplateArgAvailable
|
|
//#undef NullptrAvailable
|
|
//#undef nullptr
|
|
//#undef WithNoExcept
|
|
//#undef WithoutNoExcept
|
|
|
|
#if defined(__cplusplus) && defined(__GNUC__)
|
|
# if __cplusplus >= 201103
|
|
# define StaticAssertAvailable 1
|
|
|
|
# define typed_enum(name, type) enum name : type
|
|
|
|
# define DefaultTemplateArgAvailable 1
|
|
|
|
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
|
|
# define WithNoExcept noexcept(true)
|
|
# define WithoutNoExcept noexcept(false)
|
|
# define AtomicStoreAvailable
|
|
# define AtomicLoadAvailable
|
|
|
|
# define NullptrAvailable 1
|
|
# define DisableNullptrConstant() _Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
|
|
# define EnableNullptrConstant() _Pragma("GCC diagnostic warning \"-Wzero-as-null-pointer-constant\"")
|
|
# endif
|
|
# endif
|
|
|
|
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
|
|
# define DiagnosticPushOptionAvailable 1
|
|
# define PushDiagnostic() _Pragma("GCC diagnostic push")
|
|
# define PopDiagnostic() _Pragma("GCC diagnostic pop")
|
|
# endif
|
|
|
|
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
|
|
# define OldStyleCastOptionAvailable 1
|
|
# define DisableOldStyleCastWarning() _Pragma("GCC diagnostic ignored \"-Wold-style-cast\"")
|
|
# define EnableOldStyleCastWarning() _Pragma("GCC diagnostic warning \"-Wold-style-cast\"")
|
|
# endif
|
|
#endif
|
|
|
|
#ifndef StaticAssertAvailable
|
|
# define StaticAssertAvailable 0
|
|
#endif
|
|
|
|
#ifndef typed_enum
|
|
# define typed_enum(name, type) enum name
|
|
#endif
|
|
|
|
#ifndef DefaultTemplateArgAvailable
|
|
# define DefaultTemplateArgAvailable 0
|
|
#endif
|
|
|
|
#ifndef NullptrAvailable
|
|
# define NullptrAvailable 0
|
|
# define DisableNullptrConstant()
|
|
# define EnableNullptrConstant()
|
|
# ifndef nullptr
|
|
# ifdef NULL
|
|
# define nullptr NULL
|
|
# else
|
|
# define nullptr 0
|
|
# endif
|
|
# endif
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
# ifndef WithNoExcept
|
|
//#pragma message "WithNoExcept empty"
|
|
# define WithNoExcept
|
|
# define WithoutNoExcept
|
|
# endif
|
|
#endif
|
|
|
|
#ifndef DiagnosticPushOptionAvailable
|
|
# define DiagnosticPushOptionAvailable 0
|
|
# define PushDiagnostic()
|
|
# define PopDiagnostic()
|
|
#endif
|
|
|
|
#ifndef OldStyleCastOptionAvailable
|
|
# define OldStyleCastOptionAvailable 0
|
|
# define DisableOldStyleCastWarning()
|
|
# define EnableOldStyleCastWarning()
|
|
#endif
|
|
|
|
#if __cplusplus < 201103L && !defined(nullptr) && !defined(FOR_ECLIPSE_ONLY)
|
|
# ifdef NULL
|
|
# define nullptr NULL
|
|
# else
|
|
# define nullptr 0
|
|
# endif
|
|
#endif
|
|
|
|
#ifndef __SIZEOF_POINTER__
|
|
# define __SIZEOF_POINTER__ (sizeof(void*))
|
|
#endif
|
|
|
|
#define WeakDecl(t) t __attribute__((weak))
|