]> granicus.if.org Git - graphviz/commitdiff
lib/cgraph: include empty malloc.h from subdir include
authorHenrik Grimler <henrik@grimler.se>
Sat, 28 Mar 2020 14:50:15 +0000 (15:50 +0100)
committerHenrik Grimler <henrik@grimler.se>
Sat, 28 Mar 2020 15:45:56 +0000 (16:45 +0100)
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]
```

lib/cgraph/Makefile.am
lib/cgraph/include/malloc.h [moved from lib/cgraph/malloc.h with 100% similarity]

index bb6147b916c12d4873f9e3bf9aba55b2e25904e6..419940a7c349563c49052900e4014fd39aa6f79c 100644 (file)
@@ -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