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 BRLCAD_HELP   0x0002
 
#define BRLCAD_MORE   0x0004
 
#define BRLCAD_QUIET   0x0008
 
#define BRLCAD_UNKNOWN   0x0010
 
#define BRLCAD_EXIT   0x0020
 
#define BU_DIR_SEPARATOR   '/'
 
#define BU_PATH_SEPARATOR   ':'
 
#define _BU_ATTR_PRINTF12
 
#define _BU_ATTR_PRINTF23
 
#define _BU_ATTR_SCANF23
 
#define _BU_ATTR_NORETURN
 
#define _BU_ATTR_ANALYZE_NORETURN
 
#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:388

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

All okay return code, not a maskable result. Callers should not rely on the numerical value.

Definition at line 51 of file defines.h.

◆ BRLCAD_ERROR

#define BRLCAD_ERROR   0x0001

Possible maskable return codes from BRL-CAD functions. Callers should not rely on the actual values or exact numerical equalities but should instead test via masking. something went wrong, the action was not performed

Definition at line 58 of file defines.h.

◆ BRLCAD_HELP

#define BRLCAD_HELP   0x0002

invalid specification, result contains usage

Definition at line 59 of file defines.h.

◆ BRLCAD_MORE

#define BRLCAD_MORE   0x0004

incomplete specification, can specify again interactively

Definition at line 60 of file defines.h.

◆ BRLCAD_QUIET

#define BRLCAD_QUIET   0x0008

don't set or modify the result string

Definition at line 61 of file defines.h.

◆ BRLCAD_UNKNOWN

#define BRLCAD_UNKNOWN   0x0010

argv[0] was not a known command

Definition at line 62 of file defines.h.

◆ BRLCAD_EXIT

#define BRLCAD_EXIT   0x0020

command is requesting a clean application shutdown

Definition at line 63 of file defines.h.

◆ BU_DIR_SEPARATOR

#define BU_DIR_SEPARATOR   '/'

the default directory separator character

Definition at line 78 of file defines.h.

◆ BU_PATH_SEPARATOR

#define BU_PATH_SEPARATOR   ':'

set to the path list separator character

Definition at line 92 of file defines.h.

◆ _BU_ATTR_PRINTF12

#define _BU_ATTR_PRINTF12

shorthand declaration of a printf-style functions

Definition at line 103 of file defines.h.

◆ _BU_ATTR_PRINTF23

#define _BU_ATTR_PRINTF23

Definition at line 108 of file defines.h.

◆ _BU_ATTR_SCANF23

#define _BU_ATTR_SCANF23

Definition at line 113 of file defines.h.

◆ _BU_ATTR_NORETURN

#define _BU_ATTR_NORETURN

shorthand declaration of a function that doesn't return

Definition at line 122 of file defines.h.

◆ _BU_ATTR_ANALYZE_NORETURN

#define _BU_ATTR_ANALYZE_NORETURN

Definition at line 132 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 142 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 155 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 168 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 178 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 189 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 200 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 213 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 222 of file defines.h.