idris-lang / Idris2

A purely functional programming language with first class types
https://idris-lang.org/
Other
2.46k stars 369 forks source link

idris_signal: fix static_assert #3325

Closed barracuda156 closed 1 week ago

barracuda156 commented 1 week ago

Description

static_assert may not be defined in assert.h, use _Static_assert as a fallback. This fix is borrowed from Python.

mattpolzin commented 1 week ago

Would you mind appeasing the linter?

barracuda156 commented 1 week ago

Would you mind appeasing the linter?

@mattpolzin Sure, but what does it want from me?

The code comes from here: https://github.com/python/cpython/blob/v3.12.1/Include/pymacro.h#L20-L24 I think I only changed alignment of text lines to match the source file here.

buzden commented 1 week ago

Sure, but what does it want from me?

diff --git a/support/c/idris_signal.c b/support/c/idris_signal.c
index d5d91430..a94e5360 100644
--- a/support/c/idris_signal.c
+++ b/support/c/idris_signal.c
@@ -12,9 +12,9 @@

 #include "idris_util.h"

-#if !defined(static_assert) && (defined(__GNUC__) || defined(__clang__)) \
-  && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
-  && __STDC_VERSION__ <= 201710L
+#if !defined(static_assert) && (defined(__GNUC__) || defined(__clang__)) &&    \
+    defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L &&                \
+    __STDC_VERSION__ <= 201710L
 #define static_assert _Static_assert
 #endif
barracuda156 commented 1 week ago

@buzden Thank you, changed.