file  common.h
 Header file for the BRL-CAD common definitions.


#define __BEGIN_DECLS
#define __END_DECLS
#define HIDDEN   /***/
#define FMAX(a, b)   (((a)>(b))?(a):(b))
#define FMIN(a, b)   (((a)<(b))?(a):(b))
#define HAVE_SSIZE_T   1
#define GCC_PREREQ(major, minor)   0
#define ICC_PREREQ(version)   0
#define __attribute__(ignore)   /* empty */
#define __format__   format
#define __printf__   printf
#define __noreturn__   noreturn
#define always_inline   noinline
#define UNUSED(parameter)   (parameter)
#define LIKELY(expression)   (expression)
#define UNLIKELY(expression)   (expression)
#define DEPRECATED   /* deprecated */
#define __STDC_VERSION__   0
#define HAVE_GCC_DIAG_PRAGMAS   (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__))
#define HAVE_CLANG_DIAG_PRAGMAS   (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 8)))


typedef ptrdiff_t ssize_t

Detailed Description

Macro Definition Documentation

#define __BEGIN_DECLS

Definition at line 73 of file common.h.

#define __END_DECLS

Definition at line 74 of file common.h.

#define HIDDEN   /***/

Definition at line 86 of file common.h.

Referenced by cho_cmd(), dmo_cmd(), fbo_cmd(), qt_setup(), and to_new_view().

#define FMIN (   a,
)    (((a)<(b))?(a):(b))
#define HAVE_SSIZE_T   1

Definition at line 120 of file common.h.

#define GCC_PREREQ (   major,
)    0

Definition at line 159 of file common.h.

#define ICC_PREREQ (   version)    0

Definition at line 180 of file common.h.

#define __attribute__ (   ignore)    /* empty */

Definition at line 189 of file common.h.

#define __format__   format

Definition at line 195 of file common.h.

#define __printf__   printf

Definition at line 196 of file common.h.

#define __noreturn__   noreturn

Definition at line 197 of file common.h.

#define always_inline   noinline

Definition at line 205 of file common.h.

#define UNUSED (   parameter)    (parameter)

UNUSED provides a common mechanism for declaring unused parameters. Use it like this:

int my_function(int argc, char **UNUSED(argv)) { ... }

Definition at line 239 of file common.h.

#define LIKELY (   expression)    (expression)

LIKELY provides a common mechanism for providing branch prediction hints to the compiler so that it can better optimize. It should be used when it's exceptionally likely that an expected code path will almost always be executed. Use it like this:

if (LIKELY(x == 1)) { ... expected code path ... }

Definition at line 261 of file common.h.

Referenced by backtrace_sigchld(), backtrace_sigint(), bu_avail_cpus(), bu_avs_free(), bu_bomb(), bu_byteorder(), bu_exit(), bu_flog(), bu_log(), bu_putchar(), and memdebug_add().

#define UNLIKELY (   expression)    (expression)

UNLIKELY provides a common mechanism for providing branch prediction hints to the compiler so that it can better optimize. It should be used when it's exceptionally unlikely that a given code path will ever be executed. Use it like this:

if (UNLIKELY(x == 0)) { ... unexpected code path ... }

Definition at line 282 of file common.h.

Referenced by _ged_results_add(), _ged_results_init(), _rb_delete(), _rb_insert(), _rb_select(), alloc(), backtrace(), bn_angle_measure(), bn_dist_pt3_line3(), bn_dist_pt3_lseg3(), bn_distsq_line3_pt3(), bn_isect_line3_line3(), bn_isect_line_lseg(), bn_isect_lseg3_lseg3(), bn_mat_fromto(), bn_vec_ortho(), bn_vlist_cmd_cnt(), bu_argv_from_path(), bu_argv_from_string(), bu_avail_cpus(), bu_avs_add(), bu_avs_add_nonunique(), bu_avs_free(), bu_avs_init(), bu_avs_new(), bu_avs_remove(), bu_backtrace(), bu_badmagic(), bu_basename(), bu_bitv_and(), bu_bitv_or(), bu_bomb(), bu_brlcad_data(), bu_brlcad_root(), bu_byteorder(), bu_ck_list(), bu_ck_list_magic(), bu_ck_malloc_ptr(), bu_close_mapped_file(), bu_cmd(), bu_cmdhist_add(), bu_cmdhist_history(), bu_color_from_rgb_floats(), bu_color_to_rgb_floats(), bu_copy_external(), bu_crashreport(), bu_cv_cookie(), bu_cv_fmt_cookie(), bu_dirname(), bu_dup_argv(), bu_fgets(), bu_file_directory(), bu_file_exists(), bu_file_symbolic(), bu_flog(), bu_free(), bu_free_argv(), bu_free_array(), bu_free_external(), bu_free_mapped_files(), bu_fwrite_external(), bu_hash_tbl_create(), bu_hexdump_external(), bu_hist_free(), bu_hook_call(), bu_key_eq_to_key_val(), bu_log(), bu_mem_barriercheck(), bu_mm_cvt(), bu_mread(), bu_nearest_units_string(), bu_nice_set(), bu_open_mapped_file(), bu_parallel(), bu_parse_mm(), bu_pr_mapped_file(), bu_prmem(), bu_ptbl_cat(), bu_ptbl_cat_uniq(), bu_ptbl_free(), bu_ptbl_init(), bu_ptbl_ins(), bu_ptbl_ins_unique(), bu_ptbl_reset(), bu_ptbl_rm(), bu_putchar(), bu_rb_delete(), bu_rb_extreme(), bu_rb_insert(), bu_rb_neighbor(), bu_rb_select(), bu_rb_set_uniqv(), bu_realloc(), bu_same_fd(), bu_same_file(), bu_scan_fastf_t(), bu_semaphore_init(), bu_setlinebuf(), bu_shader_to_key_eq(), bu_shader_to_list(), bu_str_escape(), bu_str_to_rgb(), bu_str_unescape(), bu_strdupm(), bu_strlcatm(), bu_strlcpym(), bu_struct_export(), bu_struct_get(), bu_struct_import(), bu_struct_parse(), bu_struct_print(), bu_struct_put(), bu_struct_wrap_buf(), bu_structparse_argv(), bu_structparse_get_terse_form(), bu_temp_file(), bu_units_string(), bu_vlb_initialize(), bu_vls_decode(), bu_vls_encode(), bu_vls_fwrite(), bu_vls_init(), bu_vls_init_if_uninit(), bu_vls_read(), bu_vls_spaces(), bu_vls_strcat(), bu_vls_strcpy(), bu_vls_strncat(), bu_vls_strncmp(), bu_vls_strncpy(), bu_vls_struct_item(), bu_vls_struct_item_named(), bu_vls_struct_print(), bu_vls_struct_print2(), bu_vls_substr(), bu_vls_vlscat(), bu_vls_vlscatzap(), bu_vls_vlsfree(), bu_vls_vprintf(), bu_vls_write(), bu_whereis(), bu_which(), cmdhist_record(), cmdhist_timediff(), dm_begin_dlist(), dm_close(), dm_configure_win(), dm_debug(), dm_draw(), dm_draw_begin(), dm_draw_dlist(), dm_draw_end(), dm_draw_line_2d(), dm_draw_line_3d(), dm_draw_lines_3d(), dm_draw_point_2d(), dm_draw_point_3d(), dm_draw_points_3d(), dm_draw_vlist(), dm_draw_vlist_hidden_line(), dm_end_dlist(), dm_fogHint(), dm_free_dlists(), dm_gen_dlists(), dm_get_aspect(), dm_get_bg(), dm_get_bound_flag(), dm_get_clipmax(), dm_get_clipmin(), dm_get_displaylist(), dm_get_dm_lname(), dm_get_dm_name(), dm_get_dname(), dm_get_fb(), dm_get_fg(), dm_get_fontsize(), dm_get_height(), dm_get_id(), dm_get_light_flag(), dm_get_linestyle(), dm_get_linewidth(), dm_get_mvars(), dm_get_pathname(), dm_get_perspective(), dm_get_private_vars(), dm_get_public_vars(), dm_get_stereo(), dm_get_tkname(), dm_get_transparency(), dm_get_type(), dm_get_vp(), dm_get_vparse(), dm_get_width(), dm_get_xvars(), dm_get_zbuffer(), dm_get_zclip(), dm_interp(), dm_make_current(), dm_normal(), dm_Normal2Xx(), dm_Normal2Xy(), dm_set_bg(), dm_set_bound(), dm_set_depth_mask(), dm_set_fg(), dm_set_fontsize(), dm_set_height(), dm_set_hook(), dm_set_id(), dm_set_light(), dm_set_light_flag(), dm_set_line_attr(), dm_set_linestyle(), dm_set_linewidth(), dm_set_null(), dm_set_perspective(), dm_set_transparency(), dm_set_vp(), dm_set_width(), dm_set_win_bounds(), dm_set_zbuffer(), dm_set_zclip(), dm_share_dlist(), dm_Xx2Normal(), dm_Xy2Normal(), edge_hit_ray_state(), file_access(), ged_results_clear(), ged_results_count(), ged_results_free(), has_singularity(), is_closed(), isect_ray_planar_face(), make_near_list(), nmg_break_all_es_on_v(), nmg_class_pt_euvu(), nmg_crackshells(), nmg_edge_g_fuse(), nmg_isect_eu_fu(), nmg_loop_is_ccw(), nmg_loop_plane_area2(), nmg_triangulate_shell(), parse_dmatprint(), parse_floating(), parse_key_val_to_vls(), parse_list_length(), parse_matprint(), parse_struct_lookup(), parse_vls_dmatprint(), parse_vls_matprint(), parse_vls_print_floating(), png_write(), pnt_compare_2d(), rb_rot_left(), rb_rot_right(), rt_bot_shot(), rt_bot_volume(), rt_rec_shot(), rt_shootray(), rt_sketch_surf_area(), shrink_image(), tcl_bu_mem_barriercheck(), under_sample(), and vfont_get().

#define DEPRECATED   /* deprecated */

DEPRECATED provides a common mechanism for denoting public API (e.g., functions, typedefs, variables) that is considered deprecated. Use it like this:

DEPRECATED int my_function(void);

typedef struct karma some_type DEPRECATED;

Definition at line 303 of file common.h.

#define __STDC_VERSION__   0

Definition at line 319 of file common.h.

#define HAVE_GCC_DIAG_PRAGMAS   (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__))

Definition at line 325 of file common.h.

#define HAVE_CLANG_DIAG_PRAGMAS   (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 8)))

Definition at line 328 of file common.h.


Provide a macro for different treatment of initialized extern const variables between C and C++. In C the following initialization (definition) is acceptable for external linkage:

const int var = 10;

but in C++ const is implicitly internal linkage so it must have extern qualifier:

extern const int var = 10;

Definition at line 347 of file common.h.

Typedef Documentation

typedef ptrdiff_t ssize_t

Definition at line 119 of file common.h.