ref: 1c004e408303a04439385c0cd42efc4cc94be2e9
parent: cabd374e38cea1bef0c07b745f87503512ee4143
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Jan 17 13:27:55 EST 2025
simplify fl_thread macro logic
--- a/cc.h
+++ b/cc.h
@@ -5,7 +5,11 @@
#define fl_unlikely(x) __builtin_expect(!!(x), 0)
#define fl_likely(x) __builtin_expect(!!(x), 1)
#define fl_printfmt(x, y) __attribute__((format(printf, x, y)))
-#define fl_thread __thread
+#if defined(NDEBUG) && !defined(__macos__) && !defined(__dos__)
+#define fl_thread(x) __thread x
+#else
+#define fl_thread(x) x
+#endif
#define fl_prefetch(x) __builtin_prefetch(x)
#define fl_constfn __attribute__((const))
#define fl_purefn __attribute__((pure))
@@ -22,7 +26,7 @@
#define fl_unlikely(x) (x)
#define fl_likely(x) (x)
#define fl_printfmt(x, y)
-#define fl_thread
+#define fl_thread(x) x
#define fl_prefetch(x)
#define fl_constfn
#define fl_purefn
--- a/flisp.c
+++ b/flisp.c
@@ -40,15 +40,12 @@
value_t FL_bytesym, FL_runesym, FL_floatsym, FL_doublesym;
value_t FL_stringtypesym, FL_runestringtypesym;
+fl_thread(Fl *fl);
+
typedef struct {
const char *name;
builtin_t fptr;
}builtinspec_t;
-
-#if defined(NDEBUG)
-fl_thread
-#endif
-Fl *fl;
bool
isbuiltin(value_t x)
--- a/flisp.h
+++ b/flisp.h
@@ -414,12 +414,7 @@
value_t *gchandles[N_GC_HANDLES];
};
-extern
-#if defined(NDEBUG)
-fl_thread
-#endif
-Fl *fl;
-
+extern fl_thread(Fl *fl);
#define FL(f) fl->f
extern value_t FL_builtins_table_sym, FL_quote, FL_lambda, FL_function, FL_comma, FL_commaat;