]> granicus.if.org Git - graphviz/commitdiff
render: unconditionally include stdlib.h
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Sun, 3 Apr 2022 06:49:41 +0000 (08:49 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 18 Apr 2022 06:06:58 +0000 (08:06 +0200)
Without this change, attempting to include geomproc.h in render.h
would cause the following warning:

In file included from /home/magjac/graphviz/lib/common/shapes.c:12:
/home/magjac/graphviz/lib/common/render.h:24: warning: "__USE_GNU" redefined
   24 | #define __USE_GNU
      |
In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/limits.h:26,
                 from /usr/lib/gcc/x86_64-linux-gnu/11/include/limits.h:203,
                 from /usr/lib/gcc/x86_64-linux-gnu/11/include/syslimits.h:7,
                 from /usr/lib/gcc/x86_64-linux-gnu/11/include/limits.h:34,
                 from /home/magjac/graphviz/lib/common/arith.h:21,
                 from /home/magjac/graphviz/lib/common/geom.h:16,
                 from /home/magjac/graphviz/lib/common/geomprocs.h:21,
                 from /home/magjac/graphviz/lib/common/shapes.c:11:
/usr/include/features.h:407: note: this is the location of the previous definition
  407 | # define __USE_GNU      1
      |

This is casued by arith.h defining _GNU_SOURCE to 1 which seems to
implicitly set __USE_GNU.

lib/common/render.h

index 28ef222ae5b8aedf94e7dfa8516f77337b2c264b..9bdda0bc9fefa3b97e0e291c421c2597b611497d 100644 (file)
@@ -20,13 +20,7 @@ extern "C" {
 #include <sys/types.h>
 #endif
 #include <stdbool.h>
-#if !defined(_WIN32) && !defined(DARWIN)
-#define __USE_GNU
 #include <stdlib.h>
-#undef __USE_GNU
-#else
-#include <stdlib.h>
-#endif
 #include <stddef.h>
 #include <string.h>