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

2 years agotests: GraphvizEdge: handle primitive arrow shape 'tee' in arrowtail_outline_bbox
Magnus Jacobsson [Thu, 6 Oct 2022 09:51:02 +0000 (11:51 +0200)]
tests: GraphvizEdge: handle primitive arrow shape 'tee' in arrowtail_outline_bbox

2 years agotests: GraphvizEdge: handle primitive arrow shape 'tee' in arrowhead_outline_bbox
Magnus Jacobsson [Thu, 6 Oct 2022 09:50:53 +0000 (11:50 +0200)]
tests: GraphvizEdge: handle primitive arrow shape 'tee' in arrowhead_outline_bbox

2 years agotests: test_edge_node_overlap_utilities: remove FIXME for 'tee' arrow
Magnus Jacobsson [Thu, 6 Oct 2022 10:40:46 +0000 (12:40 +0200)]
tests: test_edge_node_overlap_utilities: remove FIXME for 'tee' arrow

The existing calculation is correct and the inital assumtion that it
wasn't was incorrect.

2 years agoadd new test_edge_node_overlap_none_edge_arrow test
Magnus Jacobsson [Thu, 6 Oct 2022 09:21:24 +0000 (11:21 +0200)]
add new test_edge_node_overlap_none_edge_arrow test

2 years agotests: test_edge_node_overlap_utilities: handle arrow type 'none'
Magnus Jacobsson [Thu, 6 Oct 2022 09:39:22 +0000 (11:39 +0200)]
tests: test_edge_node_overlap_utilities: handle arrow type 'none'

2 years agoMerge branch 'smattr/b5018897-2296-4d26-889c-41c836851648' into 'main'
Matthew Fernandez [Fri, 4 Nov 2022 05:05:21 +0000 (05:05 +0000)]
Merge branch 'smattr/b5018897-2296-4d26-889c-41c836851648' into 'main'

cdt: compiler warning squashing

See merge request graphviz/graphviz!2932

2 years agocdt: use 'size_t' types for counting stats instead of 'int'
Matthew Fernandez [Thu, 3 Nov 2022 05:02:42 +0000 (22:02 -0700)]
cdt: use 'size_t' types for counting stats instead of 'int'

This squashes two compiler warnings:

  dtstat.c: In function ‘dtstat’:
  dtstat.c:60:59: warning: conversion to ‘long unsigned int’ from ‘int’ may
    change the sign of the result [-Wsign-conversion]
     60 |  if(!(Count = malloc((ds->dt_max+1)*sizeof(int))) )
        |                                    ^
  dtstat.c:74:65: warning: conversion to ‘long unsigned int’ from ‘int’ may
    change the sign of the result [-Wsign-conversion]
     74 |  if(!(Count = malloc((ds->dt_n+1)*sizeof(int))) )
        |                                  ^

It also allows these functions to now count beyond 2³¹ - 1.

2 years agocdt: squash -Wconversion warning
Matthew Fernandez [Thu, 3 Nov 2022 04:41:33 +0000 (21:41 -0700)]
cdt: squash -Wconversion warning

This squashes the warning:

  dtstrhash.c: In function ‘dtstrhash’:
  dtstrhash.c:36:18: warning: conversion to ‘unsigned int’ from ‘int’ may change
    the sign of the result [-Wsign-conversion]
     36 |         return (h+n)*DT_PRIME;
        |                  ^

`n` is guaranteed non-negative by the logic preceding this.

2 years agocdt: squash -Wconversion warning
Matthew Fernandez [Thu, 3 Nov 2022 04:37:56 +0000 (21:37 -0700)]
cdt: squash -Wconversion warning

This squashes the warning:

  dtstrhash.c:23:21: warning: conversion from ‘long int’ to ‘int’ may change
    value [-Wconversion]
     23 |                 n = s - (unsigned char*)args;
        |                     ^

This cast is mostly guaranteed safe by the inability to practically pass a
>INT_MAX length string into this function.

2 years agocdt: make intent to coerce to unsigned clearer in 'dtstrhash'
Matthew Fernandez [Thu, 3 Nov 2022 04:25:47 +0000 (21:25 -0700)]
cdt: make intent to coerce to unsigned clearer in 'dtstrhash'

This squashes some compiler warnings on CentOS 7:

  dtstrhash.c: In function 'dtstrhash':
  dtstrhash.c:22:18: warning: conversion to 'unsigned int' from 'int' may change
    the sign of the result [-Wsign-conversion]
      h = (h + (s[0]<<8) + s[1])*DT_PRIME;
                    ^
  dtstrhash.c:28:18: warning: conversion to 'unsigned int' from 'int' may change
    the sign of the result [-Wsign-conversion]
      h = (h + (s[0]<<8) + s[1])*DT_PRIME;
                    ^
  dtstrhash.c:30:18: warning: conversion to 'unsigned int' from 'int' may change
    the sign of the result [-Wsign-conversion]
      h = (h + (s[0]<<8))*DT_PRIME;

2 years agoMerge branch 'smattr/c45f1bca-907b-4b5e-a821-311edc34490b' into 'main'
Matthew Fernandez [Fri, 4 Nov 2022 02:03:35 +0000 (02:03 +0000)]
Merge branch 'smattr/c45f1bca-907b-4b5e-a821-311edc34490b' into 'main'

smyrna, common: some clean up and warning squashing

See merge request graphviz/graphviz!2931

2 years agosmyrna: avoid inadvertent double promotion in 'renderSelectedNodes'
Matthew Fernandez [Thu, 3 Nov 2022 02:34:57 +0000 (19:34 -0700)]
smyrna: avoid inadvertent double promotion in 'renderSelectedNodes'

Squashes two compiler warnings:

  topviewfuncs.c: In function ‘renderSelectedNodes’:
  topviewfuncs.c:283:41: warning: conversion from ‘double’ to ‘GLfloat’ {aka
    ‘float’} may change value [-Wfloat-conversion]
    283 |             glVertex3f(pos.x,pos.y,pos.z+0.001);
        |                                    ~~~~~^~~~~~
  topviewfuncs.c:285:50: warning: conversion from ‘double’ to ‘float’ may
    change value [-Wfloat-conversion]
    285 |             drawCircle(pos.x,pos.y,nodeSize,pos.z+0.001);
        |                                             ~~~~~^~~~~~

2 years agosmyrna: remove unused parameter from 'showAttrsWidget'
Matthew Fernandez [Thu, 3 Nov 2022 02:30:03 +0000 (19:30 -0700)]
smyrna: remove unused parameter from 'showAttrsWidget'

2 years agosmyrna: remove 'line' shadowing in 'load_attr_list'
Matthew Fernandez [Thu, 3 Nov 2022 02:25:13 +0000 (19:25 -0700)]
smyrna: remove 'line' shadowing in 'load_attr_list'

Squashes a compiler warning:

  gui/frmobjectui.c:580:10: warning: declaration of ‘line’ shadows a global
    declaration [-Wshadow]
    580 |     char line[BUFSIZ];
        |          ^~~~
  In file included from ./smyrnadefs.h:27,
                   from gui/gui.h:13,
                   from gui/frmobjectui.c:15:
  ../../lib/glcomp/glutils.h:25:7: note: shadowed declaration is here
     25 |     } line;
        |       ^~~~

2 years agosmyrna: remove 'line' shadowing in 'load_attributes'
Matthew Fernandez [Thu, 3 Nov 2022 02:23:27 +0000 (19:23 -0700)]
smyrna: remove 'line' shadowing in 'load_attributes'

Squashes a compiler warning:

  gui/gui.c: In function ‘load_attributes’:
  gui/gui.c:45:10: warning: declaration of ‘line’ shadows a global declaration
    [-Wshadow]
     45 |     char line[BUFSIZ];
        |          ^~~~
  In file included from ./smyrnadefs.h:27,
                   from gui/gui.h:13,
                   from gui/gui.c:14:
  ../../lib/glcomp/glutils.h:25:7: note: shadowed declaration is here
     25 |     } line;
        |       ^~~~

2 years agosmyrna: use a more appropriate type for 'ComboValuesCount'
Matthew Fernandez [Thu, 3 Nov 2022 02:20:41 +0000 (19:20 -0700)]
smyrna: use a more appropriate type for 'ComboValuesCount'

Squashes two compiler warnings:

  gui/gui.c:94:96: warning: conversion to ‘size_t’ {aka ‘long unsigned
    int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
     94 |   attr[attrcount].ComboValuesCount - 1,
        |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
  gui/gui.c:95:78: warning: conversion to ‘size_t’ {aka ‘long unsigned
    int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
     95 |   attr[attrcount].ComboValuesCount,
        |   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

2 years agosmyrna: remove unused 'mPropertiesSlot' parameter
Matthew Fernandez [Thu, 3 Nov 2022 02:17:24 +0000 (19:17 -0700)]
smyrna: remove unused 'mPropertiesSlot' parameter

2 years agosquash compiler warnings when building Perl bindings
Matthew Fernandez [Thu, 3 Nov 2022 02:11:43 +0000 (19:11 -0700)]
squash compiler warnings when building Perl bindings

This suppresses the following warnings in generated code:

  gv_perl.cpp: In function ‘int SWIG_Perl_AcquirePtr(SV*, int)’:
  gv_perl.cpp:1130:49: warning: unused parameter ‘sv’ [-Wunused-parameter]
   1130 | SWIG_Perl_AcquirePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, int own) {
        |                                             ~~~~^~
  gv_perl.cpp:1130:57: warning: unused parameter ‘own’ [-Wunused-parameter]
   1130 | SWIG_Perl_AcquirePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, int own) {
        |                                                     ~~~~^~~

2 years agodotgen: remove 'arrow_flags' call whose result is ignored
Matthew Fernandez [Thu, 3 Nov 2022 01:58:36 +0000 (18:58 -0700)]
dotgen: remove 'arrow_flags' call whose result is ignored

2 years agocommon: abbreviate a prefix check
Matthew Fernandez [Thu, 3 Nov 2022 01:56:08 +0000 (18:56 -0700)]
common: abbreviate a prefix check

2 years agocommon remove an unnecessary '|='
Matthew Fernandez [Thu, 3 Nov 2022 01:47:54 +0000 (18:47 -0700)]
common remove an unnecessary '|='

All calls into this function set the `flags` parameter to 0 beforehand.

2 years agocommon: remove unused struct names
Matthew Fernandez [Thu, 3 Nov 2022 01:25:38 +0000 (18:25 -0700)]
common: remove unused struct names

2 years agoMerge branch 'smattr/gitlab-2232-5' into 'main'
Matthew Fernandez [Fri, 4 Nov 2022 00:51:36 +0000 (00:51 +0000)]
Merge branch 'smattr/gitlab-2232-5' into 'main'

fix installing example graphs during CPack; rewrite 'SMYRNA_PATH' discovery

Closes #2232

See merge request graphviz/graphviz!2928

2 years agoCMake: remove duplicate install step of 'zoom.png'
Matthew Fernandez [Tue, 1 Nov 2022 04:55:23 +0000 (21:55 -0700)]
CMake: remove duplicate install step of 'zoom.png'

This caused no harm, but resulted in unnecessary work:

  -- Installing: /tmp/tmp.YkhgwZacNd/share/graphviz/smyrna/zoom.png
  -- Up-to-date: /tmp/tmp.YkhgwZacNd/share/graphviz/smyrna/zoom.png

2 years agofix installing example graphs during CPack; rewrite 'SMYRNA_PATH' discovery
Matthew Fernandez [Tue, 1 Nov 2022 03:26:33 +0000 (20:26 -0700)]
fix installing example graphs during CPack; rewrite 'SMYRNA_PATH' discovery

This is effectively two commits in one. But there seems to be no way to separate
these changes without the parts individually failing
tests/test_tools.py::test_tools[smyrna]. Smyrna auxiliary files were being
installed incorrectly prior to this commit, so installing them correctly and
fixing how Smyrna finds them needs to be done in a single change.

---

CMake: fix installing example graphs during CPack

When running `cpack`, instead of staging the Smyrna auxiliary files (share/**)
and the example graphs (graphs/**) in build-local directories, they would be
incorrectly staged into their final install paths. This was quite unexpected as
it would result in errors if you did not have permission to write to the install
directories or deleting+replacing files from a previous Graphviz installation if
you did.

This bug was introduced in 67f88eb86c9966daa4d8c3a6f25aee8cd35a046d as an
accidental side effect of enabling Smyrna in the CMake build system. A close
re-reading of the CPack¹ and `GNUInstallDirs`² docs suggests that absolute paths
should never be used in `install` rules:

  `CMAKE_INSTALL_<dir>`
    Destination for files of a given type. This value may be passed to the
    `DESTINATION` options of `install()` commands for the corresponding file
    type. It should typically be a path relative to the installation prefix so
    that it can be converted to an absolute path in a relocatable way (see
    `CMAKE_INSTALL_FULL_<dir>`). However, an absolute path is also allowed.

  `CMAKE_INSTALL_FULL_<dir>`
    The absolute path generated from the corresponding `CMAKE_INSTALL_<dir>`
    value. If the value is not already an absolute path, an absolute path is
    constructed typically by prepending the value of the `CMAKE_INSTALL_PREFIX`
    variable. However, there are some special cases as documented below.

This change brings the behavior on Linux in line with how CPack operates on
other platforms – the default value of `CMAKE_INSTALL_DATAROOTDIR` is `share`
which is the hard coded value set on non-Linux platforms.

----

smyrna: rewrite 'SMYRNA_PATH' discovery

This aligns Smyrna on other platforms with how Smyrna on Windows locates its
templates, examples etc. This resolves a problem where a build time path was
being baked into the Smyrna binary, preventing it from being relocatable.

The code for locating our own executable in this commit is adapted from public
domain source.³

This commit also lifts the 1024 character limit on path discovery in the Windows
branch of this logic. It now dynamically expands the target buffer until the
current executable name will fit.

Gitlab: fixes #2232
Reported-by: Magnus Jacobsson <magnus.jacobsson@berotec.se>
¹ https://cmake.org/cmake/help/book/mastering-cmake/chapter/Packaging%20With%20CPack.html
² https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
³ https://github.com/Smattr/clink/blob/main/clink/src/find_me.c as of commit
  8cadfc49a74e429fa69afdc460cb2b0662d81260

2 years agosmyrna: remove unnecessary symbol lookup on Windows
Matthew Fernandez [Wed, 2 Nov 2022 01:27:08 +0000 (18:27 -0700)]
smyrna: remove unnecessary symbol lookup on Windows

The `GetModuleFileName` API accepts a null pointer as the first argument to mean
the current executable.

2 years agoMerge branch 'smattr/gitlab-2277' into 'main'
Matthew Fernandez [Thu, 3 Nov 2022 16:33:05 +0000 (16:33 +0000)]
Merge branch 'smattr/gitlab-2277' into 'main'

support SWIG 4.1.0 in the Autotools build system

Closes #2303 and #2277

See merge request graphviz/graphviz!2927

2 years agoremove unused 'LUA_VERSION' variable
Matthew Fernandez [Sat, 29 Oct 2022 22:28:15 +0000 (15:28 -0700)]
remove unused 'LUA_VERSION' variable

This was unused in its introduction in 8af1e15fc76eb51b82034bce25f94e150789b5a8
and has never been used since either.

2 years agouse newly acquired 'AX_COMPARE_VERSION' to simplify some version checks
Matthew Fernandez [Sat, 29 Oct 2022 21:58:09 +0000 (14:58 -0700)]
use newly acquired 'AX_COMPARE_VERSION' to simplify some version checks

2 years agoignore files generated by libtool
Matthew Fernandez [Sat, 29 Oct 2022 21:26:50 +0000 (14:26 -0700)]
ignore files generated by libtool

2 years agosupport SWIG 4.1.0 in the Autotools build system
Matthew Fernandez [Sat, 29 Oct 2022 21:15:39 +0000 (14:15 -0700)]
support SWIG 4.1.0 in the Autotools build system

Gitlab: closes #2277, closes #2303

2 years agoadd a way to compare version numbers in the Autotools build system
Matthew Fernandez [Sat, 29 Oct 2022 21:12:52 +0000 (14:12 -0700)]
add a way to compare version numbers in the Autotools build system

This file is imported from the Autoconf archive¹ as of commit
da89908ef7d82a90fe5dab8904a65869b5a5d996.

¹ https://git.savannah.gnu.org/git/autoconf-archive.git

2 years agoMerge branch 'smattr/398c5969-bfd5-4a12-9d47-f75fb8b17479' into 'main'
Matthew Fernandez [Thu, 3 Nov 2022 15:34:10 +0000 (15:34 +0000)]
Merge branch 'smattr/398c5969-bfd5-4a12-9d47-f75fb8b17479' into 'main'

tests: only accept 'which' results that are adjacent to 'dot'

Closes #2201

See merge request graphviz/graphviz!2926

2 years agotests: only accept 'which' results that are adjacent to 'dot'
Matthew Fernandez [Sat, 29 Oct 2022 15:40:26 +0000 (08:40 -0700)]
tests: only accept 'which' results that are adjacent to 'dot'

As described in the code comment, this addresses a problem where testing would
find binaries from a prior Graphviz installation and then spuriously fail.

This is not ideal. It is easy for an upcoming test writer to forget or be
unaware of this quirk and introduce a new direct call to `shutil.which`. But it
seems the best option we have right now.

Gitlab: closes #2201

2 years agoMerge branch 'reduce-required-approvals-for-maintainers-merge-reguests' into 'main'
Magnus Jacobsson [Thu, 3 Nov 2022 06:53:20 +0000 (06:53 +0000)]
Merge branch 'reduce-required-approvals-for-maintainers-merge-reguests' into 'main'

CONTRIBUTING.md: allow the maintainers' MRs to be merged with only one approval

See merge request graphviz/graphviz!2930

2 years agoCONTRIBUTING.md: allow the maintainers' MRs to be merged with only one approval
Magnus Jacobsson [Wed, 2 Nov 2022 21:27:48 +0000 (22:27 +0100)]
CONTRIBUTING.md: allow the maintainers' MRs to be merged with only one approval

2 years agoMerge branch 'smattr/9498a05d-a496-4c20-8f25-324b045f0651' into 'main'
Matthew Fernandez [Thu, 3 Nov 2022 04:43:00 +0000 (04:43 +0000)]
Merge branch 'smattr/9498a05d-a496-4c20-8f25-324b045f0651' into 'main'

DEVELOPERS.md: fill in basic 'perf' starter

See merge request graphviz/graphviz!2922

2 years agoDEVELOPERS.md: fill in basic 'perf' starter
Matthew Fernandez [Sat, 22 Oct 2022 02:08:47 +0000 (19:08 -0700)]
DEVELOPERS.md: fill in basic 'perf' starter

2 years agoMerge branch 'smattr/902f6d98-cc06-4200-be35-4b5334490394' into 'main'
Matthew Fernandez [Thu, 3 Nov 2022 01:33:17 +0000 (01:33 +0000)]
Merge branch 'smattr/902f6d98-cc06-4200-be35-4b5334490394' into 'main'

cgraph strview_str_contains: abbreviate prefix check

See merge request graphviz/graphviz!2918

2 years agocgraph strview_str_contains: abbreviate prefix check
Matthew Fernandez [Sat, 15 Oct 2022 21:25:22 +0000 (14:25 -0700)]
cgraph strview_str_contains: abbreviate prefix check

After this function was written, the `startswith` helper was introduced for
abbreviating the idiom `strncmp(foo, bar, strlen(bar)) == 0`. We can use it to
more concisely and clearly express the intent of this code.

2 years agoMerge branch 'smattr/721d9c7f-df4c-4fda-9c4e-f961c95d0dd9' into 'main'
Matthew Fernandez [Wed, 2 Nov 2022 16:28:54 +0000 (16:28 +0000)]
Merge branch 'smattr/721d9c7f-df4c-4fda-9c4e-f961c95d0dd9' into 'main'

CI: remove '--version' option from deploy script

See merge request graphviz/graphviz!2921

2 years agoCI: remove '--version' option from deploy script
Matthew Fernandez [Sat, 22 Oct 2022 00:19:47 +0000 (17:19 -0700)]
CI: remove '--version' option from deploy script

Since it was introduced, this option has not been needed. This change removes it
to streamline and simplify this script.