Skip to content

Commit

Permalink
supply missing externs
Browse files Browse the repository at this point in the history
  • Loading branch information
shayne-fletcher authored and Shayne Fletcher committed Nov 27, 2023
1 parent cbc5a0c commit 4586466
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ Working version

### Bug fixes:

- # 12791: bytecode -custom supply missing externs
(Shayne Fletcher)

- #12712, #12742: fix an assertion boundary case in `caml_reset_young_limit`
(Jan Midtgaard, review by Guillaume Munch-Maccagnoni and KC Sivaramakrishnan)

Expand Down
8 changes: 8 additions & 0 deletions bytecomp/symtable.ml
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,20 @@ let output_primitive_table outchan =
fprintf outchan "extern value %s(void);\n" prim.(i)
done;
fprintf outchan "typedef value (*c_primitive)(void);\n";
fprintf outchan "#if defined __cplusplus\n";
fprintf outchan "extern const c_primitive caml_builtin_cprim[] = {\n";
fprintf outchan "#else\n";
fprintf outchan "const c_primitive caml_builtin_cprim[] = {\n";
fprintf outchan "#endif\n";
for i = 0 to Array.length prim - 1 do
fprintf outchan " %s,\n" prim.(i)
done;
fprintf outchan " 0 };\n";
fprintf outchan "#if defined __cplusplus\n";
fprintf outchan "extern const char * const caml_names_of_builtin_cprim[] = {\n";
fprintf outchan "#else\n";
fprintf outchan "const char * const caml_names_of_builtin_cprim[] = {\n";
fprintf outchan "#endif\n";
for i = 0 to Array.length prim - 1 do
fprintf outchan " \"%s\",\n" prim.(i)
done;
Expand Down
8 changes: 8 additions & 0 deletions runtime/gen_primsc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,20 @@ sed \

# Generate the table of primitives
echo
echo '#if defined __cplusplus'
echo 'extern const c_primitive caml_builtin_cprim[] = {'
echo '#else'
echo 'const c_primitive caml_builtin_cprim[] = {'
echo '#endif'
sed -e 's/.*/ (c_primitive) &,/' "$primitives"
echo ' 0 };'

# Generate the table of primitive names
echo
echo '#if defined __cplusplus'
echo 'extern const char * const caml_names_of_builtin_cprim[] = {'
echo '#else'
echo 'const char * const caml_names_of_builtin_cprim[] = {'
echo '#endif'
sed -e 's/.*/ "&",/' "$primitives"
echo ' 0 };'

0 comments on commit 4586466

Please sign in to comment.