# HG changeset patch # User Franz Glasner # Date 1742323795 -3600 # Node ID c7761c5a53899bc6bc48c35aa280ecb63bfc5436 # Parent 56e544de90dad1494233eb08a4e089ca559aafc8 FIX: Patch to compile with modern C11 style atomics. Does not need gcc any more for old GCC-stype atomic syntax. Not compiles with clang/cc on FreeBSD. diff -r 56e544de90da -r c7761c5a5389 Makefile --- a/Makefile Tue Mar 18 17:58:55 2025 +0100 +++ b/Makefile Tue Mar 18 19:49:55 2025 +0100 @@ -17,7 +17,6 @@ GH_TAGNAME= v${DISTVERSION} # Currently compilation errors on incompatible types with clang -USE_GCC= yes USE_LDCONFIG= yes CMAKE_SOURCE_PATH= ${WRKSRC}/prom diff -r 56e544de90da -r c7761c5a5389 files/patch-prom_src_prom__metric__sample.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files/patch-prom_src_prom__metric__sample.c Tue Mar 18 19:49:55 2025 +0100 @@ -0,0 +1,26 @@ +--- prom/src/prom_metric_sample.c.orig 2020-12-08 07:38:13 UTC ++++ prom/src/prom_metric_sample.c +@@ -63,9 +63,9 @@ int prom_metric_sample_add(prom_metric_sample_t *self, + if (r_value < 0) { + return 1; + } +- _Atomic double old = atomic_load(&self->r_value); ++ double old = atomic_load(&self->r_value); + for (;;) { +- _Atomic double new = ATOMIC_VAR_INIT(old + r_value); ++ double new = old + r_value; + if (atomic_compare_exchange_weak(&self->r_value, &old, new)) { + return 0; + } +@@ -78,9 +78,9 @@ int prom_metric_sample_sub(prom_metric_sample_t *self, + PROM_LOG(PROM_METRIC_INCORRECT_TYPE); + return 1; + } +- _Atomic double old = atomic_load(&self->r_value); ++ double old = atomic_load(&self->r_value); + for (;;) { +- _Atomic double new = ATOMIC_VAR_INIT(old - r_value); ++ double new = old - r_value; + if (atomic_compare_exchange_weak(&self->r_value, &old, new)) { + return 0; + } diff -r 56e544de90da -r c7761c5a5389 files/patch-prom_src_prom__metric__sample__t.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files/patch-prom_src_prom__metric__sample__t.h Tue Mar 18 19:49:55 2025 +0100 @@ -0,0 +1,11 @@ +--- prom/src/prom_metric_sample_t.h.orig 2020-12-08 07:38:13 UTC ++++ prom/src/prom_metric_sample_t.h +@@ -23,7 +23,7 @@ struct prom_metric_sample { + struct prom_metric_sample { + prom_metric_type_t type; /**< type is the metric type for the sample */ + char *l_value; /**< l_value is the full metric name and label set represeted as a string */ +- _Atomic double r_value; /**< r_value is the value of the metric sample */ ++ _Atomic(double) r_value; /**< r_value is the value of the metric sample */ + }; + + #endif // PROM_METRIC_SAMPLE_T_H