summaryrefslogtreecommitdiff
path: root/src/lread.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-12-02 19:01:33 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2021-12-02 19:03:14 -0800
commit9c222b9c1a7f91497a37567b4d7de3a511fff069 (patch)
treea0e9016aac8318734b5e9d744f9cc1502bef72f3 /src/lread.c
parentfed35a89517aa4e282273f7e3c75bafd4e698ce4 (diff)
downloademacs-9c222b9c1a7f91497a37567b4d7de3a511fff069.tar.gz
emacs-9c222b9c1a7f91497a37567b4d7de3a511fff069.tar.bz2
emacs-9c222b9c1a7f91497a37567b4d7de3a511fff069.zip
Port to C compilers that lack size-0 arrays
The C standard does not allow size-zero arrays, so redo struct Lisp_Subr to not use size-zero arrays when native compilation is not being used. Formerly, the code was using size-zero arrays (a GNU C extension) to avoid using memory unnecessarily when HAVE_NATIVE_COMP is not defined. Replace this hack with the more-traditional hack of putting the relevant members inside ‘#ifdef HAVE_NATIVE_COMP’. * src/alloc.c (cleanup_vector, mark_object): * src/comp.c (make_subr): * src/data.c (Fsubr_native_lambda_list, Fsubr_native_comp_unit): * src/eval.c (init_eval_once, funcall_lambda): * src/lisp.h (SUBR_NATIVE_COMPILEDP, SUBR_NATIVE_COMPILED_DYNP) (SUBR_TYPE): * src/lread.c (Fload): Conditionally compile with ‘#ifdef HAVE_NATIVE_COMP’ instead of with ‘if (NATIVE_COMP_FLAG)’. Redo members like native_comp_u[0] to be plain native_comp_u. Put all uses of these members inside ‘#ifdef HAVE_NATIVE_COMP’. * src/lisp.h (struct Lisp_Subr): Members native_comp_u, native_c_name, lambda_list, type are now all ifdeffed out if HAVE_NATIVE_COMP is not defined, instead of being size-zero arrays. All uses changed. * src/pdumper.c (dump_subr, dump_cold_native_subr) (dump_do_dump_relocation): * src/comp.h (NATIVE_COMP_FLAG): Remove; no longer needed.
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lread.c b/src/lread.c
index b3f9e6ff527..9bb5f66adf3 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1271,7 +1271,10 @@ Return t if the file exists and loads successfully. */)
|| suffix_p (file, MODULES_SECONDARY_SUFFIX)
#endif
#endif
- || (NATIVE_COMP_FLAG && suffix_p (file, NATIVE_ELISP_SUFFIX)))
+#ifdef HAVE_NATIVE_COMP
+ || suffix_p (file, NATIVE_ELISP_SUFFIX)
+#endif
+ )
must_suffix = Qnil;
/* Don't insist on adding a suffix
if the argument includes a directory name. */
@@ -1351,8 +1354,11 @@ Return t if the file exists and loads successfully. */)
bool is_module = false;
#endif
- bool is_native_elisp =
- NATIVE_COMP_FLAG && suffix_p (found, NATIVE_ELISP_SUFFIX) ? true : false;
+#ifdef HAVE_NATIVE_COMP
+ bool is_native_elisp = suffix_p (found, NATIVE_ELISP_SUFFIX);
+#else
+ bool is_native_elisp = false;
+#endif
/* Check if we're stuck in a recursive load cycle.