Commit c22f7c28f482d2dd4297d40e8aa9bebbce7e58e1

Thomas de Grivel 2022-11-13T09:20:53

build with llvm clang

diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index 66bb7bd..8440694 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -347,12 +347,12 @@ sw buf_parse_digit_dec (s_buf *buf, u8 *dest)
 
 sw buf_parse_fact (s_buf *buf, s_fact *dest)
 {
-  s_tag *object;
-  s_tag *predicate;
+  s_tag *object = NULL;
+  s_tag *predicate = NULL;
   sw r;
   sw result = 0;
   s_buf_save save;
-  s_tag *subject;
+  s_tag *subject = NULL;
   assert(buf);
   assert(dest);
   buf_save_init(buf, &save);
@@ -1389,7 +1389,7 @@ sw buf_parse_f32 (s_buf *buf, f32 *dest)
   sw r;
   sw result = 0;
   u8 digit;
-  u8  exponent;
+  u8 exponent = 0;
   s_buf_save save;
   f32 tmp = 0;
   f32 frac = 0.1;
@@ -1452,7 +1452,7 @@ sw buf_parse_f64 (s_buf *buf, f64 *dest) {
   sw r;
   sw result = 0;
   u8 digit;
-  u8 exponent;
+  u8 exponent = 0;
   s_buf_save save;
   f64 tmp = 0;
   f64 frac = 0.1;
diff --git a/libc3/character.c b/libc3/character.c
index bc2d585..6d8b07b 100644
--- a/libc3/character.c
+++ b/libc3/character.c
@@ -21,7 +21,7 @@ character character_1 (const s8 *p)
   character c;
   s_str stra;
   assert(p);
-  str_init_1(&stra, false, p);
+  str_init_1(&stra, NULL, p);
   str_peek_character(&stra, &c);
   return c;
 }
diff --git a/libc3/configure b/libc3/configure
index 6775000..81adc3a 100755
--- a/libc3/configure
+++ b/libc3/configure
@@ -25,7 +25,7 @@ LIB_DEBUG=libc3.debug.la
 
 SOURCES="$(ls *.c | tr '\n' ' ')"
 echo "SOURCES = $SOURCES" >> ${CONFIG_MK}
-LIBTOMMATH_SOURCES="$(ls ../libtommath/*.c | tr '\n' ' ')"
+LIBTOMMATH_SOURCES="$(ls ../libtommath/*.c | grep -v -e bn_mp_set_double.c -e bn_s_mp_rand_platform.c | tr '\n' ' ')"
 LO_SOURCES="$SOURCES $LIBTOMMATH_SOURCES"
 OBJECTS="$(c2ext .main.lo "$LO_SOURCES")"
 echo "OBJECTS = $OBJECTS" >> ${CONFIG_MK}
diff --git a/libc3/ident.c b/libc3/ident.c
index 0e44b1f..f13a9fd 100644
--- a/libc3/ident.c
+++ b/libc3/ident.c
@@ -68,7 +68,7 @@ e_bool ident_has_reserved_characters (const s_ident *ident)
   character c;
   sw r;
   s_str stra;
-  str_init(&stra, false, ident->sym->str.size, ident->sym->str.ptr.p);
+  str_init(&stra, NULL, ident->sym->str.size, ident->sym->str.ptr.p);
   if ((r = str_read_character(&stra, &c)) > 0) {
     if (ident_first_character_is_reserved(c))
       return true;
@@ -103,7 +103,7 @@ s_ident * ident_init (s_ident *ident, const s_sym *sym)
 s_ident * ident_init_1 (s_ident *ident, const s8 *p)
 {
   s_str tmp;
-  str_init_1(&tmp, false, p);
+  str_init_1(&tmp, NULL, p);
   str_to_ident(&tmp, ident);
   return ident;
 }
diff --git a/libc3/sym.c b/libc3/sym.c
index d6bc8e4..3bf632b 100644
--- a/libc3/sym.c
+++ b/libc3/sym.c
@@ -32,7 +32,7 @@ static s_sym_list * g_sym_list = NULL;
 const s_sym * sym_1 (const s8 *p)
 {
   s_str stra;
-  str_init_1(&stra, false, p);
+  str_init_1(&stra, NULL, p);
   return str_to_sym(&stra);
 }
 
@@ -100,7 +100,7 @@ e_bool sym_has_reserved_characters (const s_sym *sym)
   character c;
   sw r;
   s_str stra;
-  str_init(&stra, false, sym->str.size, sym->str.ptr.p);
+  str_init(&stra, NULL, sym->str.size, sym->str.ptr.p);
   while ((r = str_read_character(&stra, &c)) > 0) {
     if (sym_character_is_reserved(c))
       return true;
diff --git a/test/buf_inspect_test.c b/test/buf_inspect_test.c
index ce9b059..84af918 100644
--- a/test/buf_inspect_test.c
+++ b/test/buf_inspect_test.c
@@ -127,7 +127,7 @@
     s_buf buf;                                                         \
     s_str str;                                                         \
     test_context("buf_inspect_str(" # test ") -> " # expected);        \
-    str_init_1(&str, false, (test));                                   \
+    str_init_1(&str, NULL, (test));                                   \
     buf_init(&buf, false, sizeof(b), b);                               \
     TEST_EQ(buf_inspect_str(&buf, &str), strlen(expected));            \
     TEST_STRNCMP(buf.ptr.p, (expected), buf.wpos);                     \
diff --git a/test/f32_test.c b/test/f32_test.c
index 95d43e3..ebf8b29 100644
--- a/test/f32_test.c
+++ b/test/f32_test.c
@@ -44,4 +44,4 @@ void f32_test_compare ()
                       1.797693134862315708145274237317043567980e+38), -1);
   TEST_EQ(f32_compare(1.797693134862315708145274237317043567980e+38,
                       1.597693134862315708145274237317043567981e+38), 1);
-}
\ No newline at end of file
+}