]> granicus.if.org Git - graphviz/log
graphviz
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

2 years agoprune: remove unused 'strattr_s' struct name
Matthew Fernandez [Sat, 5 Nov 2022 16:13:12 +0000 (09:13 -0700)]
prune: remove unused 'strattr_s' struct name

2 years agoprune: return list by value from 'new_generic_list'
Matthew Fernandez [Sat, 5 Nov 2022 16:12:07 +0000 (09:12 -0700)]
prune: return list by value from 'new_generic_list'

The list type is exposed in the header, so we can stack allocate these, removing
some heap pressure and failure paths.

2 years agoprune: fix memory leak of list memory
Matthew Fernandez [Sat, 5 Nov 2022 16:07:33 +0000 (09:07 -0700)]
prune: fix memory leak of list memory

This code was losing the backing memory of the list data itself.

2 years agoprune: remove unnecessary scoping on switch cases
Matthew Fernandez [Sat, 5 Nov 2022 16:04:13 +0000 (09:04 -0700)]
prune: remove unnecessary scoping on switch cases

2 years agoprune: remove 'add_to_generic_list' return value
Matthew Fernandez [Sat, 5 Nov 2022 16:00:34 +0000 (09:00 -0700)]
prune: remove 'add_to_generic_list' return value

As of the previous commit, there is only a single path through this function
that always returns the first parameter.

2 years agoprune: replace allocations with cgraph wrappers
Matthew Fernandez [Sat, 5 Nov 2022 15:54:38 +0000 (08:54 -0700)]
prune: replace allocations with cgraph wrappers

This application has no ability to handle allocation failures. For example,
allocation failure during adding an attribute would result in setting
`attr_list` to null which would then go on to crash the program. Lets stop
pretending `prune` handles these cases and just exit on allocation failure.

2 years agoprune: remove unused 'generic_list_s' struct name
Matthew Fernandez [Sat, 5 Nov 2022 15:43:52 +0000 (08:43 -0700)]
prune: remove unused 'generic_list_s' struct name

2 years agoprune: switch to more modern '#pragma once'
Matthew Fernandez [Sat, 5 Nov 2022 15:42:25 +0000 (08:42 -0700)]
prune: switch to more modern '#pragma once'

2 years agoprune: remove 'extern "C"' from generic list functions
Matthew Fernandez [Sat, 5 Nov 2022 15:40:51 +0000 (08:40 -0700)]
prune: remove 'extern "C"' from generic list functions

This application is entirely C. There is no need to explicitly specify C linkage
because it is the default.

2 years agoprune: disambiguate #includes
Matthew Fernandez [Sat, 5 Nov 2022 15:37:23 +0000 (08:37 -0700)]
prune: disambiguate #includes

2 years agoMerge branch 'smattr/770e1c55-b7a6-4123-ae7b-03c4b41d358a' into 'main'
Matthew Fernandez [Thu, 10 Nov 2022 04:40:39 +0000 (04:40 +0000)]
Merge branch 'smattr/770e1c55-b7a6-4123-ae7b-03c4b41d358a' into 'main'

smyrna: fix memory leak in column construction

Closes #2299

See merge request graphviz/graphviz!2934

2 years agosmyrna: remove shadowing of 'grid'
Matthew Fernandez [Sat, 5 Nov 2022 03:28:11 +0000 (20:28 -0700)]
smyrna: remove shadowing of 'grid'

This squashes the compiler warning:

  tvnodes.c: In function ‘populate_data’:
  tvnodes.c:195:48: warning: declaration of ‘grid’ shadows a global declaration
    [-Wshadow]
    195 | static void populate_data(Agraph_t * g, grid * grid)
        |                                         ~~~~~~~^~~~
  tvnodes.c:32:3: note: shadowed declaration is here
     32 | } grid;
        |   ^~~~

This seems a little overly prescriptive – one `grid` was a type and the other
was a value – but maybe the compiler is concerned that a future introduction of
a `sizeof(grid)` call in `populate_data` would be ambiguous.

2 years agosmyrna: fix memory leak in column construction
Matthew Fernandez [Sat, 5 Nov 2022 03:22:19 +0000 (20:22 -0700)]
smyrna: fix memory leak in column construction

By using string views, we can avoid the need to duplicate the graph attribute
value here. This allocation that was previously being lost no longer is made at
all.

Gitlab: fixes #2299

2 years agosmyrna: remove a level of indirection in the grid column array
Matthew Fernandez [Sat, 5 Nov 2022 02:59:19 +0000 (19:59 -0700)]
smyrna: remove a level of indirection in the grid column array

The pointers of this array are never captured, so we can use an array of values
here instead. This reduces heap allocation and fragmentation.

2 years agosmyrna: duplicate names when creating new grid columns
Matthew Fernandez [Sat, 5 Nov 2022 02:54:27 +0000 (19:54 -0700)]
smyrna: duplicate names when creating new grid columns

This is a step towards solving a memory leak. Note that this involved rewriting
some string comparisons because the originating pointer is no longer stored in
the column’s `name`. It is not clear to me how the previous code was valid
because, e.g., it was comparing by pointer to the `Visible` constant to detect
when a column was called “Visible”. That is, nothing actually assigns a column
name to the address of `Visible`.

Gitlab: #2299

2 years agosmyrna: squash -Wconversion warnings related to grid column count
Matthew Fernandez [Sat, 5 Nov 2022 02:44:59 +0000 (19:44 -0700)]
smyrna: squash -Wconversion warnings related to grid column count

This squashes the following compiler warnings:

  tvnodes.c: In function ‘update_tree’:
  tvnodes.c:294:28: warning: conversion to ‘size_t’ {aka ‘long unsigned
    int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
    294 |         types = gv_calloc(g->count, sizeof(GType));
        |                           ~^~~~~~~
  tvnodes.c: In function ‘add_column’:
  tvnodes.c:312:43: warning: conversion to ‘size_t’ {aka ‘long unsigned
    int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
    312 |     g->columns = gv_recalloc(g->columns, g->count, g->count + 1,
        |                                          ~^~~~~~~
  tvnodes.c:312:61: warning: conversion to ‘size_t’ {aka ‘long unsigned
    int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
    312 |     g->columns = gv_recalloc(g->columns, g->count, g->count + 1,
        |                                                    ~~~~~~~~~^~~

`count` is known non-negative all the time, but cannot be easily converted to a
`size_t` because we need to interact with the GTK APIs that take `int` values.

2 years agosmyrna: remove unreachable code in 'create_column'
Matthew Fernandez [Sat, 5 Nov 2022 02:37:23 +0000 (19:37 -0700)]
smyrna: remove unreachable code in 'create_column'

This function is only ever called into with non-null pointers.

2 years agoMerge branch 'smattr/gitlab-2301' into 'main'
Matthew Fernandez [Thu, 10 Nov 2022 03:48:15 +0000 (03:48 +0000)]
Merge branch 'smattr/gitlab-2301' into 'main'

sfio: remove 'SF_ERROR', simplify page size calculation

Closes #2301

See merge request graphviz/graphviz!2940

2 years agosfio: remove 'proc' data
Matthew Fernandez [Mon, 24 Oct 2022 00:40:38 +0000 (17:40 -0700)]
sfio: remove 'proc' data

The last non-trivial call to `_sfpopen` was removed in
f552c0dece1435773de62334dee3310d1728e22f. Since then, `proc` members have been
allocated and propagated around with data describing the absence of a subprocess
(`pid == -1`). We can reduce memory overhead and decrease code complexity by
removing these semantically dead code paths.

2 years agosfio: use a more portable way of determining page size
Matthew Fernandez [Sun, 16 Oct 2022 21:48:06 +0000 (14:48 -0700)]
sfio: use a more portable way of determining page size

This code was using a legacy API, `getpagesize`, to opportunistically find the
system virtual memory page size. This change updates to the newer POSIX
`sysconf` API that is available almost everywhere, and adds a workaround for
Windows. This code now has an accurate understanding of the page size on
platforms that did not have `getpagesize` (of which, Windows was one), rather
than falling back on 8192.

2 years agosfio _sfpopen: remove 'stdio' parameter that is always 0
Matthew Fernandez [Sun, 23 Oct 2022 03:05:25 +0000 (20:05 -0700)]
sfio _sfpopen: remove 'stdio' parameter that is always 0

2 years agosfio: remove unused 'stdio'
Matthew Fernandez [Sun, 23 Oct 2022 03:02:09 +0000 (20:02 -0700)]
sfio: remove unused 'stdio'

The last use of this was removed in 751ab539a2531b5459ef709946ea0642ce2c44e8.

2 years agosfio: remove 'SF_ERROR'
Matthew Fernandez [Sun, 23 Oct 2022 02:44:19 +0000 (19:44 -0700)]
sfio: remove 'SF_ERROR'

When doing some unrelated refactoring, Windows compile errors emerge:

  sfsetbuf.c
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\oaidl.h(322,9):
    error C2059: syntax error: 'constant'
    [C:\GitLab-Runner\builds\graphviz\graphviz\build\lib\sfio\sfio.vcxproj]

Some investigation leads us to a guess¹ that oaidl.h contains:

  typedef /* [v1_enum] */
  enum tagSF_TYPE
      {
          SF_ERROR    = VT_ERROR,
          SF_I1   = VT_I1,
          SF_I2   = VT_I2,
          SF_I4   = VT_I4,
          SF_I8   = VT_I8,
          SF_BSTR = VT_BSTR,
          SF_UNKNOWN  = VT_UNKNOWN,
          SF_DISPATCH = VT_DISPATCH,
          SF_VARIANT  = VT_VARIANT,
          SF_RECORD   = VT_RECORD,
          SF_HAVEIID  = ( VT_UNKNOWN | VT_RESERVED )
      }   SF_TYPE; // Line 319

673b9f1a7dbde9c9cc5d9a2a22ee835a08ab40ab tried to work around this in the past.
But there remained a foot gun. If you (possibly transitively) included sfio.h
but did not include sfhdr.h, you could end up facing this error.

Surprising as it may seem, nothing in the code base checks for `SF_ERROR`. So a
cleaner solution that removes the problem in perpetuity is to remove our
`SF_ERROR`. Note that `SF_FLAGS` does not need to be adjusted because `SF_ERROR`
was not a public flag.

Gitlab: fixes #2301

¹ https://stackoverflow.com/questions/13827599/oaidl-h319-error-c2057-expected-constant-expression

2 years agoMerge branch 'smattr/7d9e85e6-2810-4c4a-b42b-5d4a9639b265' into 'main'
Matthew Fernandez [Thu, 10 Nov 2022 02:59:12 +0000 (02:59 +0000)]
Merge branch 'smattr/7d9e85e6-2810-4c4a-b42b-5d4a9639b265' into 'main'

CI: remove command line argument parsing from the deploy script

See merge request graphviz/graphviz!2944

2 years agoCI: remove command line argument parsing from the deploy script
Matthew Fernandez [Thu, 10 Nov 2022 01:15:07 +0000 (17:15 -0800)]
CI: remove command line argument parsing from the deploy script

This script is called in exactly one place and always passed the `--verbose`
option. This change removes this only remaining option from the script and
unconditionally applies its effect, for a minor simplification.

2 years agoMerge branch 'smattr/2cf23838-3ac5-4e6a-b04f-5cd49a748910' into 'main'
Matthew Fernandez [Thu, 10 Nov 2022 01:13:00 +0000 (01:13 +0000)]
Merge branch 'smattr/2cf23838-3ac5-4e6a-b04f-5cd49a748910' into 'main'

CI: move several Ubuntu 22.04 jobs to 22.10

See merge request graphviz/graphviz!2941

2 years agoMerge branch 'smattr/92ac1070-02d5-49eb-a826-830fe13f06f2' into 'main'
Matthew Fernandez [Wed, 9 Nov 2022 16:23:58 +0000 (16:23 +0000)]
Merge branch 'smattr/92ac1070-02d5-49eb-a826-830fe13f06f2' into 'main'

start 7.0.2 development

See merge request graphviz/graphviz!2943

2 years agostart 7.0.2 development
Matthew Fernandez [Wed, 9 Nov 2022 15:09:00 +0000 (07:09 -0800)]
start 7.0.2 development

2 years agoMerge branch 'smattr/c0ea20cb-76eb-487a-ae1f-b61d850e0788' into 'main' 7.0.1
Matthew Fernandez [Wed, 9 Nov 2022 15:06:45 +0000 (15:06 +0000)]
Merge branch 'smattr/c0ea20cb-76eb-487a-ae1f-b61d850e0788' into 'main'

Stable release 7.0.1

See merge request graphviz/graphviz!2935

2 years agoStable release 7.0.1
Matthew Fernandez [Sat, 5 Nov 2022 04:53:26 +0000 (21:53 -0700)]
Stable release 7.0.1

2 years agofix CHANGELOG typos
Matthew Fernandez [Sat, 5 Nov 2022 04:54:56 +0000 (21:54 -0700)]
fix CHANGELOG typos

2 years agoMerge branch 'smattr/gitlab-2291' into 'main'
Matthew Fernandez [Tue, 8 Nov 2022 05:46:45 +0000 (05:46 +0000)]
Merge branch 'smattr/gitlab-2291' into 'main'

CMake: fix bugs and enable some more seat belts

Closes #2291

See merge request graphviz/graphviz!2937

2 years agoCI: fail CMake builds on any developer warnings
Matthew Fernandez [Sat, 5 Nov 2022 19:06:29 +0000 (12:06 -0700)]
CI: fail CMake builds on any developer warnings

Hopefully this will prevent problems like those fixed in the prior commits being
reintroduced.

Gitlab: #2291

2 years agoCMake: avoid referencing 'EXPAT_INCLUDE_DIRS' unless Expat has been sought
Matthew Fernandez [Sat, 5 Nov 2022 21:09:04 +0000 (14:09 -0700)]
CMake: avoid referencing 'EXPAT_INCLUDE_DIRS' unless Expat has been sought

CMake when using `--warn-uninitialized -Werror=dev` notices that this variable
is being incorrectly referenced when `-Dwith_expat=OFF`:

  CMake Error (dev) at lib/common/CMakeLists.txt:111
    (target_include_directories):
    uninitialized variable 'EXPAT_INCLUDE_DIRS'

Gitlab: #2291

2 years agoCMake: avoid referencing 'ZLIB_FOUND' when 'with_zlib' is not set
Matthew Fernandez [Sat, 5 Nov 2022 21:07:57 +0000 (14:07 -0700)]
CMake: avoid referencing 'ZLIB_FOUND' when 'with_zlib' is not set

CMake when using `--warn-uninitialized -Werror=dev` notices that this variable
is being incorrectly referenced when `-Dwith_zlib=OFF`:

  CMake Error (dev) at cmake/config_checks.cmake:42 (set):
    uninitialized variable 'ZLIB_FOUND'
  Call Stack (most recent call first):
    CMakeLists.txt:197 (include)

Gitlab: #2291

2 years agoCMake: avoid referencing 'EXPAT_FOUND' when 'with_expat' is not set
Matthew Fernandez [Sat, 5 Nov 2022 21:05:01 +0000 (14:05 -0700)]
CMake: avoid referencing 'EXPAT_FOUND' when 'with_expat' is not set

CMake when using `--warn-uninitialized -Werror=dev` notices that this variable
is being incorrectly referenced when `-Dwith_expat=OFF`:

  CMake Error (dev) at cmake/config_checks.cmake:40 (set):
    uninitialized variable 'EXPAT_FOUND'
  Call Stack (most recent call first):
    CMakeLists.txt:197 (include)

Gitlab: #2291

2 years agoCMake: stop trying to install Expat and Getopt on MinGW
Matthew Fernandez [Sat, 5 Nov 2022 21:00:22 +0000 (14:00 -0700)]
CMake: stop trying to install Expat and Getopt on MinGW

MinGW does not need these third-party libraries installed; they are already
available in its ecosystem. This was uncovered through using
`--warn-uninitialized -Werror=dev` with CMake:

  CMake Error (dev) at cmd/tools/CMakeLists.txt:460 (install):
    uninitialized variable 'GETOPT_RUNTIME_LIBRARIES'

Gitlab: #2291

2 years agoCMake: use legacy 'GLUT_INCLUDE_DIR' instead of 'GLUT_INCLUDE_DIRS'
Matthew Fernandez [Sat, 5 Nov 2022 20:52:26 +0000 (13:52 -0700)]
CMake: use legacy 'GLUT_INCLUDE_DIR' instead of 'GLUT_INCLUDE_DIRS'

The newer `GLUT_INCLUDE_DIRS` is only provided in CMake ≥ 3.23. Most users and
most of our CI environments are on a version of CMake prior to this and so get
the following when configuring with `--warn-uninitialized -Werror=dev`:

  CMake Error (dev) at cmd/smyrna/CMakeLists.txt:87 (target_include_directories):
    uninitialized variable 'GLUT_INCLUDE_DIRS'

Gitlab: #2291

2 years agoCMake: only use 'LTDL_LIBRARY' on non-Windows or MinGW
Matthew Fernandez [Sat, 5 Nov 2022 19:56:09 +0000 (12:56 -0700)]
CMake: only use 'LTDL_LIBRARY' on non-Windows or MinGW

When running CMake with `--warn-uninitialized -Werror=dev`, this prevents the
following:

  CMake Error (dev) at cmake/FindLTDL.cmake:18 (set):
    uninitialized variable 'LTDL_LIBRARY'
  Call Stack (most recent call first):
    CMakeLists.txt:117 (find_package)

Gitlab: #2291

2 years agoCMake: fix variables used for FreeType
Matthew Fernandez [Sat, 5 Nov 2022 19:03:27 +0000 (12:03 -0700)]
CMake: fix variables used for FreeType

CMake with `--warn-uninitialized -Werror=dev` identified there was a problem
here:

  CMake Error (dev) at plugin/lasi/CMakeLists.txt:25 (target_include_directories):
    uninitialized variable 'Freetype_INCLUDE_DIRS'

  CMake Error (dev) at plugin/lasi/CMakeLists.txt:31 (target_link_libraries):
    uninitialized variable 'Freetype_LIBRARIES'

Gitlab: fixes #2291

2 years agoCMake: avoid use of 'GETOPT_INCLUDE_DIRS' when getopt has not been looked for
Matthew Fernandez [Sat, 5 Nov 2022 18:59:52 +0000 (11:59 -0700)]
CMake: avoid use of 'GETOPT_INCLUDE_DIRS' when getopt has not been looked for

When running CMake with `--warn-uninitialized -Werror=dev`, this prevents the
following:

  CMake Error (dev) at cmd/mingle/CMakeLists.txt:15 (target_include_directories):
    uninitialized variable 'GETOPT_INCLUDE_DIRS'

Gitlab: #2291

2 years agoCMake: only attempt NSIS discovery on Windows
Matthew Fernandez [Sat, 5 Nov 2022 18:57:16 +0000 (11:57 -0700)]
CMake: only attempt NSIS discovery on Windows

When running CMake with `--warn-uninitialized -Werror=dev`, this prevents the
following:

  CMake Error (dev) at cmake/FindNSIS.cmake:5 (find_program):
    uninitialized variable 'PROGRAMFILES'
  Call Stack (most recent call first):
    cmake/package_info.cmake:30 (find_package)
    CMakeLists.txt:242 (include)

  CMake Error (dev) at cmake/FindNSIS.cmake:5 (find_program):
    uninitialized variable 'ProgramFiles(x86)'
  Call Stack (most recent call first):
    cmake/package_info.cmake:30 (find_package)
    CMakeLists.txt:242 (include)

Gitlab: #2291

2 years agoCMake: fix include variable used for DevIL
Matthew Fernandez [Sat, 5 Nov 2022 18:53:05 +0000 (11:53 -0700)]
CMake: fix include variable used for DevIL

b5f4448a3f3a70e14ba7d6990b81506cbda82180 made this closer to correct but still
wrong. As its message mentioned, FindDevIL.cmake is frustratingly inconsistent¹
with respect to the rest of the CMake ecosystem.

Gitlab: #2291

¹ https://cmake.org/cmake/help/latest/module/FindDevIL.html

2 years agoCI: move several Ubuntu 22.04 jobs to 22.10
Matthew Fernandez [Mon, 7 Nov 2022 15:27:32 +0000 (07:27 -0800)]
CI: move several Ubuntu 22.04 jobs to 22.10

Some “extra” CI jobs like the static build have been left on Ubuntu 22.04 under
the assumption that we want to run these on the latest LTS release. But for the
ones affected in this commit, being on a distro with the latest toolchains seems
more desirable.

2 years agoMerge branch 'smattr/8172c602-b302-4dbf-b75b-a2f5df640d6c' into 'main'
Matthew Fernandez [Sun, 6 Nov 2022 00:34:49 +0000 (00:34 +0000)]
Merge branch 'smattr/8172c602-b302-4dbf-b75b-a2f5df640d6c' into 'main'

JSON plugin stoj: remove dynamic memory allocation

See merge request graphviz/graphviz!2911

2 years agoJSON plugin stoj: remove static buffer
Matthew Fernandez [Fri, 14 Oct 2022 03:48:17 +0000 (20:48 -0700)]
JSON plugin stoj: remove static buffer

This removes some dynamic allocation, as well as making this function now thread
safe. Note that the contained call to `latin1ToUTF8` still allocates.

2 years agoJSON plugin: move printing of escaped string inside 'stoj'
Matthew Fernandez [Fri, 14 Oct 2022 03:28:32 +0000 (20:28 -0700)]
JSON plugin: move printing of escaped string inside 'stoj'

This is preparation for refactoring `stoj` to remove dynamic memory allocation.

2 years agoMerge branch 'fix-issue-372-for-tee-arrows' into 'main'
Magnus Jacobsson [Fri, 4 Nov 2022 18:59:17 +0000 (18:59 +0000)]
Merge branch 'fix-issue-372-for-tee-arrows' into 'main'

Fix issue 372 for tee arrows

Closes #372

See merge request graphviz/graphviz!2929

2 years agoarrows: arrow_length_tee: take edge penwidth into account when calculating length
Magnus Jacobsson [Thu, 6 Oct 2022 10:36:48 +0000 (12:36 +0200)]
arrows: arrow_length_tee: take edge penwidth into account when calculating length

The test_edge_node_overlap_tee_edge_arrow test case now succeeds, so
the expectancy that it should fail is removed.

Towards https://gitlab.com/graphviz/graphviz/-/issues/372.

2 years agoarrows: arrow_type_tee: fix positioning of 'tee' arrow
Magnus Jacobsson [Thu, 6 Oct 2022 09:54:44 +0000 (11:54 +0200)]
arrows: arrow_type_tee: fix positioning of 'tee' arrow

Towards https://gitlab.com/graphviz/graphviz/-/issues/372.

2 years agoadd new test_edge_node_overlap_tee_edge_arrow test
Magnus Jacobsson [Thu, 6 Oct 2022 09:45:01 +0000 (11:45 +0200)]
add new test_edge_node_overlap_tee_edge_arrow test

2 years agotests: SVGElement::outline_bbox: correct handling of polyline endpoints
Magnus Jacobsson [Fri, 7 Oct 2022 06:43:43 +0000 (08:43 +0200)]
tests: SVGElement::outline_bbox: correct handling of polyline endpoints