diff --git a/config.subr b/config.subr
index d1b0d80..f25ccab 100644
--- a/config.subr
+++ b/config.subr
@@ -54,7 +54,7 @@ c2la() {
}
config_asan() {
- echo "int main() { return 0; }" > .config_asan.c
+ echo "int main (void) { return 0; }" > .config_asan.c
if $CC $CFLAGS .config_asan.c $LDFLAGS -lasan -o /dev/null 2>/dev/null; then
HAVE_ASAN=true
else
@@ -82,7 +82,7 @@ config_include() {
echo "#include <$1>" >> "$OUT_C"
shift
done
- echo "int main () { return 0; }" >> "$OUT_C"
+ echo "int main (void) { return 0; }" >> "$OUT_C"
if ${CC} ${CPPFLAGS} ${CFLAGS} "$OUT_C" -o "$OUT" >/dev/null 2>&1; then
echo "#define $1 1" >> "${CONFIG_H}"
eval "$1=Yes"
@@ -99,7 +99,7 @@ config_lib() {
OUT=".config_$1.c"
shift
echo "/* generated by configure */" > "$OUT"
- echo "int main () { return 0; }" >> "$OUT"
+ echo "int main (void) { return 0; }" >> "$OUT"
LIBS="${LIBS} $@"
if ${CC} ${CPPFLAGS} ${CFLAGS} "$OUT" ${LIBS} -o /dev/null; then
:
diff --git a/libc3/arg.c b/libc3/arg.c
index 974157d..3103448 100644
--- a/libc3/arg.c
+++ b/libc3/arg.c
@@ -49,7 +49,7 @@ uw arg_length (s_arg *arg)
return length;
}
-s_arg * arg_new ()
+s_arg * arg_new (void)
{
s_arg *arg;
if (! (arg = malloc(sizeof(s_arg))))
diff --git a/libc3/arg.h b/libc3/arg.h
index 85219d1..62d784c 100644
--- a/libc3/arg.h
+++ b/libc3/arg.h
@@ -19,7 +19,7 @@
s_arg * arg_init (s_arg *arg);
/* constructors */
-s_arg * arg_new ();
+s_arg * arg_new (void);
/* destructors */
s_arg * arg_delete (s_arg *arg);
diff --git a/libc3/c3.c b/libc3/c3.c
index d96618e..e8ac271 100644
--- a/libc3/c3.c
+++ b/libc3/c3.c
@@ -26,7 +26,7 @@ const s_str g_c3_base_hexadecimal = {{NULL}, 16, {"0123456789abcdef"}};
const s_str g_c3_bases_hexadecimal[2] = {{{NULL}, 16, {"0123456789abcdef"}},
{{NULL}, 16, {"0123456789ABCDEF"}}};
-void c3_break ()
+void c3_break (void)
{
assert(! "break");
errx(1, "break");
@@ -49,7 +49,7 @@ void c3_init (s_env *env)
exit(1);
}
-void c3_license ()
+void c3_license (void)
{
buf_write_1(&g_c3_env.out, g_c3_license);
buf_flush(&g_c3_env.out);
diff --git a/libc3/c3_main.h b/libc3/c3_main.h
index bc6f56d..ec33159 100644
--- a/libc3/c3_main.h
+++ b/libc3/c3_main.h
@@ -29,6 +29,6 @@ void c3_init (s_env *env);
void c3_clean (s_env *env);
/* debug */
-void c3_break ();
+void c3_break (void);
#endif /* C3_MAIN_H */
diff --git a/libc3/facts.c b/libc3/facts.c
index 32ecf9d..ae842e9 100644
--- a/libc3/facts.c
+++ b/libc3/facts.c
@@ -395,7 +395,7 @@ sw facts_log_remove (s_log *log, const s_fact *fact)
return result;
}
-s_facts * facts_new ()
+s_facts * facts_new (void)
{
s_facts *n;
if (! (n = malloc(sizeof(s_facts))))
@@ -438,7 +438,7 @@ sw facts_open_file (s_facts *facts, const s_str *path)
warn("facts_open_file: fopen: %s", path->ptr.ps8);
return -1;
}
- if (! (facts->log = log_new(BUF_SIZE)))
+ if (! (facts->log = log_new()))
return -1;
log_open(facts->log, fp);
return result;
diff --git a/libc3/facts.h b/libc3/facts.h
index 3d45038..cda7410 100644
--- a/libc3/facts.h
+++ b/libc3/facts.h
@@ -24,7 +24,7 @@ void facts_clean (s_facts *facts);
s_facts * facts_init (s_facts *facts);
/* Constructors */
-s_facts * facts_new ();
+s_facts * facts_new (void);
/* Destructor */
void facts_delete (s_facts *facts);
diff --git a/libc3/fn.c b/libc3/fn.c
index a150e5f..64ae4f2 100644
--- a/libc3/fn.c
+++ b/libc3/fn.c
@@ -62,7 +62,7 @@ s_fn * fn_init_1 (s_fn *fn, s8 *p)
return fn;
}
-s_fn * fn_new ()
+s_fn * fn_new (void)
{
s_fn *fn;
if (! (fn = calloc(1, sizeof(s_fn))))
diff --git a/libc3/fn.h b/libc3/fn.h
index 80b146a..21a99c0 100644
--- a/libc3/fn.h
+++ b/libc3/fn.h
@@ -27,7 +27,7 @@ s_fn * fn_init (s_fn *fn);
s_fn * fn_init_1 (s_fn *fn, s8 *p);
/* constructors */
-s_fn * fn_new ();
+s_fn * fn_new (void);
s_fn * fn_new_copy (const s_fn *fn);
/* destructors */
diff --git a/libc3/frame.h b/libc3/frame.h
index b7e0871..e4628c0 100644
--- a/libc3/frame.h
+++ b/libc3/frame.h
@@ -20,7 +20,7 @@ s_frame * frame_clean (s_frame *frame);
s_frame * frame_init (s_frame *frame, s_frame *next);
/* constructors */
-s_frame * frame_new ();
+s_frame * frame_new (s_frame *next);
/* destructors */
s_frame * frame_delete (s_frame *frame);
diff --git a/libc3/integer.c b/libc3/integer.c
index 7942109..3e213a6 100644
--- a/libc3/integer.c
+++ b/libc3/integer.c
@@ -411,6 +411,15 @@ s_integer * integer_neg (const s_integer *a, s_integer *dest)
return dest;
}
+s_integer * integer_new (void)
+{
+ s_integer *i = NULL;
+ if (! (i = malloc(sizeof(s_integer)))) {
+ err(1, "integer_new: out of memory");
+ }
+ return integer_init(i);
+}
+
s_integer * integer_new_copy (const s_integer *a)
{
s_integer *dest;
diff --git a/libc3/integer.h b/libc3/integer.h
index 1594d79..8ff29c3 100644
--- a/libc3/integer.h
+++ b/libc3/integer.h
@@ -85,7 +85,7 @@ s_integer * integer_sub (const s_integer *a, const s_integer *b,
s_integer *dest);
/* Constructors, call integer_delete after use. */
-s_integer * integer_new ();
+s_integer * integer_new (void);
s_integer * integer_new_copy (const s_integer *a);
/* Observers */
diff --git a/libc3/log.c b/libc3/log.c
index 0af34ea..2e95e5a 100644
--- a/libc3/log.c
+++ b/libc3/log.c
@@ -42,7 +42,7 @@ void log_init (s_log *log)
hash_init(&log->hash);
}
-s_log * log_new ()
+s_log * log_new (void)
{
s_log *log;
if (! (log = malloc(sizeof(s_log)))) {
diff --git a/libc3/log.h b/libc3/log.h
index 9304e88..ae8ae34 100644
--- a/libc3/log.h
+++ b/libc3/log.h
@@ -20,7 +20,7 @@ void log_init (s_log *log);
void log_clean (s_log *log);
/* constructor */
-s_log * log_new ();
+s_log * log_new (void);
/* destructor */
void log_delete (s_log *log);
diff --git a/libc3/str.c b/libc3/str.c
index 79cad1a..39b1fba 100644
--- a/libc3/str.c
+++ b/libc3/str.c
@@ -256,7 +256,7 @@ s_str * str_new_dup (const s_str *src)
return str;
}
-s_str * str_new_empty ()
+s_str * str_new_empty (void)
{
s_str *str;
str = str_new(NULL, 0, NULL);
diff --git a/libc3/str.h b/libc3/str.h
index fd48e8b..0bd0b5b 100644
--- a/libc3/str.h
+++ b/libc3/str.h
@@ -43,7 +43,7 @@ s_str * str_new (s8 *free, uw size, const s8 *p);
s_str * str_new_1 (s8 *free, const s8 *p);
s_str * str_new_cpy (uw size, const s8 *p);
s_str * str_new_dup (const s_str *src);
-s_str * str_new_empty ();
+s_str * str_new_empty (void);
s_str * str_new_f (const char *fmt, ...);
s_str * str_new_vf (const char *fmt, va_list ap);
diff --git a/libc3/sym.c b/libc3/sym.c
index f179abe..da9cf28 100644
--- a/libc3/sym.c
+++ b/libc3/sym.c
@@ -64,7 +64,7 @@ void sym_delete (s_sym *sym)
free(sym);
}
-void sym_delete_all ()
+void sym_delete_all (void)
{
s_sym_list *sym_list;
sym_list = g_sym_list;
@@ -180,6 +180,8 @@ ffi_type * sym_to_ffi_type (const s_sym *sym, ffi_type *result_type)
if (sym == sym_1("S64") ||
sym == sym_1("s64"))
return &ffi_type_sint64;
+ if (sym == sym_1("Sym"))
+ return &ffi_type_pointer;
if (sym == sym_1("Sw") ||
sym == sym_1("sw"))
return &ffi_type_slong;
diff --git a/libc3/sym.h b/libc3/sym.h
index 2303446..792ad0e 100644
--- a/libc3/sym.h
+++ b/libc3/sym.h
@@ -36,7 +36,7 @@ bool sym_character_is_reserved (character c);
const s_sym ** sym_copy (const s_sym **src, const s_sym **dest);
/** @brief Call when exiting program. */
-void sym_delete_all ();
+void sym_delete_all (void);
/** @brief Find an existing symbol. */
const s_sym * sym_find (const s_str *src);
diff --git a/libc3/tag.c b/libc3/tag.c
index e411887..282473b 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -2096,10 +2096,6 @@ s_tag * tag_bnot (const s_tag *tag, s_tag *result)
assert(tag);
assert(result);
switch (tag->type) {
- case TAG_BOOL:
- return tag_init_u8(result, ~(tag->data.bool ? 1 : 0));
- case TAG_CHARACTER:
- return tag_init_u32(result, ~tag->data.character);
case TAG_INTEGER:
result->type = TAG_INTEGER;
integer_bnot(&tag->data.integer, &result->data.integer);
@@ -2125,8 +2121,10 @@ s_tag * tag_bnot (const s_tag *tag, s_tag *result)
case TAG_UW:
return tag_init_uw(result, ~tag->data.uw);
case TAG_ARRAY:
+ case TAG_BOOL:
case TAG_CALL:
case TAG_CFN:
+ case TAG_CHARACTER:
case TAG_F32:
case TAG_F64:
case TAG_FACT:
@@ -6291,7 +6289,7 @@ s_tag * tag_neg (const s_tag *tag, s_tag *result)
return NULL;
}
-s_tag * tag_new ()
+s_tag * tag_new (void)
{
s_tag *tag;
tag = calloc(1, sizeof(s_tag));
@@ -6322,6 +6320,13 @@ s_tag * tag_new_copy (const s_tag *src)
return tag_copy(src, dest);
}
+s_tag * tag_new_var (void)
+{
+ s_tag *tag;
+ tag = calloc(1, sizeof(s_tag));
+ return tag_init_var(tag);
+}
+
bool * tag_not (const s_tag *tag, bool *dest)
{
s_tag f;
@@ -8749,6 +8754,14 @@ void * tag_to_pointer (s_tag *tag, const s_sym *type)
}
+const s_sym ** tag_type (const s_tag *tag, const s_sym **dest)
+{
+ assert(tag);
+ assert(dest);
+ *dest = tag_type_to_sym(tag->type);
+ return dest;
+}
+
sw tag_type_size (e_tag_type type)
{
switch (type) {
diff --git a/libc3/tag.h b/libc3/tag.h
index 9c97735..491af93 100644
--- a/libc3/tag.h
+++ b/libc3/tag.h
@@ -69,7 +69,7 @@ s_tag * tag_init_u64 (s_tag *tag, u64 i);
s_tag * tag_init_uw (s_tag *tag, uw i);
/* Constructors, call tag_delete after use */
-s_tag * tag_new ();
+s_tag * tag_new (void);
s_tag * tag_new_1 (const s8 *p);
s_tag * tag_new_array (const s_array *a);
s_tag * tag_new_bool (bool p);
@@ -88,7 +88,7 @@ s_tag * tag_new_u8 (u8 i);
s_tag * tag_new_u16 (u16 i);
s_tag * tag_new_u32 (u32 i);
s_tag * tag_new_u64 (u64 i);
-s_tag * tag_new_var ();
+s_tag * tag_new_var (void);
/* Destructor */
void tag_delete (s_tag *tag);
@@ -106,6 +106,7 @@ sw tag_size (const s_tag *tag);
void * tag_to_ffi_pointer (s_tag *tag, const s_sym *type);
ffi_type tag_to_ffi_type(const s_tag *tag);
void * tag_to_pointer (s_tag *tag, const s_sym *type);
+const s_sym ** tag_type (const s_tag *tag, const s_sym **type);
sw tag_type_size (e_tag_type type);
f_buf_inspect tag_type_to_buf_inspect (e_tag_type type);
f_buf_inspect_size tag_type_to_buf_inspect_size (e_tag_type type);