Skip to content

Commit

Permalink
[hlc] disable dump_types by default (#11673)
Browse files Browse the repository at this point in the history
* [hlc] disable dump_types by default

* Fix ifdef indentation

* Print error instead of throw

* Use a normal printf for message
  • Loading branch information
yuxiaomao authored May 22, 2024
1 parent 68dbebd commit 10c3d4a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/generators/hl2c.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,7 @@ let write_c com file (code:code) gnames =
line "";
line "static void dump_types( void (*fdump)( void *, int) ) {";
block ctx;
line "#ifdef HL_DUMP_TYPES";
sexpr "hl_type *t";
sexpr "int ntypes = %d" (Array.length all_types);
sexpr "fdump(&ntypes,4)";
Expand All @@ -1728,6 +1729,9 @@ let write_c com file (code:code) gnames =
sexpr "t = (hl_type*)&%s.fun->closure_type; fdump(&t, sizeof(void*))" (type_name ctx t);
| _ -> ()
) all_types;
line "#else";
sexpr "printf(\"dump_types not available, please compile with HL_DUMP_TYPES defined\\n\")";
line "#endif";
unblock ctx;
line "}";

Expand Down

0 comments on commit 10c3d4a

Please sign in to comment.