[master] 54410f97e inline vcc_assert.h in generate.py

Nils Goroll nils.goroll at uplex.de
Tue Feb 2 09:59:07 UTC 2021


commit 54410f97e92caa9458682826871c9503653b268b
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Feb 2 10:53:18 2021 +0100

    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"

diff --git a/include/Makefile.am b/include/Makefile.am
index 25a2c9c8f..818011d3d 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -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 \
diff --git a/include/vcc_assert.h b/include/vcc_assert.h
deleted file mode 100644
index 7e1c7026b..000000000
--- a/include/vcc_assert.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#define assert(e)							\
-do {									\
-	if (!(e)) {							\
-		VPI_Fail(__func__, __FILE__, __LINE__, #e);		\
-	}								\
-} while (0)
diff --git a/lib/libvcc/Makefile.am b/lib/libvcc/Makefile.am
index 17a30de39..1e3d6f2d0 100644
--- a/lib/libvcc/Makefile.am
+++ b/lib/libvcc/Makefile.am
@@ -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 \
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index 94c13c000..dd614f97f 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -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()


More information about the varnish-commit mailing list