MySQL 8.3.0
Source Code Documentation
my_compiler.h File Reference

Header for compiler-dependent features. More...

#include <assert.h>
#include <stddef.h>
#include "my_config.h"
#include "mysql/attribute.h"

Go to the source code of this file.

Macros

#define MY_ASSERT_UNREACHABLE()   __builtin_unreachable()
 
#define ALWAYS_INLINE   __attribute__((always_inline)) inline
 
#define NO_INLINE   __attribute__((noinline))
 
#define __has_attribute(x)   0
 
#define SUPPRESS_UBSAN
 
#define SUPPRESS_UBSAN_CLANG10
 
#define SUPPRESS_TSAN
 
#define STDCALL
 
#define MY_COMPILER_CPP11_PRAGMA(X)   _Pragma(#X)
 stringify parameters for C99/C++11 _Pragma(). More...
 
#define MY_COMPILER_MSVC_PRAGMA(X)   __pragma(X)
 pass parameters to MSVC's __pragma() as is. More...
 
#define MY_COMPILER_CLANG_DIAGNOSTIC_IGNORE(X)
 
#define MY_COMPILER_CLANG_DIAGNOSTIC_ERROR(X)
 
#define MY_COMPILER_GCC_DIAGNOSTIC_IGNORE(X)
 
#define MY_COMPILER_GCC_DIAGNOSTIC_ERROR(X)
 
#define MY_COMPILER_MSVC_DIAGNOSTIC_IGNORE(X)
 
#define MY_COMPILER_MSVC_DIAGNOSTIC_ERROR(X)
 
#define MY_COMPILER_DIAGNOSTIC_PUSH()
 save the compiler's diagnostic (enabled warnings, errors, ...) state More...
 
#define MY_COMPILER_DIAGNOSTIC_POP()
 restore the compiler's diagnostic (enabled warnings, errors, ...) state More...
 
#define MY_COMPILER_CLANG_WORKAROUND_TPARAM_DOCBUG()    MY_COMPILER_CLANG_DIAGNOSTIC_IGNORE("-Wdocumentation")
 ignore -Wdocumentation compiler warnings for @tparam. More...
 
#define MY_COMPILER_CLANG_WORKAROUND_REF_DOCBUG()    MY_COMPILER_CLANG_DIAGNOSTIC_IGNORE("-Wdocumentation")
 ignore -Wdocumentation compiler warnings for @see @ref More...
 
#define MY_COMPILER_CLANG_WORKAROUND_FALSE_POSITIVE_UNUSED_VARIABLE_WARNING()    MY_COMPILER_CLANG_DIAGNOSTIC_IGNORE("-Wunused-variable")
 ignore -Wunused-variable compiler warnings for @see @ref More...
 

Functions

constexpr bool likely (bool expr)
 
constexpr bool unlikely (bool expr)
 

Detailed Description

Header for compiler-dependent features.

Intended to contain a set of reusable wrappers for preprocessor macros, attributes, pragmas, and any other features that are specific to a target compiler.

Macro Definition Documentation

◆ __has_attribute

#define __has_attribute (   x)    0

◆ ALWAYS_INLINE

#define ALWAYS_INLINE   __attribute__((always_inline)) inline

◆ MY_ASSERT_UNREACHABLE

#define MY_ASSERT_UNREACHABLE ( )    __builtin_unreachable()

◆ MY_COMPILER_CLANG_DIAGNOSTIC_ERROR

#define MY_COMPILER_CLANG_DIAGNOSTIC_ERROR (   X)

◆ MY_COMPILER_CLANG_DIAGNOSTIC_IGNORE

#define MY_COMPILER_CLANG_DIAGNOSTIC_IGNORE (   X)

◆ MY_COMPILER_CLANG_WORKAROUND_FALSE_POSITIVE_UNUSED_VARIABLE_WARNING

#define MY_COMPILER_CLANG_WORKAROUND_FALSE_POSITIVE_UNUSED_VARIABLE_WARNING ( )     MY_COMPILER_CLANG_DIAGNOSTIC_IGNORE("-Wunused-variable")

ignore -Wunused-variable compiler warnings for @see @ref

...
#define MY_COMPILER_DIAGNOSTIC_PUSH()
save the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:284
#define MY_COMPILER_DIAGNOSTIC_POP()
restore the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:285
#define MY_COMPILER_CLANG_WORKAROUND_FALSE_POSITIVE_UNUSED_VARIABLE_WARNING()
ignore -Wunused-variable compiler warnings for @see @ref
Definition: my_compiler.h:355
See also
MY_COMPILER_DIAGNOSTIC_PUSH()
MY_COMPILER_DIAGNOSTIC_POP()

allows to work around false positives -Wunused-variable warnings like:

◆ MY_COMPILER_CLANG_WORKAROUND_REF_DOCBUG

#define MY_COMPILER_CLANG_WORKAROUND_REF_DOCBUG ( )     MY_COMPILER_CLANG_DIAGNOSTIC_IGNORE("-Wdocumentation")

ignore -Wdocumentation compiler warnings for @see @ref

...
#define MY_COMPILER_CLANG_WORKAROUND_REF_DOCBUG()
ignore -Wdocumentation compiler warnings for @see @ref
Definition: my_compiler.h:331
See also
MY_COMPILER_DIAGNOSTIC_PUSH()
MY_COMPILER_DIAGNOSTIC_POP()

allows to work around false positives -Wdocumentation warnings like:

◆ MY_COMPILER_CLANG_WORKAROUND_TPARAM_DOCBUG

#define MY_COMPILER_CLANG_WORKAROUND_TPARAM_DOCBUG ( )     MY_COMPILER_CLANG_DIAGNOSTIC_IGNORE("-Wdocumentation")

ignore -Wdocumentation compiler warnings for @tparam.

...
#define MY_COMPILER_CLANG_WORKAROUND_TPARAM_DOCBUG()
ignore -Wdocumentation compiler warnings for @tparam.
Definition: my_compiler.h:307
See also
MY_COMPILER_DIAGNOSTIC_PUSH()
MY_COMPILER_DIAGNOSTIC_POP()

allows to work around false positives -Wdocumentation warnings like:

◆ MY_COMPILER_CPP11_PRAGMA

#define MY_COMPILER_CPP11_PRAGMA (   X)    _Pragma(#X)

stringify parameters for C99/C++11 _Pragma().

◆ MY_COMPILER_DIAGNOSTIC_POP

#define MY_COMPILER_DIAGNOSTIC_POP ( )

restore the compiler's diagnostic (enabled warnings, errors, ...) state

See also
MY_COMPILER_DIAGNOSTIC_PUSH()

◆ MY_COMPILER_DIAGNOSTIC_PUSH

#define MY_COMPILER_DIAGNOSTIC_PUSH ( )

save the compiler's diagnostic (enabled warnings, errors, ...) state

See also
MY_COMPILER_DIAGNOSTIC_POP()

◆ MY_COMPILER_GCC_DIAGNOSTIC_ERROR

#define MY_COMPILER_GCC_DIAGNOSTIC_ERROR (   X)

◆ MY_COMPILER_GCC_DIAGNOSTIC_IGNORE

#define MY_COMPILER_GCC_DIAGNOSTIC_IGNORE (   X)

◆ MY_COMPILER_MSVC_DIAGNOSTIC_ERROR

#define MY_COMPILER_MSVC_DIAGNOSTIC_ERROR (   X)

◆ MY_COMPILER_MSVC_DIAGNOSTIC_IGNORE

#define MY_COMPILER_MSVC_DIAGNOSTIC_IGNORE (   X)

◆ MY_COMPILER_MSVC_PRAGMA

#define MY_COMPILER_MSVC_PRAGMA (   X)    __pragma(X)

pass parameters to MSVC's __pragma() as is.

◆ NO_INLINE

#define NO_INLINE   __attribute__((noinline))

◆ STDCALL

#define STDCALL

◆ SUPPRESS_TSAN

#define SUPPRESS_TSAN

◆ SUPPRESS_UBSAN

#define SUPPRESS_UBSAN

◆ SUPPRESS_UBSAN_CLANG10

#define SUPPRESS_UBSAN_CLANG10

Function Documentation

◆ likely()

constexpr bool likely ( bool  expr)
constexpr

◆ unlikely()

constexpr bool unlikely ( bool  expr)
constexpr