]> granicus.if.org Git - graphviz/log
graphviz
23 months agoMerge branch 'smattr/gitlab-2338' into 'main'
Matthew Fernandez [Sun, 22 Jan 2023 00:16:51 +0000 (00:16 +0000)]
Merge branch 'smattr/gitlab-2338' into 'main'

sfio: make 'Sfio_t' definition entirely internal

Closes #2338

See merge request graphviz/graphviz!3060

23 months agosfio: make 'Sfio_t' definition entirely internal
Matthew Fernandez [Thu, 19 Jan 2023 16:24:02 +0000 (08:24 -0800)]
sfio: make 'Sfio_t' definition entirely internal

The definition of `Sfio_t` was structured to give it a public part and a private
part:

  struct _sfio_s {
    … public members …

    _SFIO_PRIVATE; // ← only visible if sfio_t.h is included
  };

This works only as long as no user ever allocates a `Sfio_t` themselves. If they
do, they will allocate too few bytes, based on their view of the size of
`Sfio_t` missing its private members.

A side effect of link-time optimization is that the compiler can see through
this trickery and witness both with-private and without-private definitions at
once. Creating objects of this type or pointers to objects of this type is a
violation of C’s strict aliasing rule and the compiler can now see this. This
can cause the compiler to make unsafe optimizations, like concluding any code
involving `Sfio_t*` variables must be unreachable.

The safer way to do a public/private class like this is with two structs, the
private one containing the public one as a member:

  struct foo_public {
    … public members …
  };

  struct foo_private {
    struct foo_public *public;

    … private members …
  };

Public API functions then accept `struct foo_public*` parameters and internally
convert them to `struct foo_private*` variables in order to access the
internals:

  int foo_do_something(struct foo_public *foo) {
    // use something like the Linux kernel’s container_of
    struct foo_private *f = container_of(foo, public);
    …
  }

But instead of this, we can observe that the definition of `Sfio_t` does not
need to have any public members at all, and we can make the entire type private.
We need an exception for libexpr which reaches into sfio internals.

Gitlab: fixes #2338

23 months agosfio: remove macro implementations of character functions
Matthew Fernandez [Thu, 19 Jan 2023 16:17:29 +0000 (08:17 -0800)]
sfio: remove macro implementations of character functions

These were implemented as an optimization to allow inlining. This is no longer
necessary on contemporary compilers with link-time optimization. Removing them
will unblock fixing some strict aliasing problems with the `Sfio_t` type.

Gitlab: #2338

23 months agosfio: fix missing SFIO components
Matthew Fernandez [Thu, 19 Jan 2023 16:13:22 +0000 (08:13 -0800)]
sfio: fix missing SFIO components

These are present in the Autotools build system as a separate library, libsfiof,
linked into libsfio. They are also present in the MS Build build system inlined
into libsfio itself. This change copies the MS Build approach.

This did not cause problems because these sources only exist as fallback
implementations for functions that are also implemented as macros. All current
usages see the macro definitions so never call these functions.

Fixing this will allow removing the macro versions in an upcoming change.

23 months agosfio: remove some open coded nulls
Matthew Fernandez [Thu, 19 Jan 2023 15:59:51 +0000 (07:59 -0800)]
sfio: remove some open coded nulls

23 months agoMerge branch 'smattr/9a877cda-3948-40d1-8ddf-64d09bc05660' into 'main'
Matthew Fernandez [Sat, 21 Jan 2023 22:34:15 +0000 (22:34 +0000)]
Merge branch 'smattr/9a877cda-3948-40d1-8ddf-64d09bc05660' into 'main'

smyrna, gvmap warning squashing

See merge request graphviz/graphviz!3061

23 months agogvmap plot_dot_polygons: use a 'size_t' for 'maxlen'
Matthew Fernandez [Fri, 20 Jan 2023 16:25:15 +0000 (08:25 -0800)]
gvmap plot_dot_polygons: use a 'size_t' for 'maxlen'

Squashes some -Wsign-conversion warnings.

23 months agogvmap make_map_internal: remove shadowing of 'nz' local
Matthew Fernandez [Fri, 20 Jan 2023 16:10:23 +0000 (08:10 -0800)]
gvmap make_map_internal: remove shadowing of 'nz' local

23 months agogvmap make_map_internal: operate directly on 'xcombined' instead of 'xtemp'
Matthew Fernandez [Fri, 20 Jan 2023 16:05:58 +0000 (08:05 -0800)]
gvmap make_map_internal: operate directly on 'xcombined' instead of 'xtemp'

Nothing appears to alias `xcombined` within this block. So we can save an
intermediate allocation and the cost of data movement by simply writing results
into their final destination.

23 months agogvmap get_polygon_solids: remove unused 'x_poly' parameter
Matthew Fernandez [Fri, 20 Jan 2023 15:59:32 +0000 (07:59 -0800)]
gvmap get_polygon_solids: remove unused 'x_poly' parameter

23 months agosmyrna on_txtAttr_changed: squash -Wunused-parameter warning
Matthew Fernandez [Fri, 20 Jan 2023 15:55:00 +0000 (07:55 -0800)]
smyrna on_txtAttr_changed: squash -Wunused-parameter warning

This function is used as a callback, so the parameter cannot easily be removed.

23 months agoMerge branch 'smattr/48b6e6c6-75e1-4359-a9d7-eed440bfcf03' into 'main'
Matthew Fernandez [Sat, 21 Jan 2023 21:42:38 +0000 (21:42 +0000)]
Merge branch 'smattr/48b6e6c6-75e1-4359-a9d7-eed440bfcf03' into 'main'

gvrender_core_pic.c: Distinguish between PIC and troff comments

Closes #2341

See merge request graphviz/graphviz!3063

23 months agoadd a changelog entry for the prior fix
Matthew Fernandez [Sat, 21 Jan 2023 19:30:41 +0000 (11:30 -0800)]
add a changelog entry for the prior fix

Gitlab: fixes #2341
Reported-by: Philip Kaludercic <philipk@posteo.net>
23 months agogvrender_core_pic.c: Distinguish between PIC and troff comments
Philip Kaludercic [Tue, 10 Jan 2023 23:31:13 +0000 (00:31 +0100)]
gvrender_core_pic.c: Distinguish between PIC and troff comments

23 months agoadd a test case for #2341
Matthew Fernandez [Sat, 21 Jan 2023 19:23:40 +0000 (11:23 -0800)]
add a test case for #2341

23 months agoMerge branch 'smattr/f05e3fc0-e087-4e7c-b988-577ed0336677' into 'main'
Matthew Fernandez [Sat, 21 Jan 2023 20:49:02 +0000 (20:49 +0000)]
Merge branch 'smattr/f05e3fc0-e087-4e7c-b988-577ed0336677' into 'main'

Start 7.1.1 development

See merge request graphviz/graphviz!3062

23 months agoStart 7.1.1 development
Matthew Fernandez [Sat, 21 Jan 2023 19:58:26 +0000 (11:58 -0800)]
Start 7.1.1 development

23 months agoMerge branch 'smattr/68782f21-a0fd-4857-b70a-1ce1504a5446' into 'main'
Matthew Fernandez [Sat, 21 Jan 2023 19:56:31 +0000 (19:56 +0000)]
Merge branch 'smattr/68782f21-a0fd-4857-b70a-1ce1504a5446' into 'main'

Stable release 7.1.0

See merge request graphviz/graphviz!3055

23 months agoStable Release 7.1.0
Matthew Fernandez [Sun, 15 Jan 2023 22:49:28 +0000 (14:49 -0800)]
Stable Release 7.1.0

23 months agobump minor version number for the addition of '--help', '--version'
Matthew Fernandez [Sun, 15 Jan 2023 22:47:50 +0000 (14:47 -0800)]
bump minor version number for the addition of '--help', '--version'

23 months agoMerge branch 're-enable-cygwin' into 'main'
Magnus Jacobsson [Sat, 21 Jan 2023 15:29:43 +0000 (15:29 +0000)]
Merge branch 're-enable-cygwin' into 'main'

Revert "CI: disable Cygwin jobs"

Closes #2329

See merge request graphviz/graphviz!3054

23 months agoRevert "CI: disable Cygwin jobs"
Magnus Jacobsson [Sun, 15 Jan 2023 11:37:14 +0000 (12:37 +0100)]
Revert "CI: disable Cygwin jobs"

This reverts commit 709acef44e13332a3c961bed3a2478c002f7b25f.

23 months agoMerge branch 'smattr/dc382b2a-6441-4f7b-a3a0-a66d40319ea8' into 'main'
Matthew Fernandez [Sat, 21 Jan 2023 05:39:14 +0000 (05:39 +0000)]
Merge branch 'smattr/dc382b2a-6441-4f7b-a3a0-a66d40319ea8' into 'main'

compiler warning squashing, fix a memory leak, remove some 'sprintf'

See merge request graphviz/graphviz!3056

23 months agocommon graph_init: fix memory leak
Matthew Fernandez [Sun, 15 Jan 2023 22:20:06 +0000 (14:20 -0800)]
common graph_init: fix memory leak

Gitlab: #1950

23 months agogvcolor nameOf: use an agxbuf instead of raw char buffer for names
Matthew Fernandez [Sun, 15 Jan 2023 22:13:19 +0000 (14:13 -0800)]
gvcolor nameOf: use an agxbuf instead of raw char buffer for names

This leads to slightly simpler code and fewer things to worry about.

Gitlab: #1950

23 months agogvcolor: remove assumption that color values fit in 64 characters
Matthew Fernandez [Sun, 15 Jan 2023 21:58:56 +0000 (13:58 -0800)]
gvcolor: remove assumption that color values fit in 64 characters

This code is still pretty challenging to follow, but at least we remove one
more thing the reader had to worry about.

Gitlab: #1950

23 months agogvcolor: remove unused 'Agnodeinfo_t' name
Matthew Fernandez [Sun, 15 Jan 2023 21:40:22 +0000 (13:40 -0800)]
gvcolor: remove unused 'Agnodeinfo_t' name

23 months agogvcolor: remove unused 'hsbcolor_t' name
Matthew Fernandez [Sun, 15 Jan 2023 21:39:40 +0000 (13:39 -0800)]
gvcolor: remove unused 'hsbcolor_t' name

23 months agogvcolor: squash -Wmissing-prototypes warning
Matthew Fernandez [Sun, 15 Jan 2023 21:38:55 +0000 (13:38 -0800)]
gvcolor: squash -Wmissing-prototypes warning

23 months agogvcolor colorxlate: remove unused return value
Matthew Fernandez [Sun, 15 Jan 2023 21:29:38 +0000 (13:29 -0800)]
gvcolor colorxlate: remove unused return value

23 months agogvcolor: remove 'NOCOLORNAMES' code path
Matthew Fernandez [Sun, 15 Jan 2023 21:28:12 +0000 (13:28 -0800)]
gvcolor: remove 'NOCOLORNAMES' code path

Nothing in the build systems define this. Furthermore, this code does not work.
It reads uninitialized memory from `buf`.

23 months agoMerge branch 'smattr/c0d7ef68-360e-47ba-96a8-fa27138de3b9' into 'main'
Matthew Fernandez [Sun, 15 Jan 2023 23:07:22 +0000 (23:07 +0000)]
Merge branch 'smattr/c0d7ef68-360e-47ba-96a8-fa27138de3b9' into 'main'

GD plugin gd_alternate_fontlist: fix unchecked allocation

See merge request graphviz/graphviz!3051

23 months agoGD plugin gd_alternate_fontlist: fix unchecked allocation
Matthew Fernandez [Sun, 15 Jan 2023 03:18:53 +0000 (19:18 -0800)]
GD plugin gd_alternate_fontlist: fix unchecked allocation

This function was calling `realloc` and not checking the return value. To fix
this, we rephrase it into using string views and then a final checked
allocation. This removes the long lived static allocation here, now requiring
the caller to free the returned value. This function is not on a hot path, so
removing this optimization is fine.

23 months agoMerge branch 'smattr/50a7856c-303a-4293-ad75-d1c983ace0f7' into 'main'
Matthew Fernandez [Sun, 15 Jan 2023 22:01:51 +0000 (22:01 +0000)]
Merge branch 'smattr/50a7856c-303a-4293-ad75-d1c983ace0f7' into 'main'

tclpkg buildBindings: fix incorrect allocation calculations and unchecked allocations

See merge request graphviz/graphviz!3052

23 months agotclpkg buildBindings: mark 's2' parameter as const
Matthew Fernandez [Sun, 15 Jan 2023 04:22:10 +0000 (20:22 -0800)]
tclpkg buildBindings: mark 's2' parameter as const

23 months agotclpkg buildBindings: fix remaining unchecked allocations
Matthew Fernandez [Sun, 15 Jan 2023 04:19:04 +0000 (20:19 -0800)]
tclpkg buildBindings: fix remaining unchecked allocations

23 months agotclpkg buildBindings: swap unchecked allocation for agxbuf
Matthew Fernandez [Sun, 15 Jan 2023 04:15:30 +0000 (20:15 -0800)]
tclpkg buildBindings: swap unchecked allocation for agxbuf

Apart from fixing an unchecked allocation, this is shorter with fewer things to
worry about.

23 months agotclpkg buildBindings: fix incorrect allocation calculations
Matthew Fernandez [Sun, 15 Jan 2023 04:11:12 +0000 (20:11 -0800)]
tclpkg buildBindings: fix incorrect allocation calculations

From context, these appear to be attempting to account for the trailing '\0'.
But they allocate one too many bytes.

23 months agoMerge branch 'smattr/e1a77fd6-85ed-4678-9fbe-bb6276c7e71b' into 'main'
Matthew Fernandez [Sun, 15 Jan 2023 18:41:39 +0000 (18:41 +0000)]
Merge branch 'smattr/e1a77fd6-85ed-4678-9fbe-bb6276c7e71b' into 'main'

sprintf migration and compiler waring squashing

See merge request graphviz/graphviz!3050

23 months agographml2gv main: remove shadowing of 'G'
Matthew Fernandez [Sun, 15 Jan 2023 00:09:41 +0000 (16:09 -0800)]
graphml2gv main: remove shadowing of 'G'

23 months agographml2gv initargs: squash -Wswitch-default warning
Matthew Fernandez [Sat, 14 Jan 2023 23:32:18 +0000 (15:32 -0800)]
graphml2gv initargs: squash -Wswitch-default warning

The default case is unreachable due to the preceding `getopt` call.

23 months agographml2gv graphml_to_gv: remove shadowing of 'gname'
Matthew Fernandez [Sun, 15 Jan 2023 00:07:13 +0000 (16:07 -0800)]
graphml2gv graphml_to_gv: remove shadowing of 'gname'

23 months agogv2gml initargs: squash -Wswitch-default warning
Matthew Fernandez [Sat, 14 Jan 2023 23:32:18 +0000 (15:32 -0800)]
gv2gml initargs: squash -Wswitch-default warning

The default case is unreachable due to the preceding `getopt` call.

23 months agodijkstra init: squash -Wswitch-default warning
Matthew Fernandez [Sat, 14 Jan 2023 23:32:18 +0000 (15:32 -0800)]
dijkstra init: squash -Wswitch-default warning

The default case is unreachable due to the preceding `getopt` call.

23 months agounflatten scanargs: squash -Wswitch-default warning
Matthew Fernandez [Sat, 14 Jan 2023 23:32:18 +0000 (15:32 -0800)]
unflatten scanargs: squash -Wswitch-default warning

The default case is unreachable due to the preceding `getopt` call.

23 months agotred init: squash -Wswitch-default warning
Matthew Fernandez [Sat, 14 Jan 2023 23:32:18 +0000 (15:32 -0800)]
tred init: squash -Wswitch-default warning

The default case is unreachable due to the preceding `getopt` call.

23 months agosccmap scanArgs: squash -Wswitch-default warning
Matthew Fernandez [Sat, 14 Jan 2023 23:32:18 +0000 (15:32 -0800)]
sccmap scanArgs: squash -Wswitch-default warning

The default case is unreachable due to the preceding `getopt` call.

23 months agoccomps process: replace 'sprintf' with 'agxbprint'
Matthew Fernandez [Sat, 14 Jan 2023 23:52:55 +0000 (15:52 -0800)]
ccomps process: replace 'sprintf' with 'agxbprint'

This replaces some error prone manual calculation with a dynamic buffer that
handles the calculation of needed allocations. This also potentially saves
memory in cases of short strings where an agxbuf can use inline storage.

Gitlab: #1950

23 months agoccomps processClusters: replace 'sprintf' with 'agxbprint'
Matthew Fernandez [Sat, 14 Jan 2023 23:52:55 +0000 (15:52 -0800)]
ccomps processClusters: replace 'sprintf' with 'agxbprint'

This replaces some error prone manual calculation with a dynamic buffer that
handles the calculation of needed allocations. This also potentially saves
memory in cases of short strings where an agxbuf can use inline storage.

Gitlab: #1950

23 months agoccomps getName: remove long lived allocation
Matthew Fernandez [Sat, 14 Jan 2023 23:38:40 +0000 (15:38 -0800)]
ccomps getName: remove long lived allocation

This code is not on a hot path, so we can afford to use clearer scoping and
ownership semantics.

Gitlab: #1950

23 months agoccomps gwrite: fix crash when failing to open files
Matthew Fernandez [Sat, 14 Jan 2023 23:42:55 +0000 (15:42 -0800)]
ccomps gwrite: fix crash when failing to open files

This code looks as if it and the similar code in bcomps.c were copy-pasted from
the same common source. Except the bcomps.c version remembered to exit when
failing to open the output file, whereas the ccomps.c code would go on to crash
when using the null `outf`.

23 months agobcomps getName: remove long lived allocation
Matthew Fernandez [Sat, 14 Jan 2023 23:38:40 +0000 (15:38 -0800)]
bcomps getName: remove long lived allocation

This code is not on a hot path, so we can afford to use clearer scoping and
ownership semantics.

Gitlab: #1950

23 months agobcomps init: squash -Wswitch-default warning
Matthew Fernandez [Sat, 14 Jan 2023 23:32:18 +0000 (15:32 -0800)]
bcomps init: squash -Wswitch-default warning

The default case is unreachable due to the preceding `getopt` call.

23 months agobcomps split: use a more appropriate type for 'size'
Matthew Fernandez [Sat, 14 Jan 2023 23:30:32 +0000 (15:30 -0800)]
bcomps split: use a more appropriate type for 'size'

Squashes 2 -Wconversion warnings.

23 months agobcomps blockName: remove long lived allocation
Matthew Fernandez [Sat, 14 Jan 2023 23:27:43 +0000 (15:27 -0800)]
bcomps blockName: remove long lived allocation

It looks like a mistake in the initial revision of Graphviz that this function
never wrote to `bufsz`. The effect of this was that this function would
reallocate on every single call. So empirically it seems there was no need to
avoid allocating new memory on each call, which is what this commit does.

Gitlab: #1950

23 months agosmyrna smyrnaPath: replace 'sprintf' calls with 'snprintf'
Matthew Fernandez [Sat, 14 Jan 2023 23:20:22 +0000 (15:20 -0800)]
smyrna smyrnaPath: replace 'sprintf' calls with 'snprintf'

Gitlab: #1950

23 months agoMerge branch 'smattr/1b897ee0-27b1-49d6-9891-9f9a72c96a15' into 'main'
Matthew Fernandez [Sun, 15 Jan 2023 17:49:00 +0000 (17:49 +0000)]
Merge branch 'smattr/1b897ee0-27b1-49d6-9891-9f9a72c96a15' into 'main'

smyrna, glcomp, tclpkg compiler warning squashing

See merge request graphviz/graphviz!3048

23 months agoglcomp: remove 'type' that is always set to 'pangotext'
Matthew Fernandez [Sat, 14 Jan 2023 05:39:59 +0000 (21:39 -0800)]
glcomp: remove 'type' that is always set to 'pangotext'

23 months agoglcomp: remove 'borderType' that is always set to 'glBorderSolid'
Matthew Fernandez [Sat, 14 Jan 2023 05:31:47 +0000 (21:31 -0800)]
glcomp: remove 'borderType' that is always set to 'glBorderSolid'

23 months agosmyrna DrawEllipse: use doubles for local temporaries
Matthew Fernandez [Sat, 14 Jan 2023 05:26:25 +0000 (21:26 -0800)]
smyrna DrawEllipse: use doubles for local temporaries

Values being stored into these were doubles and later use of these promoted them
to double. So it is not clear why they were not double to begin with. Squashes 2
-Wfloat-conversion warnings.

23 months agosmyrna drawCircle: abbreviate a float literal
Matthew Fernandez [Sat, 14 Jan 2023 05:22:26 +0000 (21:22 -0800)]
smyrna drawCircle: abbreviate a float literal

23 months agosmyrna: abbreviate some accumulations
Matthew Fernandez [Sat, 14 Jan 2023 05:22:16 +0000 (21:22 -0800)]
smyrna: abbreviate some accumulations

23 months agosmyrna: use a double for 'global_z'
Matthew Fernandez [Sat, 14 Jan 2023 05:21:09 +0000 (21:21 -0800)]
smyrna: use a double for 'global_z'

Most of the calculations with this and uses of it are with doubles. So making it
a double as well avoids losing intermediate precision. Squashes 5
-Wfloat-conversion warnings.

23 months agosmyrna: remove some unhelpful comments
Matthew Fernandez [Sat, 14 Jan 2023 04:58:18 +0000 (20:58 -0800)]
smyrna: remove some unhelpful comments

23 months agosmyrna glcreate_gl_topview_menu: squash -Wfloat-conversion warning
Matthew Fernandez [Sat, 14 Jan 2023 04:57:00 +0000 (20:57 -0800)]
smyrna glcreate_gl_topview_menu: squash -Wfloat-conversion warning

23 months agotclpkg insert_poly: remove shadowing of 'polyid'
Matthew Fernandez [Sat, 14 Jan 2023 04:41:25 +0000 (20:41 -0800)]
tclpkg insert_poly: remove shadowing of 'polyid'

23 months agotclpkg remove_poly: remove shadowing of 'polyid'
Matthew Fernandez [Sat, 14 Jan 2023 04:40:49 +0000 (20:40 -0800)]
tclpkg remove_poly: remove shadowing of 'polyid'

23 months agotclpkg Plegal_arrangement: remove shadowing of 'i'
Matthew Fernandez [Sat, 14 Jan 2023 04:39:11 +0000 (20:39 -0800)]
tclpkg Plegal_arrangement: remove shadowing of 'i'

23 months agoMerge branch 'smattr/gitlab-2340' into 'main'
Matthew Fernandez [Sun, 15 Jan 2023 16:58:53 +0000 (16:58 +0000)]
Merge branch 'smattr/gitlab-2340' into 'main'

Autotools: fix non-portable syntax in configure.ac

Closes #2340

See merge request graphviz/graphviz!3049

23 months agoMerge branch 'smattr/gitlab-1950' into 'main'
Matthew Fernandez [Sat, 14 Jan 2023 18:45:15 +0000 (18:45 +0000)]
Merge branch 'smattr/gitlab-1950' into 'main'

migrate some 'sprintf' to agxbufs

See merge request graphviz/graphviz!3036

23 months agopack: remove some unhelpful comments
Matthew Fernandez [Mon, 2 Jan 2023 03:17:01 +0000 (19:17 -0800)]
pack: remove some unhelpful comments

23 months agopack: use an agxbuf to simplify some code
Matthew Fernandez [Mon, 2 Jan 2023 02:47:13 +0000 (18:47 -0800)]
pack: use an agxbuf to simplify some code

Gitlab: #1950

23 months agocore plugin mp_bezier: use an agxbuf to simplify some code
Matthew Fernandez [Mon, 2 Jan 2023 02:47:13 +0000 (18:47 -0800)]
core plugin mp_bezier: use an agxbuf to simplify some code

Gitlab: #1950

23 months agocore plugin fig_bezier: use an agxbuf to simplify some code
Matthew Fernandez [Mon, 2 Jan 2023 02:47:13 +0000 (18:47 -0800)]
core plugin fig_bezier: use an agxbuf to simplify some code

Gitlab: #1950

23 months agosfdpgen spring_electrical_spring_embedding: use an agxbuf instead of 'sprintf'
Matthew Fernandez [Mon, 2 Jan 2023 02:39:27 +0000 (18:39 -0800)]
sfdpgen spring_electrical_spring_embedding: use an agxbuf instead of 'sprintf'

This leads to less manual memory management and fewer problems to think about.

Gitlab: #1950

23 months agosfdpgen spring_maxent_embedding: use an agxbuf instead of 'sprintf'
Matthew Fernandez [Mon, 2 Jan 2023 02:39:27 +0000 (18:39 -0800)]
sfdpgen spring_maxent_embedding: use an agxbuf instead of 'sprintf'

This leads to less manual memory management and fewer problems to think about.

Gitlab: #1950

23 months agosfdpgen spring_electrical_embedding: use an agxbuf instead of 'sprintf'
Matthew Fernandez [Mon, 2 Jan 2023 02:39:27 +0000 (18:39 -0800)]
sfdpgen spring_electrical_embedding: use an agxbuf instead of 'sprintf'

This leads to less manual memory management and fewer problems to think about.

Gitlab: #1950

23 months agosfdpgen spring_electrical_embedding_slow: use an agxbuf instead of 'sprintf'
Matthew Fernandez [Mon, 2 Jan 2023 02:39:27 +0000 (18:39 -0800)]
sfdpgen spring_electrical_embedding_slow: use an agxbuf instead of 'sprintf'

This leads to less manual memory management and fewer problems to think about.

Gitlab: #1950

23 months agoMerge branch 'smattr/19e55e10-d4ef-4070-aefe-5dfc4817aa48' into 'main'
Matthew Fernandez [Sat, 14 Jan 2023 17:54:55 +0000 (17:54 +0000)]
Merge branch 'smattr/19e55e10-d4ef-4070-aefe-5dfc4817aa48' into 'main'

squash compiler warnings in release mode

See merge request graphviz/graphviz!3047

23 months agoadd a CHANGELOG entry for the prior change
Matthew Fernandez [Sat, 14 Jan 2023 17:18:47 +0000 (09:18 -0800)]
add a CHANGELOG entry for the prior change

Gitlab: fixes #2340

23 months agogvmap plot_dot_polygons: squash -Wunused-variable warning in release mode
Matthew Fernandez [Tue, 10 Jan 2023 16:09:33 +0000 (08:09 -0800)]
gvmap plot_dot_polygons: squash -Wunused-variable warning in release mode

23 months agocore plugin core_loadimage_vrml: squash warning in release mode
Matthew Fernandez [Tue, 10 Jan 2023 16:04:47 +0000 (08:04 -0800)]
core plugin core_loadimage_vrml: squash warning in release mode

This triggered -Wunused-variable warnings.

23 months agosparse SparseMatrix_distance_matrix: squash warning in release mode
Matthew Fernandez [Tue, 10 Jan 2023 16:02:31 +0000 (08:02 -0800)]
sparse SparseMatrix_distance_matrix: squash warning in release mode

This code triggered a -Wunused-variable warning.

23 months agosparse get_mq: squash -Wunused-variable warning in release mode
Matthew Fernandez [Tue, 10 Jan 2023 16:01:53 +0000 (08:01 -0800)]
sparse get_mq: squash -Wunused-variable warning in release mode

23 months agosparse BinaryHeap_sanity_check: squash warnings in release mode
Matthew Fernandez [Tue, 10 Jan 2023 16:00:59 +0000 (08:00 -0800)]
sparse BinaryHeap_sanity_check: squash warnings in release mode

This code triggered -Wunused-variable warnings.

23 months agosparse BinaryHeap_insert: squash -Wunused-variable warning in release mode
Matthew Fernandez [Tue, 10 Jan 2023 16:00:40 +0000 (08:00 -0800)]
sparse BinaryHeap_insert: squash -Wunused-variable warning in release mode

23 months agomindle agglomerative_ink_bundling_internal: squash warning in release mode
Matthew Fernandez [Tue, 10 Jan 2023 15:58:24 +0000 (07:58 -0800)]
mindle agglomerative_ink_bundling_internal: squash warning in release mode

When building in release mode, this causes a -Wunused-variable warning.

23 months agocgraph: remove advice about '[[maybe_unused]]'
Matthew Fernandez [Tue, 10 Jan 2023 15:57:43 +0000 (07:57 -0800)]
cgraph: remove advice about '[[maybe_unused]]'

This attribute was only introduced in C++17 and we currently build with C++11.

23 months agodotgen dot_position: squash -Wunused-variable warning in release mode
Matthew Fernandez [Tue, 10 Jan 2023 15:55:16 +0000 (07:55 -0800)]
dotgen dot_position: squash -Wunused-variable warning in release mode

23 months agodotgen find_fast_node: squash -Wunused-function warning in release mode
Matthew Fernandez [Tue, 10 Jan 2023 15:54:21 +0000 (07:54 -0800)]
dotgen find_fast_node: squash -Wunused-function warning in release mode

23 months agolabel xlhdxunload: squash -Wunused-variable warning in release mode
Matthew Fernandez [Tue, 10 Jan 2023 15:51:59 +0000 (07:51 -0800)]
label xlhdxunload: squash -Wunused-variable warning in release mode

23 months agoMerge branch 'libtgs_cmake' into 'main'
Matthew Fernandez [Sat, 14 Jan 2023 17:03:49 +0000 (17:03 +0000)]
Merge branch 'libtgs_cmake' into 'main'

CMake: Add support for GNU Triangulated Surface Library

See merge request graphviz/graphviz!3046

23 months agoAutotools: fix non-portable syntax in configure.ac
Michael Bäuerle [Thu, 12 Jan 2023 11:25:00 +0000 (03:25 -0800)]
Autotools: fix non-portable syntax in configure.ac

23 months agoCMake: Add support for GNU Triangulated Surface Library
Nehal J Wani [Tue, 16 Feb 2021 23:38:18 +0000 (18:38 -0500)]
CMake: Add support for GNU Triangulated Surface Library

23 months agoMerge branch 'smattr/eb51b011-0635-4094-b688-4749080dba5c' into 'main'
Matthew Fernandez [Mon, 9 Jan 2023 15:43:47 +0000 (15:43 +0000)]
Merge branch 'smattr/eb51b011-0635-4094-b688-4749080dba5c' into 'main'

CMake: enable LTO in release mode

See merge request graphviz/graphviz!3045

23 months agoMerge branch 'smattr/gitlab-1999' into 'main'
Matthew Fernandez [Sun, 8 Jan 2023 21:41:05 +0000 (21:41 +0000)]
Merge branch 'smattr/gitlab-1999' into 'main'

twopi: fix crash with > 65535 nodes

Closes #1999

See merge request graphviz/graphviz!3017

23 months agoCMake: enable LTO in release mode
Matthew Fernandez [Sun, 8 Jan 2023 20:16:41 +0000 (12:16 -0800)]
CMake: enable LTO in release mode

Link-Time Optimization (LTO) is a mechanism that enables the compiler to
optimize across translation unit boundaries. In particular, it enables
cross-file function inlining. This is present and mature in the majority of
contemporary compilers and switching it on has few downsides.

Some performance numbers:

  ┌───────┬──────────────────┬──────────────────┬──────┐
  │       │ before           │ after            │ diff │
  ╞═══════╪══════════════════╪══════════════════╪══════╡
  │ 1652¹ │ 17.88s           │ 17.85s           │  -0% │
  │       │ 50.4MB peak RSS  │ 50.5MB peak RSS  │  +0% │
  ├───────┼──────────────────┼──────────────────┼──────┤
  │ 1718² │ 2m21s            │ 2m13s            │  -6% │
  │       │ 15.8MB peak RSS  │ 15.9 MB peak RSS │  +1% │
  ├───────┼──────────────────┼──────────────────┼──────┤
  │ 1864³ │ 13.26s           │ 13.07s           │  -1% │
  │       │ 462.0MB peak RSS │ 461.8MB peak RSS │  -0% │
  ├───────┼──────────────────┼──────────────────┼──────┤
  │ 2064⁴ │ 11m42s           │ 11m30s           │  -2% │
  │       │ 1.26GB peak RSS  │ 1.26GB peak RSS  │  -0% │
  ├───────┼──────────────────┼──────────────────┼──────┤
  │ 2095⁵ │ 2m18s            │ 2m19s            │  +1% │
  │       │ 92.3MB peak RSS  │ 92.1MB peak RSS  │  -0% │
  └───────┴──────────────────┴──────────────────┴──────┘

¹ The test case from https://gitlab.com/graphviz/graphviz/-/issues/1652 run as
  `neato -Tsvg -o /dev/null 1652.dot`.
² swedish-flat.dot Magnus attached to
  https://gitlab.com/graphviz/graphviz/-/issues/1718 run as
  `circo -Tsvg -o /dev/null swedish-flag.dot`.
³ The test case from https://gitlab.com/graphviz/graphviz/-/issues/1864 run as
  `twopi -Tsvg -o /dev/null 1864.dot`.
⁴ The test case from https://gitlab.com/graphviz/graphviz/-/issues/2064 run as
  `dot -Gnslimit=2 -Gnslimit1=2 -Gmaxiter=5000 -Tsvg -o /dev/null 2064.dot`.
⁵ The tests/2095.dot test case from prior to minimization
  (3819821ea70fae730dd224936628ed3929b03531). Run as
  `dot -Tsvg -o /dev/null 2095.dot`.

23 months agopathplan: replace unchecked allocation calls with cgraph wrappers
Matthew Fernandez [Mon, 26 Dec 2022 05:41:23 +0000 (21:41 -0800)]
pathplan: replace unchecked allocation calls with cgraph wrappers

After the prior UB fixes, the #1999 example bottoms out in this code, failing
the second allocation call while trying to allocate ~938GB. The return values
for neither of these calls were checked, resulting in messy crashes when
scenarios like this occurred. This change swaps them for calls to the cgraph
allocation wrappers that exit gracefully on out-of-memory conditions.

Gitlab: #1999

23 months agopathplan: fix integer overflow with > 46341 nodes
Matthew Fernandez [Sun, 25 Dec 2022 20:39:16 +0000 (12:39 -0800)]
pathplan: fix integer overflow with > 46341 nodes

After this change, a ASan+UBSan build of Graphviz can process the #1999 example
without crashing. Graphs with >46341 (⌈√INT_MAX⌉) nodes no longer cause an
integer overflow.

Gitlab: fixes #1999
Reported-by: Lockywolf
23 months agotwopi: fix crash with > 46341 nodes
Matthew Fernandez [Sun, 25 Dec 2022 20:25:49 +0000 (12:25 -0800)]
twopi: fix crash with > 46341 nodes

UBSan revealed the graph attached to #1999 was triggering an integer overflow in
this multiplication, later on causing a crash in `twopi`. Any number of nodes
≥⌈√INT_MAX⌉ exceeds INT_MAX during multiplication. This fix still does not
enable the graph to be processed in a reasonable amount of time, and it still
crashes later after several hours due to another integer overflow.

Gitlab: #1999