]> granicus.if.org Git - graphviz/log
graphviz
2 years agoneatogen mkCtrlPts: use cgraph wrapper for allocation
Matthew Fernandez [Fri, 18 Nov 2022 01:14:41 +0000 (17:14 -0800)]
neatogen mkCtrlPts: use cgraph wrapper for allocation

The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.

2 years agoneatogen addTri: use cgraph wrapper for allocation
Matthew Fernandez [Fri, 18 Nov 2022 01:14:41 +0000 (17:14 -0800)]
neatogen addTri: use cgraph wrapper for allocation

The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.

2 years agoneatogen newIpair: use cgraph wrapper for allocation
Matthew Fernandez [Fri, 18 Nov 2022 01:14:02 +0000 (17:14 -0800)]
neatogen newIpair: use cgraph wrapper for allocation

The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.

2 years agoneatogen newItem: use cgraph wrapper for allocation
Matthew Fernandez [Fri, 18 Nov 2022 01:12:52 +0000 (17:12 -0800)]
neatogen newItem: use cgraph wrapper for allocation

The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.

2 years agoMerge branch 'smattr/gitlab-1838' into 'main'
Matthew Fernandez [Sat, 19 Nov 2022 03:57:43 +0000 (03:57 +0000)]
Merge branch 'smattr/gitlab-1838' into 'main'

CMake: fix: teach 'gvpack' how to find plugins at run time

Closes #1838

See merge request graphviz/graphviz!2947

2 years agoCMake: fix: teach 'gvpack' how to find plugins at run time
Matthew Fernandez [Sat, 12 Nov 2022 18:50:53 +0000 (10:50 -0800)]
CMake: fix: teach 'gvpack' how to find plugins at run time

Because `gvpack` links against the plugins as libraries rather than loading them
on demand, the dynamic linker needs to be able to locate the plugin libraries at
run time.

CC: Jaroslav Škarvada <jskarvad@redhat.com>
Gitlab: fixes #1838
Red Hat: fixes https://bugzilla.redhat.com/show_bug.cgi?id=1838679

2 years agoCMake: fix: stop disabling demand loading in tools
Matthew Fernandez [Fri, 11 Nov 2022 16:04:47 +0000 (08:04 -0800)]
CMake: fix: stop disabling demand loading in tools

The Autotools build system only disables demand loading in `gvpack` among the
tools, but the CMake build system was disabling it for all tools.

2 years agoMerge branch 'smattr/5af11577-90f4-461d-b097-b4931494e660' into 'main'
Matthew Fernandez [Sat, 19 Nov 2022 02:52:25 +0000 (02:52 +0000)]
Merge branch 'smattr/5af11577-90f4-461d-b097-b4931494e660' into 'main'

Start 7.0.3 development

See merge request graphviz/graphviz!2961

2 years agoStart 7.0.3 development
Matthew Fernandez [Sat, 19 Nov 2022 01:12:09 +0000 (17:12 -0800)]
Start 7.0.3 development

2 years agoMerge branch 'smattr/1361001b-6b80-47e2-b616-d78399cbb2ec' into 'main' 7.0.2
Matthew Fernandez [Sat, 19 Nov 2022 01:10:29 +0000 (01:10 +0000)]
Merge branch 'smattr/1361001b-6b80-47e2-b616-d78399cbb2ec' into 'main'

Stable Release 7.0.2

See merge request graphviz/graphviz!2959

2 years agoStable Release 7.0.2
Matthew Fernandez [Fri, 18 Nov 2022 01:03:45 +0000 (17:03 -0800)]
Stable Release 7.0.2

2 years agoMerge branch 'smattr/gitlab-265' into 'main'
Matthew Fernandez [Fri, 18 Nov 2022 01:01:39 +0000 (01:01 +0000)]
Merge branch 'smattr/gitlab-265' into 'main'

core plugin: stop emitting an empty 'alt' tag in cmap output

Closes #265

See merge request graphviz/graphviz!2958

2 years agocore plugin: stop emitting an empty 'alt' tag in cmap output
Matthew Fernandez [Thu, 17 Nov 2022 15:56:29 +0000 (07:56 -0800)]
core plugin: stop emitting an empty 'alt' tag in cmap output

This was working around a behavior on an old version of Microsoft Internet
Explorer that is no longer supported. Tooltips should show consistently on
modern browsers and the `alt` tag is once again available to be set dynamically
by Javascript or inherited.

Gitlab: closes #265
Reporte-by: ib
2 years agoMerge branch 'smattr/e1d8b50e-417f-46d2-9ae7-19dc5bceddf9' into 'main'
Matthew Fernandez [Thu, 17 Nov 2022 05:57:09 +0000 (05:57 +0000)]
Merge branch 'smattr/e1d8b50e-417f-46d2-9ae7-19dc5bceddf9' into 'main'

add 'gvedit' to the CMake build system

Closes #1836 and #1753

See merge request graphviz/graphviz!2953

2 years agoadd 'gvedit' to the CMake build system
Matthew Fernandez [Mon, 14 Nov 2022 03:37:35 +0000 (19:37 -0800)]
add 'gvedit' to the CMake build system

Note that we need to disable building GVEdit on Windows in CI because we do not
currently have Qt installed there.¹

Gitlab: closes #1753, closes #1836

¹ See https://gitlab.com/graphviz/graphviz/-/merge_requests/1569 for further
  discussion.

2 years agoCI: add Qt generated sources to files excluded from coverage analysis
Matthew Fernandez [Wed, 16 Nov 2022 04:20:34 +0000 (20:20 -0800)]
CI: add Qt generated sources to files excluded from coverage analysis

These will be generated by an upcoming commit adding GVEdit to the CMake build
system. The cryptic EWIEGA46WW directory in this path is a checksum generated by
`AUTOMOC`. But it is based on relative path and appears to be stable as long as
we do not rename any cmd/gvedit subdirectories.

Gitlab: #1836

2 years agoCI: modernize coverage script to use 'pathlib'
Matthew Fernandez [Wed, 16 Nov 2022 04:09:40 +0000 (20:09 -0800)]
CI: modernize coverage script to use 'pathlib'

2 years agoCI: abbreviate passing options to CMake in the windows build
Matthew Fernandez [Mon, 14 Nov 2022 05:05:08 +0000 (21:05 -0800)]
CI: abbreviate passing options to CMake in the windows build

2 years agogvedit: modernize 'QLabel::pixmap' calls
Matthew Fernandez [Mon, 14 Nov 2022 03:52:37 +0000 (19:52 -0800)]
gvedit: modernize 'QLabel::pixmap' calls

Qt 5.15 deprecated the version of this function that returns a pointer and
throws compiler warnings when calls to it are seen. This modernization is
necessary to avoid the upcoming integration of Gvedit into the CMake build
system failing in CI where `-Werror` is applied.

Unfortunately we need to do this conditionally while retaining the old code for,
e.g., CentOS 7 which has a version of Qt 5.15 that does not have the new API.

Gitlab: #1836

2 years agogvedit: locate attrs.txt based on the location of our own executable
Matthew Fernandez [Mon, 14 Nov 2022 03:18:11 +0000 (19:18 -0800)]
gvedit: locate attrs.txt based on the location of our own executable

This commit adapts 24bd92c1e5d49b354141cd06d88ca658991b9825 that taught Smyrna
how to find the share directory without a build time define to Gvedit. The
pattern is essentially the same, but we can take advantage of some nicer C++
mechanisms instead of C.

The motivation for this is to make integration of Gvedit into the CMake build
system easier. By doing location of the share directory in the code instead of
the build system, we can more easily ensure the same behavior between build
systems. A side effect of this is the `gvedit` binary becoming more relocatable.

Note that the Windows discovery mechanism differs from what it was before, but
it is now more in line with how discovery works on other platforms.

Gitlab: #1836

2 years agoMerge branch 'smattr/gitlab-42' into 'main'
Matthew Fernandez [Thu, 17 Nov 2022 04:52:41 +0000 (04:52 +0000)]
Merge branch 'smattr/gitlab-42' into 'main'

fix neato crash in trigraph code

Closes #42

See merge request graphviz/graphviz!2955

2 years agoneatogen: fix miscalculation of intermediate edge resources
Matthew Fernandez [Tue, 15 Nov 2022 04:36:15 +0000 (20:36 -0800)]
neatogen: fix miscalculation of intermediate edge resources

`genroute` was allocating an array for edge computation upfront. But what it was
not accounting for was that some of the functions it later calls _change_ the
`pn` value it used to determine how many array elements it should allocate.
Specifically, `Pshortestpath` can add new points to the polygon, thereby causing
the walk of the (now too short) array to write out of bounds.

Gitlab: fixes #42
Reported-by: mattjj
2 years agoneatogen: fix out of bounds write when exceeding estimated edges
Matthew Fernandez [Tue, 15 Nov 2022 04:16:48 +0000 (20:16 -0800)]
neatogen: fix out of bounds write when exceeding estimated edges

The `edgei` allocation in `mkTriGraph` was wrong. This code was written prior to
Git history, and it is not obvious how the calculation for how many edges to
allocate was arrived at. My educated guess is that the `+ 2` was intended to
account for the maximum number of final appended edges (the maximum trip count
of the trailing loop in this function), except that is 3 not 2. Bumping this to
3 indeed bypasses the ASan failure in #42.

Rather than just make that equally error prone adjustment, this commit stops
estimating the edge count upfront at all and instead allocates edges per-node
on-demand.

The prior code was allocating edges for all nodes as a contiguous array. Each
node would then be given an offset pointer into this array. Apart from the
problem described above, this meant all nodes apart from the last one could
overflow their edge count, silently corrupting their neighbor’s edges, in a way
undetectable by ASan. This refactoring gives each node distinct memory for its
edges. But this means we needed to introduce a node count (`nnodes`) to the
trigraph and free each of these separate allocations when destructing the
trigraph.

This also required passing in original edge counts to `resetGraph`. Previously
the code would detect an edge that needed to be removed by a node’s edges
running up against its neighbor’s. Obviously this was subject to the above
described bugs which could cause false negatives in this test, leading to even
further compounding data corruption.

Fixing this unfortunately only yields yet another ASan crash (below). This will
be addressed in an upcoming commit.

  WRITE of size 16 at 0x613000001860 thread T0
      #0 0x7f5b44579e80 in genroute lib/neatogen/multispline.c:869
      #1 0x7f5b4457f53d in makeMultiSpline lib/neatogen/multispline.c:1311
      #2 0x7f5b4452ac4d in _spline_edges lib/neatogen/neatosplines.c:632
      #3 0x7f5b4452b4c8 in splineEdges lib/neatogen/neatosplines.c:729
      #4 0x7f5b4452b5a6 in spline_edges1 lib/neatogen/neatosplines.c:742
      #5 0x7f5b4452b658 in spline_edges0 lib/neatogen/neatosplines.c:771
      #6 0x7f5b4451154d in init_nop lib/neatogen/neatoinit.c:597
      #7 0x7f5b44516ac9 in neato_layout lib/neatogen/neatoinit.c:1407
      #8 0x7f5b488a847f  (/tmp/tmp.jiRlFO5wtW/lib+0x8647f)
      #9 0x55ddbc8126dc in main graphviz/cmd/dot/dot.c:89
      #10 0x7f5b485e2d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
      #11 0x7f5b485e2e3f in __libc_start_main_impl ../csu/libc-start.c:392
      #12 0x55ddbc812344 in _start (bin/dot+0x1344)

It should be clear from the above that the code here has a very error prone
structure. (1) Estimating how much memory is required upfront with non-trivial
calculations and (2) allocating a block of memory that is then partitioned out
to clients trusted not to run into each other, effectively creates a scenario
where bugs are undetectable by memory safety tools and easily compound one
another. In future the other allocations in this file should be rewritten to
avoid this structure too.

Gitlab: #42

2 years agoadd a test case for #42
Matthew Fernandez [Tue, 15 Nov 2022 03:32:37 +0000 (19:32 -0800)]
add a test case for #42

2 years agoMerge branch 'smattr/005583fa-dfb4-44c4-82b8-bc8e3b96a8ee' into 'main'
Matthew Fernandez [Thu, 17 Nov 2022 03:58:04 +0000 (03:58 +0000)]
Merge branch 'smattr/005583fa-dfb4-44c4-82b8-bc8e3b96a8ee' into 'main'

smyrna: fix macOS compilation errors

See merge request graphviz/graphviz!2951

2 years agosmyrna: fix 'readlink' compilation error on macOS
Matthew Fernandez [Sun, 13 Nov 2022 23:12:57 +0000 (15:12 -0800)]
smyrna: fix 'readlink' compilation error on macOS

The code added in 24bd92c1e5d49b354141cd06d88ca658991b9825 calls `readlink` in
multiple paths, including the macOS branch. This function needs the #include
<unistd.h> but we were only conditionally including it when not on Windows or
macOS, when we _do_ need it on macOS. Similar to the previous commit, it seems
this went unnoticed because the macOS CI jobs do not build Smyrna.

2 years agosmyrna: fix 'path' compilation error on macOS
Matthew Fernandez [Sun, 13 Nov 2022 23:05:49 +0000 (15:05 -0800)]
smyrna: fix 'path' compilation error on macOS

24bd92c1e5d49b354141cd06d88ca658991b9825 managed to commit code to Smyrna on
which the macOS branch of the logic does not compile. It seems this went
unnoticed because the macOS CI jobs do not build Smyrna.

2 years agouse input gradient angle rather than computed gradient angle when checking for 0
Matthew Fernandez [Sun, 13 Nov 2022 22:22:03 +0000 (14:22 -0800)]
use input gradient angle rather than computed gradient angle when checking for 0

When using radial gradients, a value of 0 is interpreted differently to other
values:¹

  a value of zero causes the colors to transform radially from the center; for
  non-zero values, the colors transform from a point near the object’s periphery
  as specified by the value.

The code affected in this commit is looking for this situation, but was
unnecessarily using the computed gradient angle. If the original is zero, the
computed angle will also be zero. So we can simplify this code for both human
readers and the compiler by using the original (integer) angle.

This squashes the warnings:

  gvrender_core_dot.c: In function ‘xdot_gradient_fillcolor’:
  gvrender_core_dot.c:644:19: warning: comparing floating-point with ‘==’ or
    ‘!=’ is unsafe [-Wfloat-equal]
    644 |         if (angle == 0) {
        |                   ^~
  gvrender_core_svg.c: In function ‘svg_rgradstyle’:
  gvrender_core_svg.c:602:15: warning: comparing floating-point with ‘==’ or
    ‘!=’ is unsafe [-Wfloat-equal]
    602 |     if (angle == 0.) {
        |               ^~
  gvrender_pango.c:322:19: warning: comparing floating-point with ‘==’ or ‘!=’
    is unsafe [-Wfloat-equal]
    322 |         if (angle == 0) {
        |                   ^~

Gitlab: related to #2313

¹ https://graphviz.org/docs/attrs/gradientangle/

2 years agoMerge branch 'smattr/681394c3-c5d5-4f79-ba6f-7039662791a1' into 'main'
Matthew Fernandez [Thu, 17 Nov 2022 02:48:41 +0000 (02:48 +0000)]
Merge branch 'smattr/681394c3-c5d5-4f79-ba6f-7039662791a1' into 'main'

tests: fix path from which to import 'gvtest'

See merge request graphviz/graphviz!2954

2 years agotests: fix legacy comments to rtest
Matthew Fernandez [Tue, 15 Nov 2022 01:20:32 +0000 (17:20 -0800)]
tests: fix legacy comments to rtest

These have been inaccurate since 0e19cdb9bff60fdeb1942f5dca677db9d8a24062.

2 years agotests: fix path from which to import 'gvtest'
Matthew Fernandez [Tue, 15 Nov 2022 01:19:02 +0000 (17:19 -0800)]
tests: fix path from which to import 'gvtest'

This has been wrong since 0e19cdb9bff60fdeb1942f5dca677db9d8a24062 removed the
rtest directory. And yet the tests in this file somehow still run correctly in
CI. I can only guess that insufficient test isolation under Pytest results in
some other test file putting the correct path in `sys.path` prior to this file
being processed.

2 years agoMerge commit '9985c8ace846fe13315a6686cb4d959a69c7d973' into smattr/b4ec63ae-dbf8...
Matthew Fernandez [Thu, 17 Nov 2022 01:56:26 +0000 (17:56 -0800)]
Merge commit '9985c8ace846fe13315a6686cb4d959a69c7d973' into smattr/b4ec63ae-dbf8-475e-ba57-e5dffdc7634e

2 years agoCONTRIBUTING: clarify that changelog entries should be appended
Matthew Fernandez [Thu, 17 Nov 2022 01:54:57 +0000 (17:54 -0800)]
CONTRIBUTING: clarify that changelog entries should be appended

2 years agoadd some more CHANGELOG detail to the SWIG 4.1.0 support
Matthew Fernandez [Thu, 17 Nov 2022 01:53:22 +0000 (17:53 -0800)]
add some more CHANGELOG detail to the SWIG 4.1.0 support

2 years agoFix php install for SWIG-4.0.1
Pierre Labastie [Tue, 15 Nov 2022 08:03:54 +0000 (09:03 +0100)]
Fix php install for SWIG-4.0.1

This version of SWIG does not generate gv.php anymore, so
installing it shouldn't be tried. The autotools framework is
already there, so just use a conditional in Makefile.am.

2 years agoMerge branch 'smattr/41de8cd1-5dc5-43d5-96cd-230258c7f141' into 'main'
Matthew Fernandez [Wed, 16 Nov 2022 17:19:13 +0000 (17:19 +0000)]
Merge branch 'smattr/41de8cd1-5dc5-43d5-96cd-230258c7f141' into 'main'

CI: ASan, UBSan tweaks

See merge request graphviz/graphviz!2957

2 years agoCI: show stack traces on UBSan errors
Matthew Fernandez [Wed, 16 Nov 2022 05:37:19 +0000 (21:37 -0800)]
CI: show stack traces on UBSan errors

2 years agoCI: also apply ASan, UBSan options to ld flags
Matthew Fernandez [Wed, 16 Nov 2022 05:29:14 +0000 (21:29 -0800)]
CI: also apply ASan, UBSan options to ld flags

The test job was doing this but the build job was not. Technically I think this
is unnecessary (I think CMake includes `CFLAGS` or `CXXFLAGS` when calling `ld`)
but it seems worth being consistent.

2 years agoCI: make UBSan errors in compiled test cases fail the test
Matthew Fernandez [Wed, 16 Nov 2022 05:26:51 +0000 (21:26 -0800)]
CI: make UBSan errors in compiled test cases fail the test

0d0c20797a0cf2937886945f3aecc4e8a9a55e8c adjusted this for the build job, but
not for the test job. It is useful to have this enabled for the test job as well
because some test cases involve compiling C code, for which we want full ASan
and UBSan enabled too.

Gitlab: #2200

2 years agoMerge branch 'defaultValue' into 'main'
Mark Hansen [Wed, 16 Nov 2022 07:42:39 +0000 (07:42 +0000)]
Merge branch 'defaultValue' into 'main'

Use a consistent name for defaultValue in utils.c

See merge request graphviz/graphviz!2952

2 years agoConstruct objects inline, brace else's
Mark Hansen [Wed, 16 Nov 2022 06:27:12 +0000 (17:27 +1100)]
Construct objects inline, brace else's

2 years agoutils.h is now clang-formatted
Mark Hansen [Tue, 15 Nov 2022 21:46:05 +0000 (08:46 +1100)]
utils.h is now clang-formatted

2 years agoInline variable declarations in utils.c
Mark Hansen [Mon, 14 Nov 2022 10:52:12 +0000 (21:52 +1100)]
Inline variable declarations in utils.c

And reformat some lines that were broken

2 years agoGive better names to mapBool arguments
Mark Hansen [Mon, 14 Nov 2022 10:50:40 +0000 (21:50 +1100)]
Give better names to mapBool arguments

2 years agoGive better argument name to edgeType
Mark Hansen [Mon, 14 Nov 2022 10:49:34 +0000 (21:49 +1100)]
Give better argument name to edgeType

2 years agoGive better names for setEdgeType arguments
Mark Hansen [Mon, 14 Nov 2022 10:49:06 +0000 (21:49 +1100)]
Give better names for setEdgeType arguments

2 years agoGive better argument names to safe_dcl
Mark Hansen [Mon, 14 Nov 2022 10:47:38 +0000 (21:47 +1100)]
Give better argument names to safe_dcl

2 years agoGive better names to late_bool arguments
Mark Hansen [Mon, 14 Nov 2022 10:47:05 +0000 (21:47 +1100)]
Give better names to late_bool arguments

2 years agoGive better names to late_nnstring arguments
Mark Hansen [Mon, 14 Nov 2022 10:46:45 +0000 (21:46 +1100)]
Give better names to late_nnstring arguments

2 years agoGive better names to late_string arguments
Mark Hansen [Mon, 14 Nov 2022 10:46:28 +0000 (21:46 +1100)]
Give better names to late_string arguments

2 years agoGive better names to arguments of late_double
Mark Hansen [Mon, 14 Nov 2022 10:45:22 +0000 (21:45 +1100)]
Give better names to arguments of late_double

And inline some variable declarations

2 years agoGive better names to arguments to late_int
Mark Hansen [Mon, 14 Nov 2022 10:44:29 +0000 (21:44 +1100)]
Give better names to arguments to late_int

Inline some variable definitions

2 years agoMerge branch 'smattr/6fe8455f-8d8a-4a34-9ed3-d89b97493fbb' into 'main'
Matthew Fernandez [Mon, 14 Nov 2022 00:41:50 +0000 (00:41 +0000)]
Merge branch 'smattr/6fe8455f-8d8a-4a34-9ed3-d89b97493fbb' into 'main'

compiler warning squashing

See merge request graphviz/graphviz!2950

2 years agopathplan: use a 'size_t' for counting triangles
Matthew Fernandez [Sun, 13 Nov 2022 18:23:11 +0000 (10:23 -0800)]
pathplan: use a 'size_t' for counting triangles

Squashes:

  shortest.c: In function ‘growtris’:
  shortest.c:518:39: warning: conversion to ‘long unsigned int’ from ‘int’ may
    change the sign of the result [-Wsign-conversion]
    518 |     tris = realloc(tris, TRIANGLESIZE * newtrin);
        |                                       ^

At the call site for `growtris`, it is not clear to me why `trin + 20` is
enough. That is, it seems like this branch can be hit, reallocation can succeed,
but `tril` was greater than `trin + 20` so the array remains too small for the
follow on computation. But this is a separate problem.

2 years agopathplan: remove dead code in 'growtris'
Matthew Fernandez [Sun, 13 Nov 2022 18:12:20 +0000 (10:12 -0800)]
pathplan: remove dead code in 'growtris'

The only call to `growtris` ensures this branch is false.

2 years agopathplan: use a 'size_t' for counting allocated points
Matthew Fernandez [Sun, 13 Nov 2022 18:09:13 +0000 (10:09 -0800)]
pathplan: use a 'size_t' for counting allocated points

Squashes:

  shortest.c:500:41: warning: conversion to ‘long unsigned int’ from ‘int’ may
    change the sign of the result [-Wsign-conversion]
    500 |     pnls = realloc(pnls, POINTNLINKSIZE * newpnln);
        |                                         ^
  shortest.c:505:44: warning: conversion to ‘long unsigned int’ from ‘int’ may
    change the sign of the result [-Wsign-conversion]
    505 |     pnlps = realloc(pnlps, POINTNLINKPSIZE * newpnln);
        |                                            ^

It would be nice to adjust `Ppoly_t.pn` to avoid the casting, but it is part of
the public API and it does not seem worth an API break for this.

2 years agopathplan: phrase comparison in 'splinefits' with a tolerance
Matthew Fernandez [Sun, 13 Nov 2022 17:57:47 +0000 (09:57 -0800)]
pathplan: phrase comparison in 'splinefits' with a tolerance

From the adjustments to `a` in this function, it can be seen this is equivalent.
This squashes the warning:

  route.c: In function ‘splinefits’:
  route.c:252:15: warning: comparing floating-point with ‘==’ or ‘!=’ is unsafe
    [-Wfloat-equal]
    252 |         if (a == 0) {
        |               ^~

2 years agopathplan: remove duplicated variable in 'splinefits'
Matthew Fernandez [Sun, 13 Nov 2022 17:52:08 +0000 (09:52 -0800)]
pathplan: remove duplicated variable in 'splinefits'

`a` and `b` in this function were always the same value. So we can reduce this
computation to using a single variable.

2 years agocgraph: squash some -Wconversion warnings
Matthew Fernandez [Sun, 13 Nov 2022 17:44:36 +0000 (09:44 -0800)]
cgraph: squash some -Wconversion warnings

This squashes the following warnings on CentOS 7 where the compiler believes
the sequence ID may overflow:

  node.c: In function 'agnodebefore':
  node.c:370:23: warning: conversion to 'unsigned int:28' from 'int' may alter
    its value [-Wconversion]
     AGSEQ(n) = AGSEQ(n) + 1;
                         ^
  node.c:376:26: warning: conversion to 'unsigned int:28' from 'int' may alter
    its value [-Wconversion]
    AGSEQ(snd) = AGSEQ(fst) - 1;
                            ^

2 years agoMerge branch 'smattr/621d3a05-dacc-403f-a4c0-8fec56d2f0d2' into 'main'
Matthew Fernandez [Sun, 13 Nov 2022 22:49:55 +0000 (22:49 +0000)]
Merge branch 'smattr/621d3a05-dacc-403f-a4c0-8fec56d2f0d2' into 'main'

CMake: add 'dot_builtins'

See merge request graphviz/graphviz!2948

2 years agoCMake: add 'dot_builtins'
Matthew Fernandez [Fri, 11 Nov 2022 16:35:44 +0000 (08:35 -0800)]
CMake: add 'dot_builtins'

This attempts to replicate how this target is defined in the Autotools build
system, but involved some amount of guesswork because the Autotools build system
is not explicit with _why_ it is adding particular dependencies to link/include
lists.

The rpath tweak in this commit required surprisingly lengthy debugging to arrive
at. I am still not completely confident it is correct nor that this is the right
way to do such things.

Gitlab: #1836

2 years agodot_builtins: use 'dllimport' even when LTDL is in use
Matthew Fernandez [Sat, 12 Nov 2022 19:09:20 +0000 (11:09 -0800)]
dot_builtins: use 'dllimport' even when LTDL is in use

I am not sure why 53eec6fb96646da693e5e8f78047cccf91774dbb included LTDL in the
conditional here. Whether LTDL is in use or not has no bearing on whether we
`dllimport` mark the plugin libraries, because we are unconditionally
dynamically linking them (as opposed to LTDL-based on demand loading).

Gitlab: #1836

2 years agoCI: output more information when installing RPMs
Matthew Fernandez [Sat, 12 Nov 2022 19:08:06 +0000 (11:08 -0800)]
CI: output more information when installing RPMs

This was useful in debugging rpath problems, informing the upcoming commits. So
it seems wise to have this always on.

2 years agoCMake: fix: add Zlib include directories when building with Zlib
Matthew Fernandez [Fri, 11 Nov 2022 16:30:12 +0000 (08:30 -0800)]
CMake: fix: add Zlib include directories when building with Zlib

This worked out before because everywhere we test has Zlib installed in the
default system paths. But technically this should be setup in order to correctly
use a Zlib installed somewhere else.

2 years agoMerge branch 'smattr/gitlab-2307' into 'main'
Matthew Fernandez [Sun, 13 Nov 2022 21:47:07 +0000 (21:47 +0000)]
Merge branch 'smattr/gitlab-2307' into 'main'

fix misidentified gradient fills when using IDs

Closes #2307

See merge request graphviz/graphviz!2949

2 years agocore plugin: remove some unnecessary parens
Matthew Fernandez [Sun, 13 Nov 2022 00:25:25 +0000 (16:25 -0800)]
core plugin: remove some unnecessary parens

2 years agocore plugin: suppress 'offset' double comparison warning
Matthew Fernandez [Sat, 12 Nov 2022 23:53:05 +0000 (15:53 -0800)]
core plugin: suppress 'offset' double comparison warning

This code is trying to abbreviate printing `0.000` or `1.000`. We can more
accurately describe the situations under which this will happen, squashing:

  gvrender_core_svg.c: In function ‘svg_print_stop’:
  gvrender_core_svg.c:525:16: warning: comparing floating-point with ‘==’ or
    ‘!=’ is unsafe [-Wfloat-equal]
    525 |     if (offset == 0.0)
        |                ^~
  gvrender_core_svg.c:527:21: warning: comparing floating-point with ‘==’ or
    ‘!=’ is unsafe [-Wfloat-equal]
    527 |     else if (offset == 1.0)
        |                     ^~

2 years agocore plugin: suppress 'penwidth' double comparison warning
Matthew Fernandez [Sat, 12 Nov 2022 23:50:03 +0000 (15:50 -0800)]
core plugin: suppress 'penwidth' double comparison warning

`gvprintdouble` prints to two decimal places. So we can take this into account
when deciding whether we need to print a non-default pen width, squashing:

  gvrender_core_svg.c: In function ‘svg_grstyle’:
  gvrender_core_svg.c:191:23: warning: comparing floating-point with ‘==’ or
    ‘!=’ is unsafe [-Wfloat-equal]
    191 |     if (obj->penwidth != PENWIDTH_NORMAL) {
        |                       ^~

2 years agofix misidentified gradient fills when using IDs
Matthew Fernandez [Sat, 12 Nov 2022 23:35:22 +0000 (15:35 -0800)]
fix misidentified gradient fills when using IDs

465cef702370966f17d27d455093cf69a651af9c fixed an issue where `id` attributes
were not propagated to SVG output. However unfortunately it broke references to
such attributes in fill gradients. This commit makes the corresponding
adjustment to the references, so they once again align with their targets.

Gitlab: fixes #2307
Reported-by: Ronny H
2 years agoadd a test case for #2307
Matthew Fernandez [Sat, 12 Nov 2022 23:25:37 +0000 (15:25 -0800)]
add a test case for #2307

2 years agoMerge branch 'smattr/gitlab-1836' into 'main'
Matthew Fernandez [Fri, 11 Nov 2022 16:37:57 +0000 (16:37 +0000)]
Merge branch 'smattr/gitlab-1836' into 'main'

CMake: add 'gv2gxl', 'gxl2dot' symlinks

See merge request graphviz/graphviz!2945

2 years agoCMake: hoist common lines in dot symlinking/copying logic
Matthew Fernandez [Thu, 10 Nov 2022 16:18:05 +0000 (08:18 -0800)]
CMake: hoist common lines in dot symlinking/copying logic

Fewer lines of code to accomplish the same thing.

2 years agoCMake: add 'gv2gxl', 'gxl2dot' symlinks
Matthew Fernandez [Thu, 10 Nov 2022 16:11:32 +0000 (08:11 -0800)]
CMake: add 'gv2gxl', 'gxl2dot' symlinks

This replicates a pattern from cmd/dot/CMakeLists.txt for adding multiple
links/copies to the existing `gxl2gv` target.

Gitlab: #1836

2 years agoMerge branch 'smattr/fa34eeb9-1c92-41af-ae47-54fad0e5a8a7' into 'main'
Matthew Fernandez [Fri, 11 Nov 2022 15:44:52 +0000 (15:44 +0000)]
Merge branch 'smattr/fa34eeb9-1c92-41af-ae47-54fad0e5a8a7' into 'main'

gvc, gvedit: compiler warning squashing

See merge request graphviz/graphviz!2946

2 years agogvedit: squash Qt 'flush' deprecation warnings
Matthew Fernandez [Fri, 11 Nov 2022 04:04:08 +0000 (20:04 -0800)]
gvedit: squash Qt 'flush' deprecation warnings

I think this code originally intended to call `Qt::flush` but changes in Qt now
make ADL pick the wrong overload. This squashes the warnings below. We cannot
easily switch to the alternative the deprecation warning suggests because it is
unavailable in older versions of Qt.

  main.cpp: In function ‘char** parseArgs(int, char**)’:
  main.cpp:72:42: warning:
    ‘QTextStream& QTextStreamFunctions::flush(QTextStream&)’ is deprecated: Use
    Qt::flush [-Wdeprecated-declarations]
     72 |                     " unrecognized\n" << flush;
        |                                          ^~~~~
  In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QTextStream:1,
                   from mainwindow.h:19,
                   from main.cpp:24:
  /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:294:76: note: declared
    here
    294 | Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::flush")
      QTextStream &flush(QTextStream &s);
        |
  main.cpp:72:42: warning:
    ‘QTextStream& QTextStreamFunctions::flush(QTextStream&)’ is deprecated: Use
    Qt::flush [-Wdeprecated-declarations]
     72 |                     " unrecognized\n" << flush;
        |                                          ^~~~~
  In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QTextStream:1,
                   from mainwindow.h:19,
                   from main.cpp:24:
  /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:294:76: note: declared
    here
    294 | Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::flush")
      QTextStream &flush(QTextStream &s);
        |
  csettings.cpp: In function ‘bool loadAttrs(QString, QComboBox*, QComboBox*,
    QComboBox*)’:
  csettings.cpp:94:35: warning:
    ‘QTextStream& QTextStreamFunctions::flush(QTextStream&)’ is deprecated: Use
    Qt::flush [-Wdeprecated-declarations]
     94 |             "\" for reading\n" << flush;
        |                                   ^~~~~
  In file included from qt5/QtCore/qdebug.h:49,
                   from qt5/QtCore/qcborcommon.h:45,
                   from qt5/QtCore/qcborvalue.h:45,
                   from qt5/QtCore/qcborarray.h:43,
                   from qt5/QtCore/QtCore:38,
                   from qt5/QtWidgets/QtWidgetsDepends:3,
                   from qt5/QtWidgets/QtWidgets:3,
                   from csettings.cpp:16:
  /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:294:76: note: declared
    here
    294 | Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::flush")
      QTextStream &flush(QTextStream &s);
        |
  csettings.cpp:94:35: warning:
    ‘QTextStream& QTextStreamFunctions::flush(QTextStream&)’ is deprecated: Use
    Qt::flush [-Wdeprecated-declarations]
     94 |             "\" for reading\n" << flush;
        |                                   ^~~~~
  In file included from qt5/QtCore/qdebug.h:49,
                   from qt5/QtCore/qcborcommon.h:45,
                   from qt5/QtCore/qcborvalue.h:45,
                   from qt5/QtCore/qcborarray.h:43,
                   from qt5/QtCore/QtCore:38,
                   from qt5/QtWidgets/QtWidgetsDepends:3,
                   from qt5/QtWidgets/QtWidgets:3,
                   from csettings.cpp:16:
  /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:294:76: note: declared
    here
    294 | Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::flush")
      QTextStream &flush(QTextStream &s);
        |

2 years agogvc: read LSB data as 'int' values
Matthew Fernandez [Fri, 11 Nov 2022 03:59:02 +0000 (19:59 -0800)]
gvc: read LSB data as 'int' values

Similar to the previous commit, these are dealt with as `int` internally, so
better to use `int` the whole way through. Note that this rejects values that do
not fit in an `int` which would silently overflow before. This squashes:

  gvusershape.c: In function ‘webp_size’:
  gvusershape.c:301:21: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    301 |             us->w = w;
        |                     ^
  gvusershape.c:302:21: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    302 |             us->h = h;
        |                     ^
  gvusershape.c:308:21: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    308 |             us->w = w;
        |                     ^
  gvusershape.c:309:21: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    309 |             us->h = h;
        |                     ^
  gvusershape.c: In function ‘gif_size’:
  gvusershape.c:321:17: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    321 |         us->w = w;
        |                 ^
  gvusershape.c:322:17: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    322 |         us->h = h;
        |                 ^
  gvusershape.c: In function ‘bmp_size’:
  gvusershape.c:335:17: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    335 |         us->w = size_x_msw << 16 | size_x_lsw;
        |                 ^~~~~~~~~~
  gvusershape.c:336:17: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    336 |         us->h = size_y_msw << 16 | size_y_lsw;
        |                 ^~~~~~~~~~

2 years agogvc: read MSB data as 'int' values
Matthew Fernandez [Fri, 11 Nov 2022 03:51:38 +0000 (19:51 -0800)]
gvc: read MSB data as 'int' values

These are dealt with as `int` internally, so better to use `int` the whole way
through. Note that this rejects values that do not fit in an `int` which would
silently overflow before. This squashes:

  gvusershape.c: In function ‘png_size’:
  gvusershape.c:271:17: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    271 |         us->w = w;
        |                 ^
  gvusershape.c:272:17: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    272 |         us->h = h;
        |                 ^
  gvusershape.c: In function ‘ico_size’:
  gvusershape.c:283:17: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    283 |         us->w = w;
        |                 ^
  gvusershape.c:284:17: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    284 |         us->h = h;
        |                 ^
  gvusershape.c: In function ‘jpeg_size’:
  gvusershape.c:381:25: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    381 |                 us->h = size_x;
        |                         ^~~~~~
  gvusershape.c:382:25: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    382 |                 us->w = size_y;
        |                         ^~~~~~
  gvusershape.c:396:25: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    396 |                 us->h = size_x;
        |                         ^~~~~~
  gvusershape.c:397:25: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    397 |                 us->w = size_y;
        |                         ^~~~~~

2 years agogvc: use 'int' when converting SVG units
Matthew Fernandez [Fri, 11 Nov 2022 03:39:48 +0000 (19:39 -0800)]
gvc: use 'int' when converting SVG units

These values are eventually stored in `int` fields, so going through
`unsigned int` is unproductive. This squashes a number of warnings:

  In file included from ../../lib/common/geom.h:19,
                   from ../../lib/common/types.h:37,
                   from gvusershape.c:28:
  gvusershape.c: In function ‘svg_units_convert’:
  ../../lib/common/arith.h:59:46: warning: conversion to ‘unsigned int’ from
    ‘int’ may change the sign of the result [-Wsign-conversion]
     59 | #define ROUND(f)        ((f>=0)?(int)(f + .5):(int)(f - .5))
        |                         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
  gvusershape.c:149:16: note: in expansion of macro ‘ROUND’
    149 |         return ROUND(n * POINTS_PER_INCH);
        |                ^~~~~
  ../../lib/common/arith.h:59:46: warning: conversion to ‘unsigned int’ from
    ‘int’ may change the sign of the result [-Wsign-conversion]
     59 | #define ROUND(f)        ((f>=0)?(int)(f + .5):(int)(f - .5))
        |                         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
  gvusershape.c:151:16: note: in expansion of macro ‘ROUND’
    151 |         return ROUND(n * POINTS_PER_INCH / 96);
        |                ^~~~~
  ../../lib/common/arith.h:59:46: warning: conversion to ‘unsigned int’ from
    ‘int’ may change the sign of the result [-Wsign-conversion]
     59 | #define ROUND(f)        ((f>=0)?(int)(f + .5):(int)(f - .5))
        |                         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
  gvusershape.c:153:16: note: in expansion of macro ‘ROUND’
    153 |         return ROUND(n * POINTS_PER_INCH / 6);
        |                ^~~~~
  ../../lib/common/arith.h:59:46: warning: conversion to ‘unsigned int’ from
    ‘int’ may change the sign of the result [-Wsign-conversion]
     59 | #define ROUND(f)        ((f>=0)?(int)(f + .5):(int)(f - .5))
        |                         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
  gvusershape.c:155:16: note: in expansion of macro ‘ROUND’
    155 |         return ROUND(n);
        |                ^~~~~
  ../../lib/common/arith.h:59:46: warning: conversion to ‘unsigned int’ from
    ‘int’ may change the sign of the result [-Wsign-conversion]
     59 | #define ROUND(f)        ((f>=0)?(int)(f + .5):(int)(f - .5))
        |                         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
  gvusershape.c:157:16: note: in expansion of macro ‘ROUND’
    157 |         return ROUND(n * POINTS_PER_CM);
        |                ^~~~~
  ../../lib/common/arith.h:59:46: warning: conversion to ‘unsigned int’ from
    ‘int’ may change the sign of the result [-Wsign-conversion]
     59 | #define ROUND(f)        ((f>=0)?(int)(f + .5):(int)(f - .5))
        |                         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
  gvusershape.c:159:16: note: in expansion of macro ‘ROUND’
    159 |         return ROUND(n * POINTS_PER_MM);
        |                ^~~~~
  gvusershape.c:261:13: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    261 |     us->w = w;
        |             ^
  gvusershape.c:262:13: warning: conversion to ‘int’ from ‘unsigned int’ may
    change the sign of the result [-Wsign-conversion]
    262 |     us->h = h;
        |             ^

2 years agoMerge branch 'smattr/cd9fea20-963d-4dff-83f2-0c241dc21a43' into 'main'
Matthew Fernandez [Fri, 11 Nov 2022 01:58:12 +0000 (01:58 +0000)]
Merge branch 'smattr/cd9fea20-963d-4dff-83f2-0c241dc21a43' into 'main'

fix some compiler warnings

See merge request graphviz/graphviz!2942

2 years agoGD plugin: fix unchecked allocation failures
Matthew Fernandez [Tue, 8 Nov 2022 02:33:30 +0000 (18:33 -0800)]
GD plugin: fix unchecked allocation failures

2 years agoGD plugin: use more appropriate type for points counting
Matthew Fernandez [Tue, 8 Nov 2022 02:30:23 +0000 (18:30 -0800)]
GD plugin: use more appropriate type for points counting

Squashes the compiler warning:

  gvrender_gd.c: In function 'gdgen_polygon':
  gvrender_gd.c:491:6: warning: conversion to 'long unsigned int' from 'int'
    may change the sign of the result [-Wsign-conversion]
        points = realloc(points, n * sizeof(gdPoint));
        ^

2 years agocore plugin: squash -Wsign-conversion warning
Matthew Fernandez [Tue, 8 Nov 2022 02:27:36 +0000 (18:27 -0800)]
core plugin: squash -Wsign-conversion warning

Squashes the compiler warning:

  gvloadimage_core.c: In function ‘core_loadimage_vml’:
  gvloadimage_core.c:251:18: warning: conversion to ‘unsigned int’ from ‘int’
    may change the sign of the result [-Wsign-conversion]
    251 |     graphHeight =(int)(job->bb.UR.y - job->bb.LL.y);
        |                  ^

2 years agocore POV: treat 'layerz' and 'z' as ints
Matthew Fernandez [Tue, 8 Nov 2022 02:22:58 +0000 (18:22 -0800)]
core POV: treat 'layerz' and 'z' as ints

It is not clear why these were floats as they were operated on as ints. This
squashes the compiler warning:

  gvrender_core_pov.c: In function ‘pov_begin_layer’:
  gvrender_core_pov.c:459:18: warning: conversion from ‘int’ to ‘float’ may
    change value [-Wconversion]
    459 |         layerz = layerNum * -10;
        |                  ^~~~~~~~

2 years agogvc: squash 'api_t' related -Wsign-compare warnings
Matthew Fernandez [Tue, 8 Nov 2022 02:03:31 +0000 (18:03 -0800)]
gvc: squash 'api_t' related -Wsign-compare warnings

The range of either 'int' or 'size_t' is enough to cover all valid values this
takes on, so we can safely squash the following:

  gvplugin.c: In function ‘gvPluginList’:
  gvplugin.c:408:23: warning: comparison of integer expressions of different
    signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
    408 |     for (api = 0; api < ARRAY_SIZE(api_names); api++) {
        |                       ^
  gvplugin.c: In function ‘gvplugin_write_status’:
  gvplugin.c:450:23: warning: comparison of integer expressions of different
    signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
    450 |     for (api = 0; api < ARRAY_SIZE(api_names); api++) {
        |                       ^
  gvplugin.c: In function ‘gvplugin_graph’:
  gvplugin.c:501:27: warning: comparison of integer expressions of different
    signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
    501 |         for (api = 0; api < ARRAY_SIZE(api_names); api++) {
        |                           ^
  gvplugin.c:680:27: warning: comparison of integer expressions of different
    signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
    680 |         for (api = 0; api < ARRAY_SIZE(api_names); api++) {
        |                           ^

2 years agogvc: squash -Wconversion warnings in 'gvevent_button_press'
Matthew Fernandez [Tue, 8 Nov 2022 01:56:05 +0000 (17:56 -0800)]
gvc: squash -Wconversion warnings in 'gvevent_button_press'

Squashes the following compiler warnings. We know these are false positives due
to the switch cases in which this code appears.

  gvevent.c:373:23: warning: conversion from ‘int’ to ‘unsigned char’ may change
    value [-Wconversion]
    373 |         job->button = button;
        |                       ^~~~~~
  gvevent.c:378:23: warning: conversion from ‘int’ to ‘unsigned char’ may change
    value [-Wconversion]
    378 |         job->button = button;
        |                       ^~~~~~
  gvevent.c:384:23: warning: conversion from ‘int’ to ‘unsigned char’ may change
    value [-Wconversion]
    384 |         job->button = button;
        |                       ^~~~~~

2 years agoMerge branch 'smattr/gitlab-2300' into 'main'
Matthew Fernandez [Thu, 10 Nov 2022 17:36:01 +0000 (17:36 +0000)]
Merge branch 'smattr/gitlab-2300' into 'main'

cgraph: fix mismatched 'agobjfn_t' callbacks

See merge request graphviz/graphviz!2939

2 years agocgraph: fix mismatched type signatures between 'agobjfn_t' and 'agraphattr_init'
Matthew Fernandez [Sun, 6 Nov 2022 18:19:29 +0000 (10:19 -0800)]
cgraph: fix mismatched type signatures between 'agobjfn_t' and 'agraphattr_init'

Squashes a compiler warning:

  attr.c: In function ‘init_all_attrs’:
  attr.c:534:37: warning: cast between incompatible function types from ‘void
    (*)(Agraph_t *)’ {aka ‘void (*)(struct Agraph_s *)’} to ‘void (*)(Agraph_t
    *, Agobj_t *, void *)’ {aka ‘void (*)(struct Agraph_s *, struct Agobj_s *,
    void *)’} [-Wcast-function-type]
    534 |     agapply(root, (Agobj_t *) root, (agobjfn_t) agraphattr_init,
        |                                     ^

This code was incorrect. But on the most common architecture in contemporary
use, x86-64, the calling convention for both is fully in registers, so no user
visible misbehavior would have been seen.

Gitlab: #2300

2 years agocgraph: fix: align 'dict_relabel' with 'agobjfn_t' type signature
Matthew Fernandez [Sun, 6 Nov 2022 18:08:58 +0000 (10:08 -0800)]
cgraph: fix: align 'dict_relabel' with 'agobjfn_t' type signature

The `dict_relabel` function is used as a callback and the compiler correctly
identified it would be invoked incorrectly:

  node.c: In function ‘agrelabel_node’:
  node.c:245:37: warning: cast between incompatible function types from
    ‘void (*)(Agnode_t *, void *)’ {aka ‘void (*)(struct Agnode_s *, void *)’}
    to ‘void (*)(Agraph_t *, Agobj_t *, void *)’ {aka ‘void (*)(struct Agraph_s
    *, struct Agobj_s *, void *)’} [-Wcast-function-type]
    245 |  agapply(g, (Agobj_t*)n, (agobjfn_t)dict_relabel, &new_id, FALSE);
        |                          ^

The calling convention of `dict_relabel` and `agobjfn_t` differed in a way that
meant the callback would result in stack corruption on most platforms.

Note that this has little effect on the #2300 test case involving `gxl2gv`
because `dict_relabel` is still incorrect, crashing with references to invalid
pointers when you invoke it.

Gitlab: #2300

2 years agoMerge branch 'smattr/70c6cdc5-1669-4b52-b6cb-99b71e446ee6' into 'main'
Matthew Fernandez [Thu, 10 Nov 2022 16:40:25 +0000 (16:40 +0000)]
Merge branch 'smattr/70c6cdc5-1669-4b52-b6cb-99b71e446ee6' into 'main'

add 'cluster' to the CMake build system

See merge request graphviz/graphviz!2938

2 years agoadd 'cluster' to the CMake build system
Matthew Fernandez [Sat, 5 Nov 2022 23:38:05 +0000 (16:38 -0700)]
add 'cluster' to the CMake build system

From the Autotools build system, it looks like this should link against GTS. But
apparently it does not need to.

Gitlab: #1836

2 years agocluster: remove Windows pragma lib directories
Matthew Fernandez [Sun, 6 Nov 2022 00:09:13 +0000 (17:09 -0700)]
cluster: remove Windows pragma lib directories

These are unnecessary after some recent build system changes.

2 years agogvmap: remove CPP flags customization
Matthew Fernandez [Sat, 5 Nov 2022 23:31:52 +0000 (16:31 -0700)]
gvmap: remove CPP flags customization

This is the default value and does not need to be explicitly specified.

2 years agocluster: remove forced '-g' compiler flag
Matthew Fernandez [Sat, 5 Nov 2022 23:30:09 +0000 (16:30 -0700)]
cluster: remove forced '-g' compiler flag

I do not know why 978399c54faa413ec105fb5849b35f94ac17ff10 added this option to
force debugging information on and the commit message provides no enlightenment.

2 years agoMerge branch 'smattr/gitlab-1836' into 'main'
Matthew Fernandez [Thu, 10 Nov 2022 05:37:50 +0000 (05:37 +0000)]
Merge branch 'smattr/gitlab-1836' into 'main'

add prune to the CMake build system

See merge request graphviz/graphviz!2936

2 years agoprune: use 'size_t' for size variables
Matthew Fernandez [Sat, 5 Nov 2022 17:12:48 +0000 (10:12 -0700)]
prune: use 'size_t' for size variables

This squashes some warnings on Windows and 32-bit platforms:

  generic_list.c(25,28): warning C4244: 'function': conversion from 'uint64_t'
    to 'size_t', possible loss of data
  generic_list.c(47,56): warning C4244: 'function': conversion from 'uint64_t'
    to 'size_t', possible loss of data
  generic_list.c(47,66): warning C4244: 'function': conversion from 'uint64_t'
    to 'size_t', possible loss of data

2 years agoprune: remove no longer necessary include paths from the MSBuild build system
Matthew Fernandez [Sat, 5 Nov 2022 16:28:37 +0000 (09:28 -0700)]
prune: remove no longer necessary include paths from the MSBuild build system

2 years agoprune: remove no longer necessary include paths from the Autotools build system
Matthew Fernandez [Sat, 5 Nov 2022 16:27:03 +0000 (09:27 -0700)]
prune: remove no longer necessary include paths from the Autotools build system

2 years agoadd prune to the CMake build system
Matthew Fernandez [Sat, 5 Nov 2022 16:24:57 +0000 (09:24 -0700)]
add prune to the CMake build system

Gitlab: #1836

2 years agoprune: remove unnecessary casts
Matthew Fernandez [Sat, 5 Nov 2022 16:19:31 +0000 (09:19 -0700)]
prune: remove unnecessary casts

2 years agoprune: mark all local functions static
Matthew Fernandez [Sat, 5 Nov 2022 16:16:08 +0000 (09:16 -0700)]
prune: mark all local functions static