BRL-CAD

These are definitions specific to libbu, used throughout the library. More...

Collaboration diagram for Definitions:

Files

file  defines.h
 

Macros

#define BU_ASSERT(expression_)
 Alternative for assert(3) that calls LIBBU logging+bombing. More...
 
#define BRLCAD_OK   0x0000
 
#define BRLCAD_ERROR   0x0001
 
#define BU_DIR_SEPARATOR   '/'
 
#define BU_PATH_SEPARATOR   ':'
 
#define _BU_ATTR_PRINTF12
 
#define _BU_ATTR_PRINTF23
 
#define _BU_ATTR_SCANF23
 
#define _BU_ATTR_ALWAYS_INLINE
 
#define _BU_ATTR_CONST
 
#define _BU_ATTR_PURE
 
#define _BU_ATTR_COLD
 
#define _BU_ATTR_NONNULL
 
#define _BU_ATTR_WARN_UNUSED_RESULT
 
#define _BU_ATTR_FLATTEN
 
#define BU_FORTRAN(lc, uc)   lc ## _
 

Detailed Description

These are definitions specific to libbu, used throughout the library.

Macro Definition Documentation

◆ BU_ASSERT

#define BU_ASSERT (   expression_)
Value:
if (UNLIKELY(!(expression_))) { \
const char *expression_buf_ = #expression_; \
bu_log("BU_ASSERT(%s) failure in file %s, line %d\n", \
expression_buf_, __FILE__, __LINE__); \
bu_bomb("BU_ASSERT FAILED\n"); \
}
#define UNLIKELY(expression)
Definition: common.h:379

Alternative for assert(3) that calls LIBBU logging+bombing.

This is a simple macro wrapper that logs an assertion-failure error message and aborts application execution if the specified expression is not hold true. While it is similar in use, this wrapper does not utilize assert(3) or NDEBUG but is disabled if NO_BOMBING_MACROS is defined by the configuration.

Definition at line 47 of file assert.h.

◆ BRLCAD_OK

#define BRLCAD_OK   0x0000

logic worked as expected

Definition at line 49 of file defines.h.

◆ BRLCAD_ERROR

#define BRLCAD_ERROR   0x0001

something went wrong

Definition at line 50 of file defines.h.

◆ BU_DIR_SEPARATOR

#define BU_DIR_SEPARATOR   '/'

the default directory separator character

Definition at line 65 of file defines.h.

◆ BU_PATH_SEPARATOR

#define BU_PATH_SEPARATOR   ':'

set to the path list separator character

Definition at line 79 of file defines.h.

◆ _BU_ATTR_PRINTF12

#define _BU_ATTR_PRINTF12

shorthand declaration of a printf-style functions

Definition at line 90 of file defines.h.

◆ _BU_ATTR_PRINTF23

#define _BU_ATTR_PRINTF23

Definition at line 95 of file defines.h.

◆ _BU_ATTR_SCANF23

#define _BU_ATTR_SCANF23

Definition at line 100 of file defines.h.

◆ _BU_ATTR_ALWAYS_INLINE

#define _BU_ATTR_ALWAYS_INLINE

shorthand declaration of a function that should always be inline

Definition at line 111 of file defines.h.

◆ _BU_ATTR_CONST

#define _BU_ATTR_CONST

shorthand declaration of a function that will return the exact same value for the exact same arguments. this implies it's a function that doesn't examine into any pointer values, doesn't call any non-cost functions, doesn't read globals, and has no effects except the return value.

Definition at line 124 of file defines.h.

◆ _BU_ATTR_PURE

#define _BU_ATTR_PURE

shorthand declaration of a function that depends only on its parameters and/or global variables. this implies it's a function that has no effects except the return value and, as such, can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be.

Definition at line 137 of file defines.h.

◆ _BU_ATTR_COLD

#define _BU_ATTR_COLD

shorthand declaration of a function that is not likely to be called. this is typically for debug logging and error routines.

Definition at line 147 of file defines.h.

◆ _BU_ATTR_NONNULL

#define _BU_ATTR_NONNULL

shorthand declaration of a function that doesn't accept NULL pointer arguments. if a null pointer is detected during compilation, a warning/error can be emitted.

Definition at line 158 of file defines.h.

◆ _BU_ATTR_WARN_UNUSED_RESULT

#define _BU_ATTR_WARN_UNUSED_RESULT

shorthand declaration of a function whose return value should not be ignored. a warning / error will be emitted if the caller does not use the return value.

Definition at line 169 of file defines.h.

◆ _BU_ATTR_FLATTEN

#define _BU_ATTR_FLATTEN

shorthand placed before a function definition indicating to some compilers that it should inline most of the function calls within the function. this should be used sparingly on functions that are demonstrably hot, as indicated by a profiler.

Definition at line 182 of file defines.h.

◆ BU_FORTRAN

#define BU_FORTRAN (   lc,
  uc 
)    lc ## _

This macro is used to take the 'C' function name, and convert it at compile time to the FORTRAN calling convention.

Lower case, with a trailing underscore.

Definition at line 191 of file defines.h.