]> granicus.if.org Git - graphviz/log
graphviz
2 years agopathfind: remove unused strings.h #include
Matthew Fernandez [Sat, 19 Mar 2022 20:17:02 +0000 (13:17 -0700)]
pathfind: remove unused strings.h #include

2 years agopathcanon: remove unused 'loop' variable
Matthew Fernandez [Sat, 19 Mar 2022 20:13:17 +0000 (13:13 -0700)]
pathcanon: remove unused 'loop' variable

2 years agopathcanon: remove unnecessary 'errno' save and restore
Matthew Fernandez [Sat, 19 Mar 2022 20:12:20 +0000 (13:12 -0700)]
pathcanon: remove unnecessary 'errno' save and restore

a3db9ad8f8eb79a931f0bc6d087ca3b52de3dd62 removed any logic in this function that
affected `errno`. So there is no need to save and restore it anymore.

2 years agoMerge branch 'smattr/9E1814ED-8451-43CC-A7A1-AAF2BE8EDF86' into 'main'
Matthew Fernandez [Thu, 24 Mar 2022 16:52:38 +0000 (16:52 +0000)]
Merge branch 'smattr/9E1814ED-8451-43CC-A7A1-AAF2BE8EDF86' into 'main'

roll out cgraph allocation wrappers to edgepaint

See merge request graphviz/graphviz!2517

2 years agoccomps: abbreviate an open coded 'gv_strndup'
Matthew Fernandez [Fri, 18 Mar 2022 15:21:23 +0000 (08:21 -0700)]
ccomps: abbreviate an open coded 'gv_strndup'

2 years agocgraph: add a 'strndup' allocation wrapper
Matthew Fernandez [Fri, 18 Mar 2022 15:18:41 +0000 (08:18 -0700)]
cgraph: add a 'strndup' allocation wrapper

2 years agoedgepaint: free 'lightness' prior to exit
Matthew Fernandez [Thu, 17 Mar 2022 04:23:35 +0000 (21:23 -0700)]
edgepaint: free 'lightness' prior to exit

Some small progress to becoming leak-free even on clean exit.

2 years agoedgepaint: replace a 'strdup' with 'gv_strdup'
Matthew Fernandez [Thu, 17 Mar 2022 04:22:48 +0000 (21:22 -0700)]
edgepaint: replace a 'strdup' with 'gv_strdup'

This allocation was not handling failure and the only reasonable response here
is to exit.

2 years agocgraph: add a 'strdup' wrapper to the allocation helpers
Matthew Fernandez [Thu, 17 Mar 2022 04:21:01 +0000 (21:21 -0700)]
cgraph: add a 'strdup' wrapper to the allocation helpers

2 years agoMerge branch 'smattr/2E1672CD-0A70-45B7-8770-A81BE7638FA4' into 'main'
Matthew Fernandez [Sun, 20 Mar 2022 02:42:59 +0000 (02:42 +0000)]
Merge branch 'smattr/2E1672CD-0A70-45B7-8770-A81BE7638FA4' into 'main'

document 'SIGUSR1' handling

See merge request graphviz/graphviz!2515

2 years agodot: make a man page note about 'SIGUSR1' effects
Matthew Fernandez [Wed, 16 Mar 2022 14:42:01 +0000 (07:42 -0700)]
dot: make a man page note about 'SIGUSR1' effects

2 years agoselfRightSpace: consistently use a double for calculating self width
Matthew Fernandez [Mon, 14 Mar 2022 15:09:29 +0000 (08:09 -0700)]
selfRightSpace: consistently use a double for calculating self width

This avoids going backwards and forwards between double and int, which was
causing some compiler warnings and unnecessary loss of precision.

2 years agoMerge branch 'smattr/5d0e6877-4a8c-45a9-b1b5-f83e9328eeaf' into 'main'
Matthew Fernandez [Sat, 19 Mar 2022 21:54:37 +0000 (21:54 +0000)]
Merge branch 'smattr/5d0e6877-4a8c-45a9-b1b5-f83e9328eeaf' into 'main'

add Mingle to the CMake build system

See merge request graphviz/graphviz!2383

2 years agoadd Mingle to the CMake build system
Matthew Fernandez [Sat, 25 Dec 2021 19:25:29 +0000 (11:25 -0800)]
add Mingle to the CMake build system

Gitlab: related to #1835, #1836, #1854

2 years agoCI: install 'libANN' on macOS
Matthew Fernandez [Fri, 11 Mar 2022 14:53:49 +0000 (06:53 -0800)]
CI: install 'libANN' on macOS

This is a dependency of lib/mingle, and transitively cmd/mingle. Note that this
is not available through Homebrew so we need to use MacPorts.

2 years agoCI: move macOS dependency installation out of line
Matthew Fernandez [Fri, 11 Mar 2022 14:49:26 +0000 (06:49 -0800)]
CI: move macOS dependency installation out of line

Makes these a little easier to manage. Note that this also unifies the runtime
dependencies installed in Autotools and CMake jobs which simplifies ongoing
maintenance.

2 years agoCI: rearrange macOS step related to Bison
Matthew Fernandez [Fri, 11 Mar 2022 05:24:46 +0000 (21:24 -0800)]
CI: rearrange macOS step related to Bison

It makes it more obvious why this step is being done when it is adjacent to the
Bison install itself.

2 years agoCI: install 'libann-dev' on Ubuntu
Matthew Fernandez [Fri, 11 Mar 2022 02:56:03 +0000 (18:56 -0800)]
CI: install 'libann-dev' on Ubuntu

This is a dependency of lib/mingle, and transitively cmd/mingle.

2 years agotests: move 'is_cmake' helper into gvtest library
Matthew Fernandez [Fri, 11 Mar 2022 05:20:18 +0000 (21:20 -0800)]
tests: move 'is_cmake' helper into gvtest library

2 years agotests: de-dupe some MinGW detection logic
Matthew Fernandez [Fri, 11 Mar 2022 04:48:10 +0000 (20:48 -0800)]
tests: de-dupe some MinGW detection logic

2 years agotests: move 'is_mingw' helper into gvtest library
Matthew Fernandez [Fri, 11 Mar 2022 04:47:12 +0000 (20:47 -0800)]
tests: move 'is_mingw' helper into gvtest library

2 years agolib/mingle: remove commented out branch
Matthew Fernandez [Sat, 12 Mar 2022 04:16:39 +0000 (20:16 -0800)]
lib/mingle: remove commented out branch

This causes -Wconstant-logical-operand warnings, failing a CMake build on macOS.
It seems simplest to just remove this disabled code.

2 years agolib/mingle: squash -Wconstant-logical-operand warnings
Matthew Fernandez [Sat, 12 Mar 2022 02:44:37 +0000 (18:44 -0800)]
lib/mingle: squash -Wconstant-logical-operand warnings

When enabling this code on macOS, Clang complains about this.

2 years agofix: teach mingle '-?' on macOS and Windows
Matthew Fernandez [Fri, 11 Mar 2022 03:59:09 +0000 (19:59 -0800)]
fix: teach mingle '-?' on macOS and Windows

This is the equivalent of b4925c87f1e28a1bc66d111ef046e4e083db8c5b and friends,
but for mingle. It was not previously detected that this problem also affects
mingle because it is not currently built on macOS or Windows in CI. This will be
improved in future.

Gitlab: #1852

2 years agoMerge branch 'smattr/5A4AA4D3-3163-49C0-9DF1-A0ADA71E3554' into 'main'
Matthew Fernandez [Sat, 19 Mar 2022 18:40:02 +0000 (18:40 +0000)]
Merge branch 'smattr/5A4AA4D3-3163-49C0-9DF1-A0ADA71E3554' into 'main'

Revert "rewrite indexOf"

Closes #2211

See merge request graphviz/graphviz!2513

2 years agoRevert "rewrite indexOf"
Matthew Fernandez [Mon, 14 Mar 2022 05:27:02 +0000 (22:27 -0700)]
Revert "rewrite indexOf"

This reverts commit 84efe93d5c5a4da0e778dbf01ed8550d2d774fdf.

Gitlab: fixes #2211

2 years agoadd a test case for #2211
Matthew Fernandez [Mon, 14 Mar 2022 02:23:28 +0000 (19:23 -0700)]
add a test case for #2211

2 years agotests: abstract the common case for running 'gvpr'
Matthew Fernandez [Mon, 14 Mar 2022 02:20:55 +0000 (19:20 -0700)]
tests: abstract the common case for running 'gvpr'

2 years agoMerge branch 'smattr/106DE02D-AD56-466A-96C1-9D2AC5315DD6' into 'main'
Matthew Fernandez [Sat, 19 Mar 2022 06:46:15 +0000 (06:46 +0000)]
Merge branch 'smattr/106DE02D-AD56-466A-96C1-9D2AC5315DD6' into 'main'

lib/common: some clean up and warning squashing

See merge request graphviz/graphviz!2511

2 years agoprocessTbl: use unsigned shorts for 'r' and 'c' locals
Matthew Fernandez [Sun, 13 Mar 2022 21:10:19 +0000 (14:10 -0700)]
processTbl: use unsigned shorts for 'r' and 'c' locals

Squashes two MSVC conversion warnings.

2 years agosize_html_txt: use a C99 bool for 'simple'
Matthew Fernandez [Sun, 13 Mar 2022 21:07:21 +0000 (14:07 -0700)]
size_html_txt: use a C99 bool for 'simple'

Squashes an MSVC conversion warning.

2 years agoinitAnchor: squash C4244 MSVC warning for 'explicit_tooltip'
Matthew Fernandez [Sun, 13 Mar 2022 21:05:35 +0000 (14:05 -0700)]
initAnchor: squash C4244 MSVC warning for 'explicit_tooltip'

MSVC seems particularly pedantic about implicitly converting an unsigned 1-bit
bitfield to a bool:

  warning C4244: 'function': conversion from 'unsigned int' to 'bool'

These bitfields should really be signed (`int`) but it does not seem worth the
API break to do this.

2 years agohtmlparse.y: remove some unnecessary casts
Matthew Fernandez [Sun, 13 Mar 2022 21:02:11 +0000 (14:02 -0700)]
htmlparse.y: remove some unnecessary casts

2 years agohtmlparse.y: consistently treat 'kind' as a 'char'
Matthew Fernandez [Sun, 13 Mar 2022 20:59:50 +0000 (13:59 -0700)]
htmlparse.y: consistently treat 'kind' as a 'char'

The `kind` field in `htmllabel_t` is a `char`, so this code was causing
conversion compiler warnings when trying to assign an `int` to it. We can avoid
this ambiguity by consistently using the same type everywhere.

2 years agoemit_end_edge: squash C4244 MSVC warnings for 'nodeIntersect' calls
Matthew Fernandez [Sun, 13 Mar 2022 20:50:43 +0000 (13:50 -0700)]
emit_end_edge: squash C4244 MSVC warnings for 'nodeIntersect' calls

MSVC seems particularly pedantic about implicitly converting an unsigned 1-bit
bitfield to a bool:

  warning C4244: 'function': conversion from 'unsigned int' to 'bool'

These bitfields should really be signed (`int`) but it does not seem worth the
API break to do this.

2 years agocheck_control_points: remove a use of int as boolean
Matthew Fernandez [Sun, 13 Mar 2022 20:36:30 +0000 (13:36 -0700)]
check_control_points: remove a use of int as boolean

2 years agoMerge branch 'smattr/4C161FEF-32BC-4E3C-8E1C-1976BC9E6E9C' into 'main'
Matthew Fernandez [Sat, 19 Mar 2022 05:07:14 +0000 (05:07 +0000)]
Merge branch 'smattr/4C161FEF-32BC-4E3C-8E1C-1976BC9E6E9C' into 'main'

pathcanon: clean up dead code

See merge request graphviz/graphviz!2512

2 years agopathcanon: remove 'FS_3D'-guarded code
Matthew Fernandez [Mon, 14 Mar 2022 00:38:59 +0000 (17:38 -0700)]
pathcanon: remove 'FS_3D'-guarded code

Nothing in the build systems defines this macro. It is also unclear how this
code could be used given it calls `pathnext`, a function that has never been
committted to the Graphviz repository.

2 years agoremove now-unused 'pathgetlink'
Matthew Fernandez [Mon, 14 Mar 2022 00:36:55 +0000 (17:36 -0700)]
remove now-unused 'pathgetlink'

2 years agopathcanon: remove 'flags' argument
Matthew Fernandez [Mon, 14 Mar 2022 00:34:07 +0000 (17:34 -0700)]
pathcanon: remove 'flags' argument

This function was only ever called with `0` as `flags`, which disables a lot of
its logic. We can reduce the amount of ongoing code to maintain by paring this
back to just the core in use.

2 years agoMerge branch 'remove-eol-spaces' into 'main'
Matthew Fernandez [Fri, 18 Mar 2022 16:10:30 +0000 (16:10 +0000)]
Merge branch 'remove-eol-spaces' into 'main'

2184.dot: remove eol spaces

See merge request graphviz/graphviz!2516

2 years ago2184.dot: remove eol spaces
Costa Shulyupin [Fri, 18 Mar 2022 07:28:49 +0000 (09:28 +0200)]
2184.dot: remove eol spaces

2 years agoMerge branch 'smattr/050F6C7D-7BC7-444D-9D6C-99C0762069CA' into 'main'
Matthew Fernandez [Fri, 18 Mar 2022 15:07:56 +0000 (15:07 +0000)]
Merge branch 'smattr/050F6C7D-7BC7-444D-9D6C-99C0762069CA' into 'main'

cgraph: implement memory allocation wrappers

See merge request graphviz/graphviz!2510

2 years agoccomps: replace local allocation wrappers with cgraph ones
Matthew Fernandez [Sat, 12 Mar 2022 20:40:16 +0000 (12:40 -0800)]
ccomps: replace local allocation wrappers with cgraph ones

A first example use of the functions from the prior commit.

2 years agocgraph: implement memory allocation wrappers
Matthew Fernandez [Sat, 12 Mar 2022 20:30:35 +0000 (12:30 -0800)]
cgraph: implement memory allocation wrappers

This change replicates and extends the exit-on-failure allocation wrappers from
lib/common/memory.c into a header-only implementation in cgraph. The existing
common wrappers worked but there were two limitations preventing their wider
use:

  1. lib/common is not the base of the Graphviz dependency graph. E.g.
     lib/cgraph does not depend on lib/common, preventing calling
     lib/common/memory.h functions from cgraph code. lib/cgraph is not the base
     of the dependency graph either (it depends on lib/cdt), but it has become a
     de facto home for header-only implementations of general utility functions
     called throughout the rest of the Graphviz code base.

  2. lib/common is not linked against by every Graphviz component. This meant
     other code could attempt to call functions in lib/common/memory.h but would
     fail to link because it was not pulling in lib/common/memory.c.

Relocating these functions neatly solves both the above two. It also has the
side effect of allowing compilers to inline these short wrappers. This could
(and would) previously be achieved with Link-Time Optimization, but now a
regular optimizing compilation can also achieve this.

Future changes will remove the lib/common/memory.c wrappers in favor of these.

2 years agoMerge branch 'truenorth-issue-2184' into 'main'
Matthew Fernandez [Thu, 17 Mar 2022 05:28:42 +0000 (05:28 +0000)]
Merge branch 'truenorth-issue-2184' into 'main'

Attempt to fix initialization of subgraph attributes on existing subgraphs...

See merge request graphviz/graphviz!2504

2 years agoparenthesize conditional blocks and clang-format prior code changes truenorth-issue-2184
Matthew Fernandez [Sun, 13 Mar 2022 17:31:22 +0000 (10:31 -0700)]
parenthesize conditional blocks and clang-format prior code changes

2 years agoAttempt to fix initialization of subgraph attributes on existing subgraphs…
Stephen C North [Mon, 7 Mar 2022 23:39:41 +0000 (18:39 -0500)]
Attempt to fix initialization of subgraph attributes on existing subgraphs…

Attempt to fix initialization of subgraph attributes on existing subgraphs when
a new root graph attribute is created.

Fix issue 2184, initialization of existing subgraph attributes when a new top
level graph attribute is created. Looks ok, but new code unviewsubgraphsattr is
executed on many of the test graphs, so this should be tested carefully.

2 years agoadd #2184 test cases
Matthew Fernandez [Thu, 10 Mar 2022 03:41:56 +0000 (19:41 -0800)]
add #2184 test cases

2 years agoMerge branch 'smattr/BD8C9D81-BF8B-4ED0-8A5F-3611689F010D' into 'main'
Matthew Fernandez [Sun, 13 Mar 2022 21:21:14 +0000 (21:21 +0000)]
Merge branch 'smattr/BD8C9D81-BF8B-4ED0-8A5F-3611689F010D' into 'main'

ccomps: some movement towards thread safety and some clean up

See merge request graphviz/graphviz!2508

2 years agoccomps: remove unnecessary parens
Matthew Fernandez [Sat, 12 Mar 2022 19:37:40 +0000 (11:37 -0800)]
ccomps: remove unnecessary parens

2 years agoccomps: remove redundant 'fflush'
Matthew Fernandez [Sat, 12 Mar 2022 19:37:12 +0000 (11:37 -0800)]
ccomps: remove redundant 'fflush'

Closing a file already flushes all written data to disk.

2 years agoccomps process: more tightly scope temporary buffer usage
Matthew Fernandez [Sat, 12 Mar 2022 19:32:25 +0000 (11:32 -0800)]
ccomps process: more tightly scope temporary buffer usage

This makes it harder to accidentally introduce a use-after-free in this code.

2 years agoccomps processClusters: more tightly scope temporary buffer usage
Matthew Fernandez [Sun, 13 Mar 2022 20:07:51 +0000 (13:07 -0700)]
ccomps processClusters: more tightly scope temporary buffer usage

This makes it harder to accidentally introduce a use-after-free in this code.

2 years agoccomps: remove use of long lived 'getBuf' allocation
Matthew Fernandez [Sat, 12 Mar 2022 19:28:16 +0000 (11:28 -0800)]
ccomps: remove use of long lived 'getBuf' allocation

Allows more localized reasoning. This also makes progress towards thread safety.

2 years agoccomps: remove parameter to 'split'
Matthew Fernandez [Sat, 12 Mar 2022 19:21:45 +0000 (11:21 -0800)]
ccomps: remove parameter to 'split'

This function was retaining a pointer to memory pointed to by its parameter,
`name`, in the global `suffix`. So it is unsafe to call this with anything
except a long lived string. We can make this more obvious/explicit by inlining
the use of `outfile`, the only parameter it is ever called with.

2 years agoccomps: make all internal variables static
Matthew Fernandez [Sat, 12 Mar 2022 19:20:02 +0000 (11:20 -0800)]
ccomps: make all internal variables static

2 years agoMerge branch 'smattr/ec571e5b-baf1-40a7-add9-416a446bd4b2' into 'main'
Matthew Fernandez [Sun, 13 Mar 2022 19:45:44 +0000 (19:45 +0000)]
Merge branch 'smattr/ec571e5b-baf1-40a7-add9-416a446bd4b2' into 'main'

some misc clean up

See merge request graphviz/graphviz!2507

2 years agofinishEdge: remove now-unused 'p' and 'q' parameters
Matthew Fernandez [Sat, 12 Mar 2022 04:29:20 +0000 (20:29 -0800)]
finishEdge: remove now-unused 'p' and 'q' parameters

2 years agofinishEdge: remove now-unused 'p1' and 'q1' locals
Matthew Fernandez [Sat, 12 Mar 2022 04:22:49 +0000 (20:22 -0800)]
finishEdge: remove now-unused 'p1' and 'q1' locals

2 years agomakePolyline: remove now-unused 'p0' and 'q0' locals
Matthew Fernandez [Sat, 12 Mar 2022 04:21:37 +0000 (20:21 -0800)]
makePolyline: remove now-unused 'p0' and 'q0' locals

2 years agomakeStraightEdges: remove now-unused 'p' and 'q' locals
Matthew Fernandez [Sat, 12 Mar 2022 04:20:42 +0000 (20:20 -0800)]
makeStraightEdges: remove now-unused 'p' and 'q' locals

2 years agoaddEdgeLabels: remove unused parameters
Matthew Fernandez [Sat, 12 Mar 2022 04:18:25 +0000 (20:18 -0800)]
addEdgeLabels: remove unused parameters

The use of separate points to the edge itself was removed in commit
24c4a1ce2994b624ba680c74a33aef60ec16de21 in 2011.

2 years agomkMaze: remove unused 'doLbls' parameter
Matthew Fernandez [Sat, 12 Mar 2022 03:54:20 +0000 (19:54 -0800)]
mkMaze: remove unused 'doLbls' parameter

2 years agomkMaze: abbreviate some open coded 'fmax'
Matthew Fernandez [Sat, 12 Mar 2022 03:49:54 +0000 (19:49 -0800)]
mkMaze: abbreviate some open coded 'fmax'

2 years agoMerge branch 'smattr/275A397A-C582-46E4-BA96-18CE75BABA1C' into 'main'
Matthew Fernandez [Sun, 13 Mar 2022 18:31:01 +0000 (18:31 +0000)]
Merge branch 'smattr/275A397A-C582-46E4-BA96-18CE75BABA1C' into 'main'

GD plugin: some minor fixes to use of `gdIOCtxPtr`

See merge request graphviz/graphviz!2509

2 years agoGD plugin: remove repurposing of 'tell' member of I/O context
Matthew Fernandez [Thu, 3 Mar 2022 06:56:11 +0000 (22:56 -0800)]
GD plugin: remove repurposing of 'tell' member of I/O context

The GD plugin was using (abusing) the `gdIOCtx.tell` field as a way to pass
around the Graphviz context through GD library functions and callbacks. The GD
docs¹ have this to say about the `tell` field:

  The seek and tell functions are only required in conjunction with the gd2 file
  format, which supports quick loading of partial images.

The Graphviz GD plugin _is_ using gd2 functionality, so it seems its usage only
works out because it coincidentally does not hit any code paths that use `tell`.

We can avoid this latent issue entirely by rephrasing the way the plugin passes
the Graphviz context around to something less brittle. The approach taken in
this commit is inspired by something like Linux’s `container_of` macro.

¹ https://libgd.github.io/manuals/2.3.3/files/gd_io-h.html#gdIOCtx

2 years agoGD plugin: fix: zero I/O contexts on creation
Matthew Fernandez [Thu, 3 Mar 2022 06:33:39 +0000 (22:33 -0800)]
GD plugin: fix: zero I/O contexts on creation

The GD plugin was creating `gdIOCtx` objects on the stack with some
uninitialized members. At time of writing, the GD docs¹ claim this struct’s
layout is:

  typedef struct gdIOCtx
  {
    int (*getC)(gdIOCtxPtr);
    int (*getBuf)(gdIOCtxPtr, void *, int wanted);

    void (*putC)(gdIOCtxPtr, int);
    int (*putBuf)(gdIOCtxPtr, const void *, int wanted);

    // seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek!
    int (*seek)(gdIOCtxPtr, const int);
    long (*tell)(gdIOCtxPtr);

    void (*gd_free)(gdIOCtxPtr);
  } gdIOCtx;

So Graphviz’ usage was leaving `getC`, `getBuf`, `seek`, and `gd_free`
uninitialized. This seems to work out OK; Graphviz’ usage of libgd apparently
does not involve any code paths that use these members. But this does not seem
to be an API guarantee. This change zeroes these members for future stability.

¹ https://libgd.github.io/manuals/2.3.3/files/gd_io-h.html#gdIOCtx

2 years agoMerge branch 'smattr/C10BAFD7-8A61-449E-AD42-00D171808AAD' into 'main'
Matthew Fernandez [Sun, 13 Mar 2022 02:14:33 +0000 (02:14 +0000)]
Merge branch 'smattr/C10BAFD7-8A61-449E-AD42-00D171808AAD' into 'main'

gvplugin_install: remove 63-character limit on plugin names

See merge request graphviz/graphviz!2505

2 years agoMerge branch 'smattr/DA683A5D-79E9-46FD-B58A-A0DBAAE673A1' into 'main'
Matthew Fernandez [Sun, 13 Mar 2022 01:01:47 +0000 (01:01 +0000)]
Merge branch 'smattr/DA683A5D-79E9-46FD-B58A-A0DBAAE673A1' into 'main'

avoid use of '__builtin_unreachable' in 'UNREACHABLE' macro

See merge request graphviz/graphviz!2506

2 years agogvplugin_install: remove 63-character limit on plugin names
Matthew Fernandez [Sun, 6 Mar 2022 03:09:43 +0000 (19:09 -0800)]
gvplugin_install: remove 63-character limit on plugin names

This change rephrases `gvplugin_install` to avoid the use of intermediate
buffers and, in the process, removes a constraint on the maximum length of
plugin names. That is, this is a performance improvement and a functional
improvement.

2 years agoavoid use of '__builtin_unreachable' in 'UNREACHABLE' macro
Matthew Fernandez [Thu, 10 Mar 2022 02:57:17 +0000 (18:57 -0800)]
avoid use of '__builtin_unreachable' in 'UNREACHABLE' macro

There was some discussion on !2503¹ around the effect of `__builtin_unreachable`
and whether we are really confident applying such a strong compiler hint to
complex control flow logic that is, in some cases, only partially understood.
This change softens the effect of the `UNREACHABLE` macro to a reliable program
abort rather than undefined behavior if mistakenly tagged unreachable code is
reached. The result is slightly less efficient but safer code.

¹ https://gitlab.com/graphviz/graphviz/-/merge_requests/2503#note_866261546

2 years agoMerge branch 'smattr/CFF10D10-9221-483B-8A24-6716633FE172' into 'main'
Matthew Fernandez [Sat, 12 Mar 2022 23:45:08 +0000 (23:45 +0000)]
Merge branch 'smattr/CFF10D10-9221-483B-8A24-6716633FE172' into 'main'

fix corruption of user shape characteristics during EPSF initialization

See merge request graphviz/graphviz!2498

2 years agofix corruption of user shape characteristics during EPSF initialization
Matthew Fernandez [Sun, 6 Mar 2022 22:28:23 +0000 (14:28 -0800)]
fix corruption of user shape characteristics during EPSF initialization

From the surrounding context, it is clear this code was intending to set `h`,
the height of the shape, not overwrite the `y` coordinate it had previously set
for the shape. This change not only fixes the overwrite of `us->y` but fixes a
read of uninitialized memory in `us->h` by the caller of this function.

It is not clear to me what the full user-visible effect of this change is.

2 years agoMerge branch 'fix-out-of-source-build' into 'main'
Matthew Fernandez [Sat, 12 Mar 2022 21:01:24 +0000 (21:01 +0000)]
Merge branch 'fix-out-of-source-build' into 'main'

fix autotools out of source build errors

Closes #2207

See merge request graphviz/graphviz!2490

2 years agofix out of source build error in lib/expr
Costa Shulyupin [Thu, 10 Mar 2022 07:47:14 +0000 (09:47 +0200)]
fix out of source build error in lib/expr

make[3]: Entering directory '/home/costa/oss/graphviz/build/lib/expr'
  CC       excc.lo
In file included from ../../../lib/expr/expr.h:28,
                 from ../../../lib/expr/exlib.h:126,
                 from ../../../lib/expr/excc.c:25:
../../../lib/expr/exparse.h:4:10: fatal error: expr/y.tab.h: No such file or directory
    4 | #include <expr/y.tab.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.

2 years agofix out of source build error in lib/common
Costa Shulyupin [Thu, 10 Mar 2022 07:40:06 +0000 (09:40 +0200)]
fix out of source build error in lib/common

make[4]: Entering directory '/home/costa/oss/graphviz/build/lib/common'
  CC       arrows.lo
../../../lib/common/arrows.c: In function ‘arrowOrthoClip’:
.....
../../../lib/common/colxlate.c:21:10: fatal error: common/colortbl.h: No such file or directory
   21 | #include <common/colortbl.h>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

2 years agofix out of source build error in gvpr
Costa Shulyupin [Thu, 10 Mar 2022 06:10:43 +0000 (08:10 +0200)]
fix out of source build error in gvpr

Explanation:

It needs $(top_builddir)/lib to include generated expr/y.tab.h in lib

Command:

(mkdir -p build && cd build && ../configure -q && make)

Error:

make[3]: Entering directory '/home/costa/oss/graphviz/build/lib/gvpr'
  CC       actions.lo
In file included from ../../../lib/expr/expr.h:28,
                 from ../../../lib/gvpr/actions.h:18,
                 from ../../../lib/gvpr/actions.c:16:
../../../lib/expr/exparse.h:4:10: fatal error: expr/y.tab.h: No such file or directory
    4 | #include <expr/y.tab.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.

2 years agofix indentation
Costa Shulyupin [Thu, 10 Mar 2022 05:59:10 +0000 (07:59 +0200)]
fix indentation

replace eight spaces with a tab

2 years agoMerge branch 'smattr/89ad4b85-34bb-4b7e-bf49-ee381244722a' into 'main'
Matthew Fernandez [Sat, 12 Mar 2022 20:07:32 +0000 (20:07 +0000)]
Merge branch 'smattr/89ad4b85-34bb-4b7e-bf49-ee381244722a' into 'main'

core plugin: some warning squashing and runtime performance improvements

See merge request graphviz/graphviz!2503

2 years agocore plugin svg_gradstyle: treat angle-based quantities as a double
Matthew Fernandez [Mon, 7 Mar 2022 04:50:30 +0000 (20:50 -0800)]
core plugin svg_gradstyle: treat angle-based quantities as a double

This removes an assumption that these calculated values fit in an int. Squashes
two -Wfloat-conversion warnings.

2 years agocore plugin svg_rgradstyle: treat 'angle' as a double instead of a float
Matthew Fernandez [Mon, 7 Mar 2022 04:44:58 +0000 (20:44 -0800)]
core plugin svg_rgradstyle: treat 'angle' as a double instead of a float

This is consistent with how `angle` is derived from `gradient_angle` elsewhere
in this plugin and it squashes a -Wconversion warning.

2 years agocore plugin map_output_shape: replace dynamic buffer with inline conversion
Matthew Fernandez [Mon, 7 Mar 2022 04:39:57 +0000 (20:39 -0800)]
core plugin map_output_shape: replace dynamic buffer with inline conversion

This function was using a long lived buffer to hold conversions of the input
array `AF`. However each entry was only used once or twice. It is faster to
avoid the heap buffer altogether and simply do the conversions on-demand when
they are needed.

This change is expected to be a slight performance improvement as well as
further progress towards thread safety in this code.

2 years agocore plugin: remove assumptions that pen width fits in an int
Matthew Fernandez [Mon, 7 Mar 2022 04:20:55 +0000 (20:20 -0800)]
core plugin: remove assumptions that pen width fits in an int

By dealing with this field consistently as a double, we retain the previous
intent while removing assumptions on the characteristics of `int`. Squashes 8
compiler warnings.

2 years agocore plugin write_xdot: squash a -Wswitch-default warning
Matthew Fernandez [Mon, 7 Mar 2022 03:53:25 +0000 (19:53 -0800)]
core plugin write_xdot: squash a -Wswitch-default warning

This switch is exhaustive.

2 years agoMerge branch 'smattr/FCCD7D3F-8164-4BFC-A411-5B8F9643E11E' into 'main'
Matthew Fernandez [Thu, 10 Mar 2022 02:51:55 +0000 (02:51 +0000)]
Merge branch 'smattr/FCCD7D3F-8164-4BFC-A411-5B8F9643E11E' into 'main'

squash more compiler warnings from GTK headers

See merge request graphviz/graphviz!2497

2 years agolib/glcomp: squash warnings from GTK headers
Matthew Fernandez [Sun, 6 Mar 2022 21:43:07 +0000 (13:43 -0800)]
lib/glcomp: squash warnings from GTK headers

Equivalent change to that in !2495.¹

¹ https://gitlab.com/graphviz/graphviz/-/merge_requests/2495

2 years agostandardize on '$(foo:a=b)' pattern substitution
Matthew Fernandez [Sun, 6 Mar 2022 21:40:39 +0000 (13:40 -0800)]
standardize on '$(foo:a=b)' pattern substitution

GNU Make supports both this syntax and `patsubst` for pattern substitution. The
former is more portable to other Make implementations, so use this in preference
to the latter.

2 years agoMerge branch 'gtk' into 'main'
Matthew Fernandez [Wed, 9 Mar 2022 17:22:34 +0000 (17:22 +0000)]
Merge branch 'gtk' into 'main'

squash warnings in gtk headers

See merge request graphviz/graphviz!2495

2 years agosquash warnings in gtk headers
Costa Shulyupin [Sun, 6 Mar 2022 19:07:01 +0000 (21:07 +0200)]
squash warnings in gtk headers

2 years agoMerge branch 'smattr/FF581D5F-7AFA-44C4-A22F-79C660FDB42A' into 'main'
Matthew Fernandez [Wed, 9 Mar 2022 15:33:02 +0000 (15:33 +0000)]
Merge branch 'smattr/FF581D5F-7AFA-44C4-A22F-79C660FDB42A' into 'main'

rephrase all sqrt(x*x+y*y) into hypot(x,y)

See merge request graphviz/graphviz!2499

2 years agoortho LENGTH: rephras an open coded 'hypot'
Matthew Fernandez [Sun, 6 Mar 2022 23:06:43 +0000 (15:06 -0800)]
ortho LENGTH: rephras an open coded 'hypot'

2 years agofdpgen dumpstat: rephrase an open coded 'hypot'
Matthew Fernandez [Sun, 6 Mar 2022 23:05:54 +0000 (15:05 -0800)]
fdpgen dumpstat: rephrase an open coded 'hypot'

2 years agocommit get_gradient_points: rephrase an open coded 'hypot'
Matthew Fernandez [Sun, 6 Mar 2022 23:04:32 +0000 (15:04 -0800)]
commit get_gradient_points: rephrase an open coded 'hypot'

2 years agocommon round_corners: rephrase some open coded 'hypot'
Matthew Fernandez [Sun, 6 Mar 2022 23:03:38 +0000 (15:03 -0800)]
common round_corners: rephrase some open coded 'hypot'

2 years agocommon l2dist: rephrase an open coded 'hypot'
Matthew Fernandez [Sun, 6 Mar 2022 23:01:49 +0000 (15:01 -0800)]
common l2dist: rephrase an open coded 'hypot'

2 years agoneatogen dist: rephrase an open coded 'hypot'
Matthew Fernandez [Sun, 6 Mar 2022 23:01:05 +0000 (15:01 -0800)]
neatogen dist: rephrase an open coded 'hypot'

2 years agoneatogen ideal_distance_avoid_overlap: rephrase an open coded 'hypot'
Matthew Fernandez [Sun, 6 Mar 2022 23:00:07 +0000 (15:00 -0800)]
neatogen ideal_distance_avoid_overlap: rephrase an open coded 'hypot'

2 years agopathplan dist: rephrase an open coded 'hypot'
Matthew Fernandez [Sun, 6 Mar 2022 22:59:15 +0000 (14:59 -0800)]
pathplan dist: rephrase an open coded 'hypot'

2 years agopathplan dist_n: rephrase an open coded 'hypot'
Matthew Fernandez [Sun, 6 Mar 2022 22:58:33 +0000 (14:58 -0800)]
pathplan dist_n: rephrase an open coded 'hypot'