Remove PRESERVE_NONE

This commit is contained in:
2025-05-13 11:58:31 -04:00
parent 47d6705aaf
commit 557e89f1a2

View File

@@ -416,12 +416,6 @@ private:
#define MUSTTAIL
#endif
#if __has_attribute(preserve_none)
#define PRESERVE_NONE __attribute__((preserve_none))
#else
#define PRESERVE_NONE
#endif
struct Parser2 {
Parser2(char *buf, int len, const Callbacks *callbacks, void *data)
: buf(buf), len(len), callbacks(callbacks), data(data) {}
@@ -498,7 +492,7 @@ private:
return true;
}
typedef PRESERVE_NONE bool (*continuation)(Parser2 *);
typedef bool (*continuation)(Parser2 *);
[[maybe_unused]] void debugPrint(Symbol token) {
printf("token: %s\n", symbolNames[token]);
@@ -508,12 +502,12 @@ private:
printf("\n");
}
PRESERVE_NONE static bool tokenMatch(Parser2 *self) {
static bool tokenMatch(Parser2 *self) {
self->pop();
MUSTTAIL return keepGoing(self);
}
PRESERVE_NONE static bool keepGoing(Parser2 *self) {
static bool keepGoing(Parser2 *self) {
if (self->empty()) {
return true;
}
@@ -522,11 +516,11 @@ private:
MUSTTAIL return table[*(self->stackPtr - 1)][token](self);
}
PRESERVE_NONE static bool reject(Parser2 *self) {
static bool reject(Parser2 *self) {
self->pop();
return false;
}
PRESERVE_NONE static bool object(Parser2 *self) {
static bool object(Parser2 *self) {
self->pop();
self->callbacks->on_begin_object(self->data);
if (!self->push({T_STRING, T_COLON, N_VALUE, N_OBJECT_MAYBE_CONTINUE})) {
@@ -534,7 +528,7 @@ private:
}
MUSTTAIL return keepGoing(self);
}
PRESERVE_NONE static bool atom(Parser2 *self) {
static bool atom(Parser2 *self) {
self->pop();
if (*self->bufBefore == 't') {
self->callbacks->on_true_literal(self->data);
@@ -550,11 +544,11 @@ private:
}
MUSTTAIL return keepGoing(self);
}
PRESERVE_NONE static bool string(Parser2 *self) {
static bool string(Parser2 *self) {
self->pop();
MUSTTAIL return keepGoing(self);
}
PRESERVE_NONE static bool array(Parser2 *self) {
static bool array(Parser2 *self) {
self->pop();
self->callbacks->on_begin_array(self->data);
if (!self->push({N_VALUE, N_ARRAY_MAYBE_CONTINUE})) {
@@ -562,26 +556,26 @@ private:
}
MUSTTAIL return keepGoing(self);
}
PRESERVE_NONE static bool continueArray(Parser2 *self) {
static bool continueArray(Parser2 *self) {
self->pop();
if (!self->push({N_VALUE, N_ARRAY_MAYBE_CONTINUE})) {
return false;
}
MUSTTAIL return keepGoing(self);
}
PRESERVE_NONE static bool continueObject(Parser2 *self) {
static bool continueObject(Parser2 *self) {
self->pop();
if (!self->push({T_STRING, T_COLON, N_VALUE, N_OBJECT_MAYBE_CONTINUE})) {
return false;
}
MUSTTAIL return keepGoing(self);
}
PRESERVE_NONE static bool finishArray(Parser2 *self) {
static bool finishArray(Parser2 *self) {
self->pop();
self->callbacks->on_end_array(self->data);
MUSTTAIL return keepGoing(self);
}
PRESERVE_NONE static bool finishObject(Parser2 *self) {
static bool finishObject(Parser2 *self) {
self->pop();
self->callbacks->on_end_object(self->data);
MUSTTAIL return keepGoing(self);