]> granicus.if.org Git - graphviz/commitdiff
use a header with prototypes to squash bindings -Wmissing-prototypes warnings
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 11 Sep 2021 16:30:14 +0000 (09:30 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 19 Sep 2021 02:31:32 +0000 (19:31 -0700)
This removes 30 build warnings and is generally a cleaner way of doing this.

tclpkg/gv/Makefile.am
tclpkg/gv/gv.cpp
tclpkg/gv/gv_channel.h [new file with mode: 0644]
tclpkg/gv/gv_dummy_init.c
tclpkg/gv/gv_java_init.c
tclpkg/gv/gv_php_init.c
tclpkg/gv/gv_tcl_init.c

index 4bb787fbfdef6303d89ca1230a213d2753f423ef..bf74df6cf861ffd3471753ce6b7445f6677001cc 100644 (file)
@@ -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
index aa944d9b6600d61fec55e2d31537cd09280ec402..454ecd2c9968e959dfe4a98ffb4f2a394e7dddb5 100644 (file)
 #include <cstring>
 #include <gvc/gvc.h>
 #include <string>
-
-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 (file)
index 0000000..b84f4d9
--- /dev/null
@@ -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 <gvc/gvc.h>
+
+#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
index 451eac6bb969e83def280f95488a136313f375bf..7c14a1b399d563416ef1d16059d8b0daf1562248 100644 (file)
@@ -1,4 +1,5 @@
 #include <gvc/gvc.h>
+#include "gv_channel.h"
 
 void gv_string_writer_init (GVC_t *gvc) { (void)gvc; }
 void gv_channel_writer_init (GVC_t *gvc) { (void)gvc; }
index 4c1c8b2b78ee24fc22133e6d50b17a0af928bea5..cb8bfc31672a9b65dfe07d1b06cbf9d8c104ebec 100644 (file)
@@ -14,6 +14,7 @@
 #include <gvc/gvplugin.h>
 #include <gvc/gvcjob.h>
 #include <gvc/gvcint.h>
+#include "gv_channel.h"
 
 typedef struct {
     char* data;
index 87113f5e82259dc75dca2ac1224461d9caf51662..e176e2c8f8243551990bc0c9d3d87a16f342d3bf 100644 (file)
@@ -19,6 +19,7 @@
 #include <gvc/gvplugin.h>
 #include <gvc/gvcjob.h>
 #include <gvc/gvcint.h>
+#include "gv_channel.h"
 
 static size_t gv_string_writer (GVJ_t *job, const char *s, size_t len)
 {
index b6cd1944e862f11b6e7a11e162f4935f5cf87756..2deaf9878556f9ead50c84a3846f54ab65e30bff 100644 (file)
@@ -14,6 +14,7 @@
 #include <gvc/gvcjob.h>
 #include <gvc/gvcint.h>
 #include <limits.h>
+#include "gv_channel.h"
 
 static size_t gv_string_writer(GVJ_t *job, const char *s, size_t len)
 {