Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
macros.h File Reference
#include <stdio.h>
#include <stddef.h>
#include "win/win.h"
+ Include dependency graph for macros.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STR_HELPER(x)   #x
 
#define STR(x)   STR_HELPER(x)
 
#define DT_STRINGIFY_HELPER(x)   #x
 
#define DT_STRINGIFY(x)   DT_STRINGIFY_HELPER(x)
 
#define DT_RESTRICT   restrict
 
#define IS_NULL_PTR(p)
 C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on what we compare. We force here a semantic NULL check for pointers types that will fail for anything else than pointers, and make the code more explicit about what is checked. This will fail at compile time on function pointers and anything that is not a pointer.
 
#define dt_unreachable_codepath_with_desc(D)    dt_unreachable_codepath_with_caller(D, __FILE__, __LINE__, __FUNCTION__)
 
#define dt_unreachable_codepath()   dt_unreachable_codepath_with_caller("unreachable", __FILE__, __LINE__, __FUNCTION__)
 

Functions

static void dt_unreachable_codepath_with_caller (const char *description, const char *file, const int line, const char *function)
 

Macro Definition Documentation

◆ DT_RESTRICT

#define DT_RESTRICT   restrict

Definition at line 54 of file macros.h.

◆ DT_STRINGIFY

#define DT_STRINGIFY (   x)    DT_STRINGIFY_HELPER(x)

Definition at line 48 of file macros.h.

◆ DT_STRINGIFY_HELPER

#define DT_STRINGIFY_HELPER (   x)    #x

Definition at line 47 of file macros.h.

◆ dt_unreachable_codepath

#define dt_unreachable_codepath ( )    dt_unreachable_codepath_with_caller("unreachable", __FILE__, __LINE__, __FUNCTION__)

Definition at line 76 of file macros.h.

◆ dt_unreachable_codepath_with_desc

#define dt_unreachable_codepath_with_desc (   D)     dt_unreachable_codepath_with_caller(D, __FILE__, __LINE__, __FUNCTION__)

Definition at line 74 of file macros.h.

◆ IS_NULL_PTR

#define IS_NULL_PTR (   p)
Value:
({ \
(void)sizeof(char[ \
(__builtin_classify_type(_tmp) == 5) ? 1 : -1 \
]); \
_tmp == NULL; \
})
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))

C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on what we compare. We force here a semantic NULL check for pointers types that will fail for anything else than pointers, and make the code more explicit about what is checked. This will fail at compile time on function pointers and anything that is not a pointer.

Definition at line 65 of file macros.h.

◆ STR

#define STR (   x)    STR_HELPER(x)

Definition at line 45 of file macros.h.

◆ STR_HELPER

#define STR_HELPER (   x)    #x

Definition at line 42 of file macros.h.

Function Documentation

◆ dt_unreachable_codepath_with_caller()

static void dt_unreachable_codepath_with_caller ( const char *  description,
const char *  file,
const int  line,
const char *  function 
)
inlinestatic

Definition at line 77 of file macros.h.

References description(), and L.