Fix REUSE licensing/copyright issues in `tests/utils`
[babeltrace.git] / src / common / macros.h
index 6a3e061d5f17464222d85701e96a0cbf6e871121..ad4218c445f98caf104223b1499783f70ceb209d 100644 (file)
@@ -21,14 +21,12 @@ extern "C" {
        ((type) (a) > (type) (b) ? (type) (a) : (type) (b))
 
 /*
- * BT_HIDDEN: set the hidden attribute for internal functions
- * On Windows, symbols are local unless explicitly exported,
- * see https://gcc.gnu.org/wiki/Visibility
+ * BT_EXPORT: set the visibility for exported functions.
  */
 #if defined(_WIN32) || defined(__CYGWIN__)
-#define BT_HIDDEN
+#define BT_EXPORT
 #else
-#define BT_HIDDEN __attribute__((visibility("hidden")))
+#define BT_EXPORT __attribute__((visibility("default")))
 #endif
 
 /*
@@ -54,6 +52,10 @@ extern "C" {
                _ref;                   \
        })
 
+/* Wrapper for g_array_index that adds bound checking.  */
+#define bt_g_array_index(a, t, i)              \
+       g_array_index((a), t, ({ BT_ASSERT_DBG((i) < (a)->len); (i); }))
+
 /*
  * Copied from:
  * <https://stackoverflow.com/questions/37411809/how-to-elegantly-fix-this-unused-variable-warning/37412551#37412551>:
This page took 0.024659 seconds and 4 git commands to generate.