Ada 2.8.0
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
common_defs.h File Reference

Common definitions for cross-platform compiler support. More...

Go to the source code of this file.

Namespaces

namespace  ada
 

Macros

#define ADA_BEGIN_DEBUG_BLOCK(name)
 
#define ADA_END_DEBUG_BLOCK(name)
 
#define ADA_DEBUG_BLOCK(name, block)
 
#define ADA_ROUNDUP_N(a, n)   (((a) + ((n)-1)) & ~((n)-1))
 
#define ADA_ROUNDDOWN_N(a, n)   ((a) & ~((n)-1))
 
#define ADA_ISALIGNED_N(ptr, n)   (((uintptr_t)(ptr) & ((n)-1)) == 0)
 
#define ada_really_inline   inline __attribute__((always_inline))
 
#define ada_never_inline   inline __attribute__((noinline))
 
#define ada_unused   __attribute__((unused))
 
#define ada_warn_unused   __attribute__((warn_unused_result))
 
#define ada_likely(x)   __builtin_expect(!!(x), 1)
 
#define ada_unlikely(x)   __builtin_expect(!!(x), 0)
 
#define ADA_PUSH_DISABLE_WARNINGS   _Pragma("GCC diagnostic push")
 
#define ADA_PUSH_DISABLE_ALL_WARNINGS
 
#define ADA_PRAGMA(P)   _Pragma(#P)
 
#define ADA_DISABLE_GCC_WARNING(WARNING)    ADA_PRAGMA(GCC diagnostic ignored WARNING)
 
#define ADA_DISABLE_UNDESIRED_WARNINGS
 
#define ADA_DISABLE_DEPRECATED_WARNING    ADA_DISABLE_GCC_WARNING("-Wdeprecated-declarations")
 
#define ADA_DISABLE_STRICT_OVERFLOW_WARNING    ADA_DISABLE_GCC_WARNING("-Wstrict-overflow")
 
#define ADA_POP_DISABLE_WARNINGS   _Pragma("GCC diagnostic pop")
 
#define ADA_DLLIMPORTEXPORT
 
#define ADA_TRY(EXPR)
 If EXPR is an error, returns it.
 
#define __has_cpp_attribute(x)   0
 
#define ADA_ATTRIBUTE_NOINLINE
 
#define ada_constexpr   constexpr
 
#define ADA_IS_BIG_ENDIAN   0
 
#define ADA_IS_BIG_ENDIAN   0
 
#define ADA_DEVELOPMENT_CHECKS   1
 
#define ADA_STR(x)   #x
 
#define ADA_REQUIRE(EXPR)
 
#define ADA_FAIL(MESSAGE)
 
#define ADA_ASSERT_EQUAL(LHS, RHS, MESSAGE)
 
#define ADA_ASSERT_TRUE(COND)
 
#define ADA_ASSUME(COND)
 

Functions

void ada::unreachable ()
 

Detailed Description

Common definitions for cross-platform compiler support.

Definition in file common_defs.h.

Macro Definition Documentation

◆ __has_cpp_attribute

#define __has_cpp_attribute ( x)    0

Definition at line 156 of file common_defs.h.

◆ ADA_ASSERT_EQUAL

#define ADA_ASSERT_EQUAL ( LHS,
RHS,
MESSAGE )
Value:
do { \
if (LHS != RHS) { \
std::cerr << "Mismatch: '" << LHS << "' - '" << RHS << "'" << std::endl; \
ADA_FAIL(MESSAGE); \
} \
} while (0);

Definition at line 259 of file common_defs.h.

Referenced by ada::url_aggregator::clear_hash(), and ada::url_aggregator::clear_search().

◆ ADA_ASSERT_TRUE

◆ ADA_ASSUME

#define ADA_ASSUME ( COND)
Value:
do { \
if (!(COND)) { \
__builtin_unreachable(); \
} \
} while (0)

Definition at line 283 of file common_defs.h.

◆ ADA_ATTRIBUTE_NOINLINE

#define ADA_ATTRIBUTE_NOINLINE

Definition at line 162 of file common_defs.h.

◆ ADA_BEGIN_DEBUG_BLOCK

#define ADA_BEGIN_DEBUG_BLOCK ( name)

Definition at line 33 of file common_defs.h.

◆ ada_constexpr

#define ada_constexpr   constexpr

Definition at line 185 of file common_defs.h.

◆ ADA_DEBUG_BLOCK

#define ADA_DEBUG_BLOCK ( name,
block )

Definition at line 35 of file common_defs.h.

◆ ADA_DEVELOPMENT_CHECKS

#define ADA_DEVELOPMENT_CHECKS   1

Definition at line 242 of file common_defs.h.

◆ ADA_DISABLE_DEPRECATED_WARNING

#define ADA_DISABLE_DEPRECATED_WARNING    ADA_DISABLE_GCC_WARNING("-Wdeprecated-declarations")

Definition at line 122 of file common_defs.h.

◆ ADA_DISABLE_GCC_WARNING

#define ADA_DISABLE_GCC_WARNING ( WARNING)     ADA_PRAGMA(GCC diagnostic ignored WARNING)

Definition at line 114 of file common_defs.h.

◆ ADA_DISABLE_STRICT_OVERFLOW_WARNING

#define ADA_DISABLE_STRICT_OVERFLOW_WARNING    ADA_DISABLE_GCC_WARNING("-Wstrict-overflow")

Definition at line 124 of file common_defs.h.

◆ ADA_DISABLE_UNDESIRED_WARNINGS

#define ADA_DISABLE_UNDESIRED_WARNINGS

Definition at line 120 of file common_defs.h.

◆ ADA_DLLIMPORTEXPORT

#define ADA_DLLIMPORTEXPORT

Definition at line 142 of file common_defs.h.

◆ ADA_END_DEBUG_BLOCK

#define ADA_END_DEBUG_BLOCK ( name)

Definition at line 34 of file common_defs.h.

◆ ADA_FAIL

#define ADA_FAIL ( MESSAGE)
Value:
do { \
std::cerr << "FAIL: " << (MESSAGE) << std::endl; \
abort(); \
} while (0);

Definition at line 254 of file common_defs.h.

◆ ADA_IS_BIG_ENDIAN [1/2]

#define ADA_IS_BIG_ENDIAN   0

Definition at line 211 of file common_defs.h.

◆ ADA_IS_BIG_ENDIAN [2/2]

#define ADA_IS_BIG_ENDIAN   0

Definition at line 211 of file common_defs.h.

◆ ADA_ISALIGNED_N

#define ADA_ISALIGNED_N ( ptr,
n )   (((uintptr_t)(ptr) & ((n)-1)) == 0)

Definition at line 42 of file common_defs.h.

◆ ada_likely

#define ada_likely ( x)    __builtin_expect(!!(x), 1)

Definition at line 91 of file common_defs.h.

◆ ada_never_inline

#define ada_never_inline   inline __attribute__((noinline))

Definition at line 85 of file common_defs.h.

◆ ADA_POP_DISABLE_WARNINGS

#define ADA_POP_DISABLE_WARNINGS   _Pragma("GCC diagnostic pop")

Definition at line 126 of file common_defs.h.

◆ ADA_PRAGMA

#define ADA_PRAGMA ( P)    _Pragma(#P)

Definition at line 113 of file common_defs.h.

◆ ADA_PUSH_DISABLE_ALL_WARNINGS

#define ADA_PUSH_DISABLE_ALL_WARNINGS
Value:
ADA_PUSH_DISABLE_WARNINGS \
ADA_DISABLE_GCC_WARNING("-Weffc++") \
ADA_DISABLE_GCC_WARNING("-Wall") \
ADA_DISABLE_GCC_WARNING("-Wconversion") \
ADA_DISABLE_GCC_WARNING("-Wextra") \
ADA_DISABLE_GCC_WARNING("-Wattributes") \
ADA_DISABLE_GCC_WARNING("-Wimplicit-fallthrough") \
ADA_DISABLE_GCC_WARNING("-Wnon-virtual-dtor") \
ADA_DISABLE_GCC_WARNING("-Wreturn-type") \
ADA_DISABLE_GCC_WARNING("-Wshadow") \
ADA_DISABLE_GCC_WARNING("-Wunused-parameter") \
ADA_DISABLE_GCC_WARNING("-Wunused-variable")

Definition at line 100 of file common_defs.h.

◆ ADA_PUSH_DISABLE_WARNINGS

#define ADA_PUSH_DISABLE_WARNINGS   _Pragma("GCC diagnostic push")

Definition at line 97 of file common_defs.h.

◆ ada_really_inline

#define ada_really_inline   inline __attribute__((always_inline))

Definition at line 84 of file common_defs.h.

◆ ADA_REQUIRE

#define ADA_REQUIRE ( EXPR)
Value:
{ \
if (!(EXPR) { abort(); }) }

Definition at line 250 of file common_defs.h.

◆ ADA_ROUNDDOWN_N

#define ADA_ROUNDDOWN_N ( a,
n )   ((a) & ~((n)-1))

Definition at line 40 of file common_defs.h.

◆ ADA_ROUNDUP_N

#define ADA_ROUNDUP_N ( a,
n )   (((a) + ((n)-1)) & ~((n)-1))

Definition at line 39 of file common_defs.h.

◆ ADA_STR

#define ADA_STR ( x)    #x

Definition at line 247 of file common_defs.h.

◆ ADA_TRY

#define ADA_TRY ( EXPR)
Value:
{ \
auto _err = (EXPR); \
if (_err) { \
return _err; \
} \
}

If EXPR is an error, returns it.

Definition at line 146 of file common_defs.h.

◆ ada_unlikely

#define ada_unlikely ( x)    __builtin_expect(!!(x), 0)

Definition at line 94 of file common_defs.h.

◆ ada_unused

#define ada_unused   __attribute__((unused))

Definition at line 87 of file common_defs.h.

◆ ada_warn_unused

#define ada_warn_unused   __attribute__((warn_unused_result))

Definition at line 88 of file common_defs.h.