inline vcc_assert.h in generate.py

as requested by phk.

I found no way to avoid having to escape the backslashes because python,
even for uninterpolated ''' long strings, sees them as line continuations.

The generated output is identical except for two comments (in the code
and the code output by the code).

--- ./lib/libvcc/vcc_fixed_token.o.c	2021-02-02 10:40:03.725244373 +0100
+++ ./lib/libvcc/vcc_fixed_token.c	2021-02-02 10:52:04.921259718 +0100
@@ -834,10 +834,7 @@
 	    "uct vre **, const char *);\nvoid VPI_re_fini(struct vre *);\n"
 	);
 	VSB_cat(sb, "\n");
-
-	/* ../include/vcc_assert.h */
-
-	VSB_cat(sb, "/* ---===### include/vcc_assert.h ###===--- */\n\n");
+	VSB_cat(sb, "/* ---===### vgc asserts (generate.py) ###===--- */\n\n");
 	VSB_cat(sb, "#define assert(e)\t\t\t\t\t\t\t\\\ndo {\t\t\t\t"
 	    "\t\t\t\t\t\\\n\tif (!(e)) {\t\t\t\t\t\t\t\\\n\t\tVPI_Fail(__func"
 	    "__, __FILE__, __LINE__, #e);\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n"
parent 65e68232
......@@ -83,7 +83,6 @@ nobase_noinst_HEADERS = \
compat/daemon.h \
vfl.h \
libvcc.h \
vcc_assert.h \
vcc_interface.h \
vcli_serve.h \
vcs_version.h \
......@@ -110,7 +109,6 @@ nobase_noinst_HEADERS = \
## keep in sync with lib/libvcc/Makefile.am
vcl.h: \
$(top_srcdir)/lib/libvcc/generate.py \
$(top_srcdir)/include/vcc_assert.h \
$(top_srcdir)/include/vcc_interface.h \
$(top_srcdir)/include/vdef.h \
$(top_srcdir)/include/vrt.h \
......
#define assert(e) \
do { \
if (!(e)) { \
VPI_Fail(__func__, __FILE__, __LINE__, #e); \
} \
} while (0)
......@@ -44,7 +44,6 @@ dist_pkgdata_SCRIPTS = \
## keep in sync with include/Makefile.am
vcc_obj.c: \
$(top_srcdir)/lib/libvcc/generate.py \
$(top_srcdir)/include/vcc_assert.h \
$(top_srcdir)/include/vcc_interface.h \
$(top_srcdir)/include/vdef.h \
$(top_srcdir)/include/vrt.h \
......
......@@ -795,7 +795,14 @@ emit_file(fo, srcroot, "include/vrt.h")
emit_file(fo, buildroot, "include/vcl.h")
emit_file(fo, buildroot, "include/vrt_obj.h")
emit_file(fo, srcroot, "include/vcc_interface.h")
emit_file(fo, srcroot, "include/vcc_assert.h")
emit_strings(fo, "vgc asserts (generate.py)",
'''#define assert(e) \\
do { \\
if (!(e)) { \\
VPI_Fail(__func__, __FILE__, __LINE__, #e); \\
} \\
} while (0)
''')
fo.write("\n}\n")
fo.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment