]> granicus.if.org Git - graphviz/commit
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)
commit9c24c6bf70fad7a2da02d6308fc35a589f72f0e1
treee70b670231d481af5eb6d1857063c32f15b075b1
parente55af3cce23ddcdeefb42b75d115ee23e86e456b
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]
```
lib/cgraph/Makefile.am
lib/cgraph/include/malloc.h [moved from lib/cgraph/malloc.h with 100% similarity]