From: Henrik Grimler Date: Sat, 28 Mar 2020 14:50:15 +0000 (+0100) Subject: lib/cgraph: include empty malloc.h from subdir include X-Git-Tag: stable_release_2.44.0~16^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c24c6bf70fad7a2da02d6308fc35a589f72f0e1;p=graphviz lib/cgraph: include empty malloc.h from subdir include Having it directly in cgraph/ means that this file is found by all other libs with `-Ilib/cgraph/`. Since it is only needed by cgraph we can move it to a subdirectory and add `-Iinclude/` to the cgraph Makefile. If the other libraries and plugins picks up the empty malloc.h it causes problems on some systems when compiling for example lib/sfdpgen/PriorityQueue.c and plugin/visio/VisioGraphic.cpp where it gives errors like: ``` /storage/termux-build/graphviz/src/lib/sfdpgen/PriorityQueue.c:96:40: error: use of undeclared identifier 'free'; did you mean 'frexp'? DoubleLinkedList_delete_element(l, free, &((q->buckets)[gainold])); ^~~~ frexp ``` and ``` [...] In file included from /storage/termux-build/graphviz/src/plugin/visio/VisioGraphic.cpp:16: In file included from /storage/termux-build/_cache/android-r20-api-24-v3/bin/../sysroot/usr/include/c++/v1/algorithm:644: In file included from /storage/termux-build/_cache/android-r20-api-24-v3/bin/../sysroot/usr/include/c++/v1/memory:654: In file included from /storage/termux-build/_cache/android-r20-api-24-v3/bin/../sysroot/usr/include/c++/v1/typeinfo:61: In file included from /storage/termux-build/_cache/android-r20-api-24-v3/bin/../sysroot/usr/include/c++/v1/exception:82: /storage/termux-build/_cache/android-r20-api-24-v3/bin/../sysroot/usr/include/c++/v1/cstdlib:125:9: error: no member named 'calloc' in the global namespace using ::calloc; ~~^ [...] ``` On other systems the compilation succeeds but with warnings like ``` ../../../lib/common/memory.c:47:10: warning: implicitly declaring library function 'malloc' with type 'void *(unsigned long)' [-Wimplicit-function-declaration] ``` --- diff --git a/lib/cgraph/Makefile.am b/lib/cgraph/Makefile.am index bb6147b91..419940a7c 100644 --- a/lib/cgraph/Makefile.am +++ b/lib/cgraph/Makefile.am @@ -8,10 +8,11 @@ pkgconfigdir = $(libdir)/pkgconfig AM_CPPFLAGS = \ -I$(top_srcdir) \ - -I$(top_srcdir)/lib/cdt + -I$(top_srcdir)/lib/cdt \ + -Iinclude pkginclude_HEADERS = cgraph.h -noinst_HEADERS = agxbuf.h cghdr.h malloc.h +noinst_HEADERS = agxbuf.h cghdr.h include/malloc.h noinst_LTLIBRARIES = libcgraph_C.la lib_LTLIBRARIES = libcgraph.la pkgconfig_DATA = libcgraph.pc diff --git a/lib/cgraph/malloc.h b/lib/cgraph/include/malloc.h similarity index 100% rename from lib/cgraph/malloc.h rename to lib/cgraph/include/malloc.h