浏览代码

[hlc] disable dump_types by default (#11673)

* [hlc] disable dump_types by default

* Fix ifdef indentation

* Print error instead of throw

* Use a normal printf for message
Yuxiao Mao 1 年之前
父节点
当前提交
10c3d4a0aa
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/generators/hl2c.ml

+ 4 - 0
src/generators/hl2c.ml

@@ -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)";
@@ -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 "}";