From 53c45c03884cb5d898c31b704aeae83f5b8c016c Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 11 Sep 2021 09:30:14 -0700 Subject: [PATCH] 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. --- tclpkg/gv/Makefile.am | 2 +- tclpkg/gv/gv.cpp | 7 +------ tclpkg/gv/gv_channel.h | 21 +++++++++++++++++++++ tclpkg/gv/gv_dummy_init.c | 1 + tclpkg/gv/gv_java_init.c | 1 + tclpkg/gv/gv_php_init.c | 1 + tclpkg/gv/gv_tcl_init.c | 1 + 7 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 tclpkg/gv/gv_channel.h 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) { -- 2.40.0