Commit fe10fe41fe1df6d451270096ed6647e06fdbfcaf

Thomas de Grivel 2023-10-18T23:03:59

undefined

diff --git a/c3s/configure b/c3s/configure
index ebd250f..aa6bd04 100755
--- a/c3s/configure
+++ b/c3s/configure
@@ -43,7 +43,6 @@ CPPFLAGS="${CPPFLAGS:=}"
 ENV_CFLAGS="${CFLAGS:=}"
 DEFAULT_CFLAGS="-O2 -pipe -fPIC"
 LDFLAGS="${LDFLAGS}"
-LDFLAGS="-no-undefined ${LDFLAGS}"
 LIBS="${LIBS:=-lm}"
 
 # Common config for all targets
diff --git a/ic3/configure b/ic3/configure
index 79658ad..6413332 100755
--- a/ic3/configure
+++ b/ic3/configure
@@ -43,7 +43,6 @@ CPPFLAGS="${CPPFLAGS:=}"
 ENV_CFLAGS="${CFLAGS:=}"
 DEFAULT_CFLAGS="-O2 -pipe -fPIC"
 LDFLAGS="${LDFLAGS}"
-LDFLAGS="-no-undefined ${LDFLAGS}"
 LIBS="${LIBS:=-lm}"
 
 # Common config for all targets
diff --git a/libc3/configure b/libc3/configure
index f393b56..e4c6154 100755
--- a/libc3/configure
+++ b/libc3/configure
@@ -34,8 +34,7 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$LO_SOURCES")"
 CPPFLAGS="${CPPFLAGS:=}"
 ENV_CFLAGS="${CFLAGS:=}"
 DEFAULT_CFLAGS="-O2 -pipe"
-LDFLAGS="--shared ${LDFLAGS:-}"
-LDFLAGS="-no-undefined ${LDFLAGS}"
+LDFLAGS="--shared ${LDFLAGS}"
 LIBS="${LIBS} -lm -pthread -rpath ${PREFIX}/lib"
 
 # Common config for all targets
diff --git a/libc3/env.c b/libc3/env.c
index 331d412..a306eda 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -825,6 +825,9 @@ bool env_operator_find (s_env *env, const s_ident *op, u8 arity)
     facts_with_cursor_clean(&cursor);
     return true;
   }
+  warnx("operator %s not found in module %s",
+        op->sym->str.ptr.ps8,
+        op->module->str.ptr.ps8);
   facts_with_cursor_clean(&cursor);
   return false;
 }
@@ -832,24 +835,50 @@ bool env_operator_find (s_env *env, const s_ident *op, u8 arity)
 bool env_operator_is_right_associative (s_env *env, const s_ident *op)
 {
   s_facts_with_cursor cursor;
-  s8 r;
-  s_tag tag_ident;
+  s_tag tag_is_a;
+  s_tag tag_module;
+  s_tag tag_module_name;
+  s_tag tag_operator;
   s_tag tag_operator_assoc;
-  s_tag tag_right;
+  s_tag tag_operator_assoc_var;
+  s_tag tag_operator_var;
+  s_tag tag_symbol;
+  s_tag tag_sym;
   s_ident tmp;
   assert(env);
   assert(op);
   tmp = *op;
   ident_resolve_module(&tmp, env);
-  tag_init_ident(&tag_ident, &tmp);
-  tag_init_1(    &tag_operator_assoc, ":operator_associativity");
-  tag_init_1(    &tag_right, ":right");
+  tag_init_1(  &tag_is_a, ":is_a");
+  tag_init_1(  &tag_module, ":module");
+  tag_init_sym(&tag_module_name, tmp.module);
+  tag_init_1(  &tag_operator, ":operator");
+  tag_init_1(  &tag_operator_assoc, ":operator_associativity");
+  tag_init_var(&tag_operator_assoc_var);
+  tag_init_var(&tag_operator_var);
+  tag_init_1(  &tag_symbol, ":symbol");
+  tag_init_sym(&tag_sym, tmp.sym);
   facts_with(&env->facts, &cursor, (t_facts_spec) {
-      &tag_ident, &tag_operator_assoc, &tag_right,
+      &tag_module_name, &tag_is_a, &tag_module,
+      &tag_operator, &tag_operator_var, NULL,
+      &tag_operator_var, &tag_is_a, &tag_operator,
+      &tag_symbol, &tag_sym,
+      &tag_operator_assoc, &tag_operator_assoc_var,
       NULL, NULL });
-  r = facts_with_cursor_next(&cursor) ? true : false;
+  if (facts_with_cursor_next(&cursor)) {
+    if (tag_operator_assoc_var.type == TAG_SYM &&
+        tag_operator_assoc_var.data.sym == sym_1("right")) {
+      facts_with_cursor_clean(&cursor);
+      return true;
+    }
+    facts_with_cursor_clean(&cursor);
+    return false;
+  }
+  warnx("operator %s not found in module %s",
+        op->sym->str.ptr.ps8,
+        op->module->str.ptr.ps8);
   facts_with_cursor_clean(&cursor);
-  return r;
+  return false;
 }
 
 s8 env_operator_precedence (s_env *env, const s_ident *op)
diff --git a/libtommath b/libtommath
index 53d68d4..99b83bc 160000
--- a/libtommath
+++ b/libtommath
@@ -1 +1 @@
-Subproject commit 53d68d45868a57bdd9d0bcf52d7e490a884feb8a
+Subproject commit 99b83bc724a16ae2cb5cde00af2e049b39829cd2
diff --git a/test/configure b/test/configure
index 2f27783..c6a7245 100755
--- a/test/configure
+++ b/test/configure
@@ -39,11 +39,10 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
 echo "OBJECTS_DEBUG = $OBJECTS_DEBUG" >> ${CONFIG_MK}
 
 # Default config
-CPPFLAGS="${CPPFLAGS:=}"
-ENV_CFLAGS="${CFLAGS:=}"
+CPPFLAGS="${CPPFLAGS}"
+ENV_CFLAGS="${CFLAGS}"
 DEFAULT_CFLAGS="-O2 -pipe"
 LDFLAGS="${LDFLAGS}"
-LDFLAGS="-no-undefined ${LDFLAGS}"
 LIBS="${LIBS:=} -lm"
 
 # Common config for all targets
@@ -70,7 +69,7 @@ LIBC3_COV=../libc3/libc3_cov.la
 LIBS_COV="$LIBC3_COV $LIBS"
 
 # Debug config
-CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -ggdb"
+CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
 LDFLAGS_DEBUG="$LDFLAGS"
 LIBC3_DEBUG=../libc3/libc3_debug.la
 LIBS_DEBUG="$LIBC3_DEBUG $LIBS"