mirror of
https://github.com/Ponce/slackbuilds
synced 2024-12-01 01:00:03 +01:00
a9bfc2f55b
Signed-off-by: B. Watson <urchlay@slackware.uk> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
63 lines
2 KiB
Diff
63 lines
2 KiB
Diff
diff -Naur abuse-0.8/src/lisp/lisp.cpp abuse-0.8.patched/src/lisp/lisp.cpp
|
||
--- abuse-0.8/src/lisp/lisp.cpp 2011-05-02 07:55:06.000000000 -0400
|
||
+++ abuse-0.8.patched/src/lisp/lisp.cpp 2023-08-07 20:52:41.197394085 -0400
|
||
@@ -867,7 +867,7 @@
|
||
size_t ret = 0;
|
||
|
||
#ifdef TYPE_CHECKING
|
||
- if (this && item_type(this) != (ltype)L_CONS_CELL)
|
||
+ if (item_type(this) != (ltype)L_CONS_CELL)
|
||
{
|
||
Print();
|
||
lbreak(" is not a sequence\n");
|
||
@@ -1275,7 +1275,7 @@
|
||
switch (item_type(this))
|
||
{
|
||
case L_CONS_CELL:
|
||
- if (!this)
|
||
+ if (ptr_is_null(this))
|
||
{
|
||
lprint_string("nil");
|
||
}
|
||
@@ -3080,7 +3080,7 @@
|
||
|
||
LObject *ret = NULL;
|
||
|
||
- if (this)
|
||
+ if (!ptr_is_null(this))
|
||
{
|
||
switch (item_type(this))
|
||
{
|
||
diff -Naur abuse-0.8/src/lisp/lisp.h abuse-0.8.patched/src/lisp/lisp.h
|
||
--- abuse-0.8/src/lisp/lisp.h 2011-05-02 07:55:06.000000000 -0400
|
||
+++ abuse-0.8.patched/src/lisp/lisp.h 2023-08-07 20:53:56.765386973 -0400
|
||
@@ -201,7 +201,28 @@
|
||
|
||
static inline LObject *&CAR(void *x) { return ((LList *)x)->car; }
|
||
static inline LObject *&CDR(void *x) { return ((LList *)x)->cdr; }
|
||
-static inline ltype item_type(void *x) { if (x) return *(ltype *)x; return L_CONS_CELL; }
|
||
+
|
||
+#ifdef __GNUC__
|
||
+/*
|
||
+ * C++ spec says "this" is always NON-NULL, recent versions of gcc will warn
|
||
+ * about this and optimizes the "if (this)" we use in some places away:
|
||
+ * "warning: nonnull argument ‘this’ compared to NULL [-Wnonnull-compare]"
|
||
+ * We rely on "if (this)" checks in several places and refactoring this is
|
||
+ * non trivial. So we use this little helper marked with
|
||
+ * __attribute__((optimize("O0"))) to workaround this.
|
||
+ */
|
||
+static inline bool __attribute__((optimize("O0"))) ptr_is_null(void *ptr)
|
||
+{
|
||
+ return ptr == NULL;
|
||
+}
|
||
+#else
|
||
+static inline bool ptr_is_null(void *ptr)
|
||
+{
|
||
+ return ptr == NULL;
|
||
+}
|
||
+#endif
|
||
+
|
||
+static inline ltype item_type(void *x) { if (!ptr_is_null(x)) return *(ltype *)x; return L_CONS_CELL; }
|
||
|
||
void perm_space();
|
||
void tmp_space();
|