From: Matthew Fernandez Date: Sat, 11 Sep 2021 16:30:14 +0000 (-0700) Subject: use a header with prototypes to squash bindings -Wmissing-prototypes warnings X-Git-Tag: 2.49.1~10^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53c45c03884cb5d898c31b704aeae83f5b8c016c;p=graphviz use a header with prototypes to squash bindings -Wmissing-prototypes warnings This removes 30 build warnings and is generally a cleaner way of doing this. --- diff --git a/tclpkg/gv/Makefile.am b/tclpkg/gv/Makefile.am index 4bb787fbf..bf74df6cf 100644 --- a/tclpkg/gv/Makefile.am +++ b/tclpkg/gv/Makefile.am @@ -14,7 +14,7 @@ AM_CPPFLAGS = \ LIBS = -lc -BASESOURCES = gv.cpp gv.i gv_builtins.c +BASESOURCES = gv.cpp gv.i gv_builtins.c gv_channel.h BASELIBS = $(top_builddir)/lib/gvc/libgvc.la \ $(top_builddir)/lib/cgraph/libcgraph.la \ $(top_builddir)/lib/cdt/libcdt.la diff --git a/tclpkg/gv/gv.cpp b/tclpkg/gv/gv.cpp index aa944d9b6..454ecd2c9 100644 --- a/tclpkg/gv/gv.cpp +++ b/tclpkg/gv/gv.cpp @@ -12,12 +12,7 @@ #include #include #include - -extern "C" { -extern void gv_string_writer_init(GVC_t *gvc); -extern void gv_channel_writer_init(GVC_t *gvc); -extern void gv_writer_reset(GVC_t *gvc); -} +#include "gv_channel.h" #define agfindattr(x, s) agattrsym(x, s) #define agraphattr(g, n, s) agattr(g, AGRAPH, n, s) diff --git a/tclpkg/gv/gv_channel.h b/tclpkg/gv/gv_channel.h new file mode 100644 index 000000000..b84f4d962 --- /dev/null +++ b/tclpkg/gv/gv_channel.h @@ -0,0 +1,21 @@ +/// \file +/// \brief language-specific bindings API +/// +/// Each Graphviz language binding is expected to implement the following +/// functions as relevant for their implementation. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void gv_string_writer_init(GVC_t *gvc); +void gv_channel_writer_init(GVC_t *gvc); +void gv_writer_reset(GVC_t *gvc); + +#ifdef __cplusplus +} +#endif diff --git a/tclpkg/gv/gv_dummy_init.c b/tclpkg/gv/gv_dummy_init.c index 451eac6bb..7c14a1b39 100644 --- a/tclpkg/gv/gv_dummy_init.c +++ b/tclpkg/gv/gv_dummy_init.c @@ -1,4 +1,5 @@ #include +#include "gv_channel.h" void gv_string_writer_init (GVC_t *gvc) { (void)gvc; } void gv_channel_writer_init (GVC_t *gvc) { (void)gvc; } diff --git a/tclpkg/gv/gv_java_init.c b/tclpkg/gv/gv_java_init.c index 4c1c8b2b7..cb8bfc316 100644 --- a/tclpkg/gv/gv_java_init.c +++ b/tclpkg/gv/gv_java_init.c @@ -14,6 +14,7 @@ #include #include #include +#include "gv_channel.h" typedef struct { char* data; diff --git a/tclpkg/gv/gv_php_init.c b/tclpkg/gv/gv_php_init.c index 87113f5e8..e176e2c8f 100644 --- a/tclpkg/gv/gv_php_init.c +++ b/tclpkg/gv/gv_php_init.c @@ -19,6 +19,7 @@ #include #include #include +#include "gv_channel.h" static size_t gv_string_writer (GVJ_t *job, const char *s, size_t len) { diff --git a/tclpkg/gv/gv_tcl_init.c b/tclpkg/gv/gv_tcl_init.c index b6cd1944e..2deaf9878 100644 --- a/tclpkg/gv/gv_tcl_init.c +++ b/tclpkg/gv/gv_tcl_init.c @@ -14,6 +14,7 @@ #include #include #include +#include "gv_channel.h" static size_t gv_string_writer(GVJ_t *job, const char *s, size_t len) {