summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-07-22 07:28:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-07-22 07:28:09 -0700
commitbf36536c9fa398161b24668ad1c29f12f86556e8 (patch)
tree04b6d6632d97c12728ee052c99d8a2a8eb34a14c
parentf2d83d19a09f68864209cc1568a59be70a7bfdbc (diff)
downloadtxr-bf36536c9fa398161b24668ad1c29f12f86556e8.tar.gz
txr-bf36536c9fa398161b24668ad1c29f12f86556e8.tar.bz2
txr-bf36536c9fa398161b24668ad1c29f12f86556e8.zip
* configure: Add a check, in the case that we cannot make an
executable, whether this is due to being required to use C99. For instance, the Solaris environment requires compilation using the C99 dialect if _XOPEN_SOURCE is set to 600 or higher. * debug.c: When compiling as C99, we have to obey the special C99 conventions for instantiating inline functions. * hash.c: Likewise. * lib.c: Likewise. * parser.y: Likewise. * unwind.c: Likewise.
-rw-r--r--ChangeLog18
-rwxr-xr-xconfigure20
-rw-r--r--debug.c7
-rw-r--r--hash.c5
-rw-r--r--lib.c22
-rw-r--r--parser.y5
-rw-r--r--unwind.c5
7 files changed, 76 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f3519a5..5783483f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2014-07-22 Kaz Kylheku <kaz@kylheku.com>
+
+ * configure: Add a check, in the case that we cannot make an
+ executable, whether this is due to being required to use C99.
+ For instance, the Solaris environment requires compilation
+ using the C99 dialect if _XOPEN_SOURCE is set to 600 or higher.
+
+ * debug.c: When compiling as C99, we have to obey the special
+ C99 conventions for instantiating inline functions.
+
+ * hash.c: Likewise.
+
+ * lib.c: Likewise.
+
+ * parser.y: Likewise.
+
+ * unwind.c: Likewise.
+
2014-07-21 Kaz Kylheku <kaz@kylheku.com>
* RELNOTES: Updated.
diff --git a/configure b/configure
index 70417b34..c9209ff0 100755
--- a/configure
+++ b/configure
@@ -704,14 +704,22 @@ int main(void)
!
if ! conftest ; then
- printf "failed\n\n"
- printf "Errors from compilation: \n\n"
- cat conftest.err
- exit 1
+ printf "failed\n"
+ printf "Checking whether the failure is due to a requirement to use C99 ... "
+ if conftest EXTRA_FLAGS=-std=c99 ; then
+ printf "yes\n"
+ lang_flags="$(echo "$lang_flags" | sed -e 's/-ansi/-std=c99/')"
+ else
+ printf "no\n\n"
+ conftest && true
+ printf "Errors from compilation: \n\n"
+ cat conftest.err
+ exit 1
+ fi
+else
+ printf "okay\n"
fi
-printf "okay\n"
-
printf "Checking whether executables have that idiotic .exe suffix ... "
if ls conftest.exe > /dev/null 2>&1 ; then
diff --git a/debug.c b/debug.c
index 42464113..0e928183 100644
--- a/debug.c
+++ b/debug.c
@@ -52,6 +52,13 @@ static val breakpoints;
static val last_command;
static int cols = 80;
+/* C99 inline instantiations. */
+#if __STDC_VERSION__ >= 199901L
+val debug_check(val form, val bindings, val data, val line,
+ val pos, val base);
+void debug_init(void);
+#endif
+
static void help(val stream)
{
put_string(lit("commands:\n"
diff --git a/hash.c b/hash.c
index 92a05191..2cc7acf4 100644
--- a/hash.c
+++ b/hash.c
@@ -73,6 +73,11 @@ val weak_keys_k, weak_vals_k, equal_based_k;
*/
static struct hash *reachable_weak_hashes;
+/* C99 inline instantiations. */
+#if __STDC_VERSION__ >= 199901L
+loc gethash_l(val hash, val key, loc new_p);
+#endif
+
/*
* This is is an adaptation of hashpjw, from Compilers: Principles, Techniques
* and Tools, Aho, Sethi, Ulman, 1988. P. 436. The register is wider by
diff --git a/lib.c b/lib.c
index 9443fb88..b7e24e12 100644
--- a/lib.c
+++ b/lib.c
@@ -105,6 +105,28 @@ static val env_list;
mem_t *(*oom_realloc)(mem_t *, size_t);
+/* C99 inline instantiations. */
+#if __STDC_VERSION__ >= 199901L
+loc mkloc_fun(val *ptr, val obj);
+cnum tag(val obj);
+int is_ptr(val obj);
+int is_num(val obj);
+int is_chr(val obj);
+int is_lit(val obj);
+type_t type(val obj);
+val auto_str(const wchli_t *str);
+val static_str(const wchli_t *str);
+wchar_t *litptr(val obj);
+val num_fast(cnum n);
+mp_int *mp(val bign);
+val chr(wchar_t ch);
+val eq(val a, val b);
+val null(val v);
+int null_or_missing_p(val v);
+val default_arg(val arg, val dfl);
+val default_bool_arg(val arg);
+#endif
+
val identity(val obj)
{
return obj;
diff --git a/parser.y b/parser.y
index be8e6063..6b4f1c70 100644
--- a/parser.y
+++ b/parser.y
@@ -1013,6 +1013,11 @@ not_a_clause : ALL { $$ = make_expr(all_s, nil, num(lineno)); }
%%
+/* C99 inline instantiations. */
+#if __STDC_VERSION__ >= 199901L
+val rlcp(val to, val from);
+#endif
+
static val sym_helper(wchar_t *lexeme, val meta_allowed)
{
int leading_at = *lexeme == L'@';
diff --git a/unwind.c b/unwind.c
index c76c4b0b..895a6ba3 100644
--- a/unwind.c
+++ b/unwind.c
@@ -47,6 +47,11 @@ static uw_frame_t *uw_env_stack;
static uw_frame_t *uw_exit_point;
static uw_frame_t toplevel_env;
+/* C99 inline instantiations. */
+#if __STDC_VERSION__ >= 199901L
+val uw_block_return(val tag, val result);
+#endif
+
static void uw_unwind_to_exit_point(void)
{
assert (uw_exit_point);