Skip to content

Commit 00948b7

Browse files
committed
conditional compilation for __attribute__((nonstring))
clang-20 complains by default about unrecognized attributes, so only include nonstring for >= 21 Do the same for gcc <10, since we don't do any testing on those older versions.
1 parent 4ec58c4 commit 00948b7

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

ais_charset.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#include "ais_charset.h"
2+
#include "compat/compat.h"
23

3-
char ais_charset[64] __attribute__ ((nonstring)) = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?";
4+
char ais_charset[64] NONSTRING = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?";

compat/compat.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
* Platform-specific bits
66
*/
77

8+
#if defined(__clang__) && __clang_major__ >= 21
9+
# define NONSTRING __attribute__((nonstring))
10+
#elif defined(__GNUC__) && __GNUC__ >= 10
11+
# define NONSTRING __attribute__((nonstring))
12+
#else
13+
# define NONSTRING /* nothing */
14+
#endif
15+
816
#if defined(__APPLE__)
917

1018
/*

interactive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void interactiveShowData(void) {
140140
static bool need_clear = true;
141141
uint64_t now = mstime();
142142
char progress;
143-
char spinner[4] __attribute__ ((nonstring)) = "|/-\\";
143+
char spinner[4] NONSTRING = "|/-\\";
144144
int valid = 0;
145145
double signalMax = -100.0;
146146
double signalMin = +100.0;

0 commit comments

Comments
 (0)