]> granicus.if.org Git - graphviz/log
graphviz
2 years agoMove `html_DATA` -> `dist_html_DATA`
David Seifert [Mon, 2 May 2022 20:30:58 +0000 (22:30 +0200)]
Move `html_DATA` -> `dist_html_DATA`

2 years agoMove unconditional `man_MANS` -> `dist_man_MANS`
David Seifert [Mon, 2 May 2022 20:30:58 +0000 (22:30 +0200)]
Move unconditional `man_MANS` -> `dist_man_MANS`

* Avoids the repetition in `EXTRA_DIST`, and is the recommended
  Automake pattern.
* Some `man_MANS` will have to remain, since Automake has a bug
  where `dist_man_MANS` in Automake branches do not get included
  in the tarball:
    https://lists.gnu.org/archive/html/bug-automake/2008-06/msg00019.html

2 years agoMerge branch 'smattr/C84BAA48-355C-42CA-9E67-B89D004FB871' into 'main'
Matthew Fernandez [Mon, 2 May 2022 17:50:19 +0000 (17:50 +0000)]
Merge branch 'smattr/C84BAA48-355C-42CA-9E67-B89D004FB871' into 'main'

remove Awk build dependency

Closes #2118

See merge request graphviz/graphviz!2644

2 years agoadd changelog entry for Awk dependency removal
Matthew Fernandez [Mon, 11 Apr 2022 02:57:47 +0000 (19:57 -0700)]
add changelog entry for Awk dependency removal

Gitlab: closes #2118

2 years agoWindows: remove Awk setup
Matthew Fernandez [Mon, 11 Apr 2022 02:47:50 +0000 (19:47 -0700)]
Windows: remove Awk setup

Awk is no longer used by any of the build systems in use on Windows.

Gitlab: #2118

2 years agoCMake: remove required Awk detection
Matthew Fernandez [Mon, 11 Apr 2022 02:47:06 +0000 (19:47 -0700)]
CMake: remove required Awk detection

Awk is no longer used in the CMake build system.

Gitab: #2118

2 years agoAutotools: remove required Awk detection
Matthew Fernandez [Mon, 11 Apr 2022 02:46:00 +0000 (19:46 -0700)]
Autotools: remove required Awk detection

Awk is no longer used in the Autotools build system.

Gitlab: #2118

2 years agoport colortbl.h generation script to Python
Matthew Fernandez [Mon, 11 Apr 2022 02:43:04 +0000 (19:43 -0700)]
port colortbl.h generation script to Python

Note that this does not introduce an extra build dependency in any of the three
build systems:

  1. Autotools: these steps are done during construction of the portable source
     tarball, during which Python 3 is already required (see autogen.sh).

  2. CMake: Python 3 is already required by and used in the top level
     CMakeLists.txt.

  3. MS Build: Python 3 is already used in version generation in
     lib/version/version.vcxproj.

This change is motivated by the goal of removing a dependency on Awk. This
commit removes the last remaining Awk usage in all three build systems, as well
as removing dependencies on `type` and `sort` in the MS Build build system.

This commit removes the generation of the intermediate artifacts color_lib,
color_lib-sort, and color_lib-temp. Instead, we generate only the final
artifact, colortbl.h. This consolidation of logic into Python is part of what
allows the removal of dependencies described above.

Gitlab: #2118

2 years agoport brewer_lib generation script to Python
Matthew Fernandez [Mon, 11 Apr 2022 00:44:19 +0000 (17:44 -0700)]
port brewer_lib generation script to Python

Note that this does not introduce an extra build dependency in any of the three
build systems:

  1. Autotools: these steps are done during construction of the portable source
     tarball, during which Python 3 is already required (see autogen.sh).

  2. CMake: Python 3 is already required by and used in the top level
     CMakeLists.txt.

  3. MS Build: Python 3 is already used in version generation in
     lib/version/version.vcxproj.

This change is motivated by the goal of removing a dependency on Awk.

Gitlab: #2118

2 years agoport svgcolor_lib generation script to Python
Matthew Fernandez [Sun, 10 Apr 2022 21:07:36 +0000 (14:07 -0700)]
port svgcolor_lib generation script to Python

Note that this does not introduce an extra build dependency in any of the three
build systems:

  1. Autotools: these steps are done during construction of the portable source
     tarball, during which Python 3 is already required (see autogen.sh).

  2. CMake: Python 3 is already required by and used in the top level
     CMakeLists.txt.

  3. MS Build: Python 3 is already used in version generation in
     lib/version/version.vcxproj.

This change is motivated by the goal of removing a dependency on Awk. Though it
also conveniently side steps some line ending portability issues that were being
worked around with `AWK_OPTIONS`. In Python, this is unnecessary because reading
a file in text mode accounts for both flavors of line endings.

Gitlab: #2118

2 years agofix missing distclean of 'svgcolor_lib'
Matthew Fernandez [Sun, 10 Apr 2022 20:37:53 +0000 (13:37 -0700)]
fix missing distclean of 'svgcolor_lib'

This is a generated file that appears intended to be treated like `brewer_lib`
and `color_lib`.

2 years agoMerge branch 'smattr/257B56CE-F640-40F2-9EB7-43E72C4B95B3' into 'main'
Matthew Fernandez [Mon, 2 May 2022 02:02:48 +0000 (02:02 +0000)]
Merge branch 'smattr/257B56CE-F640-40F2-9EB7-43E72C4B95B3' into 'main'

cgraph, glcomp: minor clean up

See merge request graphviz/graphviz!2643

2 years agoglcomp: abbreviate 'GLfloat' literals
Matthew Fernandez [Sat, 30 Apr 2022 02:07:44 +0000 (19:07 -0700)]
glcomp: abbreviate 'GLfloat' literals

The `GLfloat` type is a 32-bit IEEE-754 floating point value¹ which is identical
to what the C `float` type provides on all supported platforms.

¹ https://www.khronos.org/opengl/wiki/OpenGL_Type

2 years agoglcomp: inline and remove 'copy_glcomp_color'
Matthew Fernandez [Sat, 30 Apr 2022 02:02:50 +0000 (19:02 -0700)]
glcomp: inline and remove 'copy_glcomp_color'

The C compiler knows how to copy a struct without needing it spelled out
member-by-member.

2 years agoglcomp: remove unused 'glCompColor.test'
Matthew Fernandez [Sat, 30 Apr 2022 02:01:13 +0000 (19:01 -0700)]
glcomp: remove unused 'glCompColor.test'

2 years agoglcomp: remove unused 'glCompColor.tag'
Matthew Fernandez [Sat, 30 Apr 2022 02:00:53 +0000 (19:00 -0700)]
glcomp: remove unused 'glCompColor.tag'

2 years agocgraph: remove prototype of unimplemented 'agrebind0'
Matthew Fernandez [Sat, 30 Apr 2022 01:27:23 +0000 (18:27 -0700)]
cgraph: remove prototype of unimplemented 'agrebind0'

This was added in the first commit, but apparently was never implemented.

2 years agoMerge branch 'smattr/ADD4EDF2-0C76-420E-B9BA-BA3D82E4A083' into 'main'
Matthew Fernandez [Mon, 2 May 2022 00:38:44 +0000 (00:38 +0000)]
Merge branch 'smattr/ADD4EDF2-0C76-420E-B9BA-BA3D82E4A083' into 'main'

remove unused 'updatePM'

See merge request graphviz/graphviz!2642

2 years agoremove unused 'updatePM'
Matthew Fernandez [Tue, 26 Apr 2022 14:47:32 +0000 (07:47 -0700)]
remove unused 'updatePM'

The last use of this was removed in 4d12d3f0826198aad637a5ee4d9c1eff21952019.

2 years agoMerge branch 'smattr/5F69683D-065F-4437-AA93-AF01343A36D7' into 'main'
Matthew Fernandez [Sun, 1 May 2022 14:35:04 +0000 (14:35 +0000)]
Merge branch 'smattr/5F69683D-065F-4437-AA93-AF01343A36D7' into 'main'

gvmap: replace unchecked allocations with cgraph alloc wrappers

See merge request graphviz/graphviz!2637

2 years agogvmap: replace unchecked allocations with cgraph alloc wrappers
Matthew Fernandez [Sat, 9 Apr 2022 18:05:41 +0000 (11:05 -0700)]
gvmap: replace unchecked allocations with cgraph alloc wrappers

These turn messy crashes into more graceful exits.

2 years agogvmap: remove unused 'plot_label'
Matthew Fernandez [Sat, 9 Apr 2022 17:48:20 +0000 (10:48 -0700)]
gvmap: remove unused 'plot_label'

2 years agogvmap: remove unused 'bg_color'
Matthew Fernandez [Sat, 9 Apr 2022 17:47:22 +0000 (10:47 -0700)]
gvmap: remove unused 'bg_color'

2 years agosparse: unconditionally include 'graphviz_exit' from cgraph
Matthew Fernandez [Sat, 9 Apr 2022 19:31:35 +0000 (12:31 -0700)]
sparse: unconditionally include 'graphviz_exit' from cgraph

This fixes a problem encountered in an upcoming commit, that other code cannot
include both this header and cgraph/exit.h if it is building in standalone mode.
cgraph/exit.h is header-only, so should be fine to use even in standalone mode.

2 years agoMerge branch 'smattr/E41729D4-C252-4B87-8C6F-E3326A52D927' into 'main'
Matthew Fernandez [Sun, 1 May 2022 04:37:29 +0000 (04:37 +0000)]
Merge branch 'smattr/E41729D4-C252-4B87-8C6F-E3326A52D927' into 'main'

CI: add Ubuntu 22.04 as a tested platform

Closes #2234

See merge request graphviz/graphviz!2636

2 years agoCI: add Ubuntu 22.04 as a tested platform
Matthew Fernandez [Fri, 22 Apr 2022 00:19:18 +0000 (17:19 -0700)]
CI: add Ubuntu 22.04 as a tested platform

We should perhaps consider migrating the more unusual variants like the ASan
jobs to Ubuntu 22.04 too in future.

Github: closes #2234

2 years agoLASi plugin: support newer Pango font variants
Matthew Fernandez [Tue, 26 Apr 2022 00:11:27 +0000 (17:11 -0700)]
LASi plugin: support newer Pango font variants

Similar to 89edf3fe0ac0378b7d1297a0ca349a15bade3980, this introduces support for
newer versions of Pango. Without this, strict compilation with -Werror in the
CMake build fails when building against Pango ≥ 1.50. The only LASi font
variants are `NORMAL_VARIANT` and `SMALLCAPS`, so mapping Pango to LASi
equivalents is limited to being a coarse-grained lossy conversion.

Github: #2234

2 years agoinstead of using 'LIBPOSTFIX' heuristics, ask the OCaml compiler where it lives
Matthew Fernandez [Mon, 25 Apr 2022 02:37:52 +0000 (19:37 -0700)]
instead of using 'LIBPOSTFIX' heuristics, ask the OCaml compiler where it lives

This is a more portable way of locating OCaml directories for the OCaml
bindings. This resolves some issues encountered when porting to Ubuntu 22.04.

Gitlab: #2234

2 years agoMerge branch 'smattr/28C4C5DE-C6BC-4998-A29C-6677AE8C267E' into 'main'
Matthew Fernandez [Sun, 1 May 2022 01:45:23 +0000 (01:45 +0000)]
Merge branch 'smattr/28C4C5DE-C6BC-4998-A29C-6677AE8C267E' into 'main'

mm2gv: some trivial clean up

See merge request graphviz/graphviz!2635

2 years agomm2gv: remove open coded NULL
Matthew Fernandez [Fri, 8 Apr 2022 02:26:34 +0000 (19:26 -0700)]
mm2gv: remove open coded NULL

2 years agomm2gv: remove unnecessary cast
Matthew Fernandez [Fri, 8 Apr 2022 02:26:24 +0000 (19:26 -0700)]
mm2gv: remove unnecessary cast

2 years agomm2gv: remove unnecessary parens
Matthew Fernandez [Fri, 8 Apr 2022 02:26:12 +0000 (19:26 -0700)]
mm2gv: remove unnecessary parens

2 years agoMerge branch 'smattr/12BC1FB5-DA85-4A0A-AE5A-7A20033F8C05' into 'main'
Matthew Fernandez [Fri, 29 Apr 2022 01:20:38 +0000 (01:20 +0000)]
Merge branch 'smattr/12BC1FB5-DA85-4A0A-AE5A-7A20033F8C05' into 'main'

remove stat.h detection and juggling

See merge request graphviz/graphviz!2630

2 years agosfio: remove 'SF_MTSAFE'
Matthew Fernandez [Mon, 25 Apr 2022 04:30:44 +0000 (21:30 -0700)]
sfio: remove 'SF_MTSAFE'

This constant was performing two overlapping roles:

  1. A flag callers could use to indicate they anticipated calling into sfio
     functions with the same object from multiple threads.

  2. A flag used by the library itself to indicate whether thread-safety was
     available.

To deal with both macros having the same name, sfhdr.h was forcing the value
seen internally to zero. This mechanism has numerous shortcomings:

  1. It was possible for a caller to use the external value of `SF_MTSAFE`
     (010000) that, thanks to the overriding described above, sfio itself would
     fail to understand.

  2. Including sfio.h within sfio sources without including sfhdr.h was a latent
     foot gun that would result in part of sfio believing the `SF_MTSAFE` flag
     _did_ have meaning.

  3. sfio functions are not thread-safe, with or without `SF_MTSAFE` defined,
     and regardless of what value it has.

To take an example to illustrate 3, `sfopen` does something like double-checked
locking¹ to anticipate another thread modifying `f` in-between its first check
and the point at which it calls `SFMTXSTART`. Except `SFMTXSTART` is not a lock.
There is no synchronization point here, and in fact an optimizing compiler will
simply coalesce both the first and second checks into one. It is not clear to me
whether this code was written when multicore machines were uncommon (though this
design is also unsafe on a unicore machine) or if `SFMTXSTART` is some kind of
placeholder that was meant to one day grow a locking mechanism.

It seems safer and more honest to remove this constant, and with it the
implication that thread-safety is toggle-able. Migrating to C stdio (#1998) will
render all of this moot as it is thread-safe by default.

¹ https://en.wikipedia.org/wiki/Double-checked_locking

2 years agosfio: remove unused 'S_ISFIFO'
Matthew Fernandez [Mon, 25 Apr 2022 04:17:20 +0000 (21:17 -0700)]
sfio: remove unused 'S_ISFIFO'

This has seemingly never been used.

Github: #1998

2 years agosfio: remove 'fstat' prototype
Matthew Fernandez [Mon, 25 Apr 2022 04:14:41 +0000 (21:14 -0700)]
sfio: remove 'fstat' prototype

The guard on this prototype appears back to front. If `HAVE_SYS_STAT_H` is true,
we already have a prototype of this function _in_ sys/stat.h.

2 years agoremove stat.h detection and juggling
Matthew Fernandez [Sun, 24 Apr 2022 16:00:16 +0000 (09:00 -0700)]
remove stat.h detection and juggling

I do not know which platforms offer stat.h, but it does not appear to be
anything Graphviz currently supports. On all currently supported platforms (even
Windows) this file lives at sys/stat.h which is detected separately.

2 years agosfio: fix misuse of 'HAVE_SYS_STAT_H'
Matthew Fernandez [Mon, 25 Apr 2022 04:09:02 +0000 (21:09 -0700)]
sfio: fix misuse of 'HAVE_SYS_STAT_H'

When sys/stat.h is unavailable, `HAVE_SYS_STAT_H` is not `0`. It is undefined,
which was leading to a malformed expression here. This was exposed by the next
commit.

2 years agoMerge branch 'smattr/D02F76A1-BD16-4E4D-801E-943D629C9505' into 'main'
Matthew Fernandez [Thu, 28 Apr 2022 15:54:45 +0000 (15:54 +0000)]
Merge branch 'smattr/D02F76A1-BD16-4E4D-801E-943D629C9505' into 'main'

replace various SFIO to stderr with C stdio

See merge request graphviz/graphviz!2631

2 years agoreplace various SFIO to stderr with C stdio
Matthew Fernandez [Mon, 25 Apr 2022 00:16:12 +0000 (17:16 -0700)]
replace various SFIO to stderr with C stdio

While it is technically possible to replace the `sfstderr` stream with something
other than stderr or use an SFIO-specific format specifier (e.g. `%!`), nothing
in Graphviz permits this. Thus we know all these instances are actually just
doing basic output to stderr. By replacing them with C stdio, they are more
transparent to the compiler and can be implemented more efficiently.

Gitlab: #1998

2 years agoMerge branch 'smattr/A6A8CDBD-0D7F-40AF-BADB-8AEC1DCCF2EF' into 'main'
Matthew Fernandez [Thu, 28 Apr 2022 06:11:48 +0000 (06:11 +0000)]
Merge branch 'smattr/A6A8CDBD-0D7F-40AF-BADB-8AEC1DCCF2EF' into 'main'

gvpr: replace use of alternative stack implementation with Graphviz generic one

See merge request graphviz/graphviz!2639

2 years agogvpr: replace use of alternative stack implementation with Graphviz generic one
Matthew Fernandez [Mon, 25 Apr 2022 14:59:01 +0000 (07:59 -0700)]
gvpr: replace use of alternative stack implementation with Graphviz generic one

Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation. This also adds checks for allocation failures that were
previously missing.

Gitlab: #1793

2 years agoMerge branch 'smattr/B59EB35A-0770-4D5F-9E65-123D103FD69B' into 'main'
Matthew Fernandez [Thu, 28 Apr 2022 04:39:43 +0000 (04:39 +0000)]
Merge branch 'smattr/B59EB35A-0770-4D5F-9E65-123D103FD69B' into 'main'

cgraph: remove 'itos'

Closes #2229

See merge request graphviz/graphviz!2640

2 years agocgraph: remove 'itos'
Matthew Fernandez [Tue, 26 Apr 2022 05:07:52 +0000 (22:07 -0700)]
cgraph: remove 'itos'

This function was unsafe to use in the way described. It relied on semantics
that are not guaranteed under C99. That is, the lifetime extension of a struct
member of an rvalue. This changes under C11 to something that would make this
not problematic. But it is unlikely Graphviz will be able to migrate to C11 in
the foreseeable future as MSVC is lacking C11 support.

Gitlab: closes #2229

2 years agosparse: fix: avoid a use of 'itos'
Matthew Fernandez [Tue, 26 Apr 2022 05:05:18 +0000 (22:05 -0700)]
sparse: fix: avoid a use of 'itos'

Usage of `itos` in this way relies on lifetime extension of a struct member in
an rvalue. While these semantics exist in C11 and C++, they do not in C99. As a
result, this causes undefined behavior.

This commit effectively reverts 10638c445d1f12bb3fcd0c45946ec8a2e3af60af.

Gitlab: #2229

2 years agocommon: fix: avoid a use of 'itos'
Matthew Fernandez [Mon, 25 Apr 2022 15:12:01 +0000 (08:12 -0700)]
common: fix: avoid a use of 'itos'

Usage of `itos` in this way relies on lifetime extension of a struct member in
an rvalue. While these semantics exist in C11 and C++, they do not in C99. As a
result, this causes undefined behavior.

This commit effectively reverts 400a29f0dbc39682f98eff999bcd32448e328450.

Gitlab: #2229

2 years agoMerge branch 'smattr/0E2CB714-5EBC-4EA4-B2EA-402E31133427' into 'main'
Matthew Fernandez [Thu, 28 Apr 2022 03:14:28 +0000 (03:14 +0000)]
Merge branch 'smattr/0E2CB714-5EBC-4EA4-B2EA-402E31133427' into 'main'

gvedit: minor cleanup

See merge request graphviz/graphviz!2634

2 years agogvedit: avoid the need to cast arguments to 'errorPipe'
Matthew Fernandez [Sat, 9 Apr 2022 17:39:13 +0000 (10:39 -0700)]
gvedit: avoid the need to cast arguments to 'errorPipe'

2 years agogvedit: remove unnecessary 'QString' construction
Matthew Fernandez [Sat, 9 Apr 2022 17:37:55 +0000 (10:37 -0700)]
gvedit: remove unnecessary 'QString' construction

`QString::operator==` has an overload that takes `const char*`.

2 years agogvedit: remove unnecessary parens
Matthew Fernandez [Sat, 9 Apr 2022 17:37:20 +0000 (10:37 -0700)]
gvedit: remove unnecessary parens

2 years agogvedit: standardize on more modern 'nullptr'
Matthew Fernandez [Sat, 9 Apr 2022 17:22:45 +0000 (10:22 -0700)]
gvedit: standardize on more modern 'nullptr'

2 years agogvedit: remove unnecessary casts when calling Graphviz’ own functions
Matthew Fernandez [Sat, 9 Apr 2022 17:19:31 +0000 (10:19 -0700)]
gvedit: remove unnecessary casts when calling Graphviz’ own functions

2 years agogvedit: use a 'unique_ptr' to avoid manually managing 'previewFrm'
Matthew Fernandez [Sat, 9 Apr 2022 17:12:56 +0000 (10:12 -0700)]
gvedit: use a 'unique_ptr' to avoid manually managing 'previewFrm'

2 years agoMerge branch 'smattr/AC0D09C8-AC89-46D5-AB9A-796C8CF8D9F9' into 'main'
Matthew Fernandez [Thu, 28 Apr 2022 01:35:51 +0000 (01:35 +0000)]
Merge branch 'smattr/AC0D09C8-AC89-46D5-AB9A-796C8CF8D9F9' into 'main'

cgraph: some minor cleanup

See merge request graphviz/graphviz!2633

2 years agocgraph: remove some unused struct names
Matthew Fernandez [Thu, 21 Apr 2022 15:13:35 +0000 (08:13 -0700)]
cgraph: remove some unused struct names

2 years agocgraph: use a C99 bool for 'maybe_num'
Matthew Fernandez [Thu, 21 Apr 2022 15:00:01 +0000 (08:00 -0700)]
cgraph: use a C99 bool for 'maybe_num'

This makes it slightly clearer what the intent and usage of this variable is.

2 years agocgraph: inline and remove 'ISALNUM'
Matthew Fernandez [Thu, 21 Apr 2022 14:57:50 +0000 (07:57 -0700)]
cgraph: inline and remove 'ISALNUM'

It does not seem worth maintaining this abstraction for a single usage.
Especially when the surrounding code directly calls numerous other ctype.h
functions.

2 years agocgraph: realign 'agmapnametoid' parameter name with its definition
Matthew Fernandez [Thu, 21 Apr 2022 14:51:36 +0000 (07:51 -0700)]
cgraph: realign 'agmapnametoid' parameter name with its definition

The definition of this function calls the last parameter `createflag`, not
`allocflag`.

2 years agoMerge branch 'cdt-doc' into 'main'
Matthew Fernandez [Wed, 27 Apr 2022 00:02:16 +0000 (00:02 +0000)]
Merge branch 'cdt-doc' into 'main'

doxygen comment in cdt.h

See merge request graphviz/graphviz!2641

2 years agodoxygen comment for Dtoset etc
Costa Shulyupin [Tue, 26 Apr 2022 16:42:26 +0000 (19:42 +0300)]
doxygen comment for Dtoset etc

Text of comments is copied from DT_SET etc

2 years agodoxygen comment for cdt.h
Costa Shulyupin [Tue, 26 Apr 2022 16:34:59 +0000 (19:34 +0300)]
doxygen comment for cdt.h

2 years agodoxygen comment for lib/cdt
Costa Shulyupin [Tue, 26 Apr 2022 16:33:37 +0000 (19:33 +0300)]
doxygen comment for lib/cdt

2 years agoMerge branch 'pq' into 'main'
Matthew Fernandez [Tue, 26 Apr 2022 00:04:11 +0000 (00:04 +0000)]
Merge branch 'pq' into 'main'

upgragde lib/ortho/fPQ.h comment to doxygen style

See merge request graphviz/graphviz!2632

2 years agoupgragde lib/ortho/fPQ.h comment to doxygen style
Costa Shulyupin [Mon, 25 Apr 2022 04:32:10 +0000 (07:32 +0300)]
upgragde lib/ortho/fPQ.h comment to doxygen style

2 years agoMerge branch 'smattr/9F31BC78-A50E-4AD8-8640-72058C3795C4' into 'main'
Matthew Fernandez [Mon, 25 Apr 2022 05:21:10 +0000 (05:21 +0000)]
Merge branch 'smattr/9F31BC78-A50E-4AD8-8640-72058C3795C4' into 'main'

remove unused glyphwidth.ps

See merge request graphviz/graphviz!2619

2 years agoremove unused glyphwidth.ps
Matthew Fernandez [Wed, 20 Apr 2022 01:26:40 +0000 (18:26 -0700)]
remove unused glyphwidth.ps

2 years agoMerge branch 'smattr/83F37629-35B5-4AEA-AC37-EE8EBF5E6D7A' into 'main'
Matthew Fernandez [Mon, 25 Apr 2022 03:54:40 +0000 (03:54 +0000)]
Merge branch 'smattr/83F37629-35B5-4AEA-AC37-EE8EBF5E6D7A' into 'main'

move gvpack into C++

See merge request graphviz/graphviz!2618

2 years agogvpack: use C++ style of indicating unused parameters
Matthew Fernandez [Mon, 18 Apr 2022 14:46:04 +0000 (07:46 -0700)]
gvpack: use C++ style of indicating unused parameters

2 years agogvpack: use C++ casts instead of C casts
Matthew Fernandez [Mon, 18 Apr 2022 14:45:52 +0000 (07:45 -0700)]
gvpack: use C++ casts instead of C casts

2 years agogvpack: use C++ 'nullptr' in preference to C 'NULL'
Matthew Fernandez [Mon, 18 Apr 2022 14:41:13 +0000 (07:41 -0700)]
gvpack: use C++ 'nullptr' in preference to C 'NULL'

2 years agogvpack: use 'std::string' to simplify dynamic string construction
Matthew Fernandez [Sun, 17 Apr 2022 21:43:18 +0000 (14:43 -0700)]
gvpack: use 'std::string' to simplify dynamic string construction

2 years agogvpack: manage graph collection as a 'std::vector'
Matthew Fernandez [Sat, 16 Apr 2022 04:18:58 +0000 (21:18 -0700)]
gvpack: manage graph collection as a 'std::vector'

This removes a number of manual allocations as well as awkward passing of the
base pointer and size of this array around. We also drop the `nGraphs` hint, as
it is simpler and more optimal to let `std::vector`’s standard allocation
algorithm handle this.

2 years agogvpack: track graph counts as a 'size_t'
Matthew Fernandez [Sat, 16 Apr 2022 04:16:29 +0000 (21:16 -0700)]
gvpack: track graph counts as a 'size_t'

This will ease an upcoming change to switching the graph collection to be a
`std::vector` instead of a raw C array.

2 years agogvpack: convert C stdio to C++ iostreams
Matthew Fernandez [Sun, 17 Apr 2022 04:27:51 +0000 (21:27 -0700)]
gvpack: convert C stdio to C++ iostreams

Gitlab: #2154

2 years agogvpack: remove unnecessary guard in 'readGraphs'
Matthew Fernandez [Sat, 16 Apr 2022 04:09:45 +0000 (21:09 -0700)]
gvpack: remove unnecessary guard in 'readGraphs'

This function is only ever called with a non-null 'cp'.

2 years agogvpack: rewrite 'xName' to return a 'std::string'
Matthew Fernandez [Sat, 16 Apr 2022 04:04:52 +0000 (21:04 -0700)]
gvpack: rewrite 'xName' to return a 'std::string'

This removes some manual memory management leaving an easier to read function,
as well as removing a static unfreed buffer that impedes Valgrind and ASan.

2 years agogvpack: manage 'G_args' as a 'std::vector'
Matthew Fernandez [Fri, 15 Apr 2022 04:51:40 +0000 (21:51 -0700)]
gvpack: manage 'G_args' as a 'std::vector'

Simplifies the surrounding code and make it less error prone.

2 years agogvpack: remove '__cplusplus' guards
Matthew Fernandez [Fri, 15 Apr 2022 04:47:23 +0000 (21:47 -0700)]
gvpack: remove '__cplusplus' guards

Now that this code has made the C→C++ transition, we can drop the conditionals
around this linkage specification.

2 years agogvpack: drop stdbool.h #include
Matthew Fernandez [Fri, 15 Apr 2022 04:46:07 +0000 (21:46 -0700)]
gvpack: drop stdbool.h #include

`bool` is a built-in type in C++.

2 years agomove 'gvpack' into C++
Matthew Fernandez [Wed, 13 Apr 2022 15:15:47 +0000 (08:15 -0700)]
move 'gvpack' into C++

When ipsepcola is enabled, `gvpack` transitively links against lib/vpsc which is
partly written in C++. A consequence of this is that building `gvpack` requires
a C++ toolchain and linking against the C++ standard library. With this in mind,
there is no advantage for `gvpack` itself to be written in C instead of C++.
Moving to C++ will allow removing some manual memory management and data
structures.

This commit itself is just a straight rename. Upcoming changes will make the
code more idiomatic C++.

Gitlab: #2154

2 years agogvpack: mark 'gvplugin_neato_layout_LTX_library' as having C linkage
Matthew Fernandez [Fri, 15 Apr 2022 00:28:00 +0000 (17:28 -0700)]
gvpack: mark 'gvplugin_neato_layout_LTX_library' as having C linkage

gvpack.c is currently compiled as C, so this symbol already has C linkage by
default. However an upcoming commit converts it to C++, which then results in
link failures due to this defaulting to C++ linkage. To pre-empt that, we note
its linkage explicitly for now. These guards will be removed in a future commit.

Gitlab: #2154

2 years agogvpack: cast results of 'dtmatch'
Matthew Fernandez [Thu, 14 Apr 2022 14:56:08 +0000 (07:56 -0700)]
gvpack: cast results of 'dtmatch'

This pre-emptively squashes some upcoming warnings when converting this file to
C++ which otherwise fail the CMake build:

  cmd/tools/../../lib/cdt/cdt.h:259:66: error: invalid conversion from 'void*'
    to 'pair_t*' [-fpermissive]

Gitlab: #2154

2 years agogvpack: rename variables called 'new'
Matthew Fernandez [Thu, 14 Apr 2022 00:31:59 +0000 (17:31 -0700)]
gvpack: rename variables called 'new'

Having variables called `new` prevents this code being moved to C++, where `new`
is a keyword.

Gitlab: #2154

2 years agogvpack: cast string literals when calling 'agfindgraphattr'
Matthew Fernandez [Thu, 14 Apr 2022 00:27:53 +0000 (17:27 -0700)]
gvpack: cast string literals when calling 'agfindgraphattr'

This pre-emptively squashes several upcoming warnings when converting this file
to C++ which otherwise fail the CMake build:

  cmd/tools/gvpack.cpp:298:40: error: ISO C++11 does not allow conversion from
    string literal to 'char *' [-Werror,-Wwritable-strings]

Gitlab: #2154

2 years agogvpack: cast string literals when calling 'agfindnodeattr'
Matthew Fernandez [Thu, 14 Apr 2022 00:23:47 +0000 (17:23 -0700)]
gvpack: cast string literals when calling 'agfindnodeattr'

This pre-emptively squashes several upcoming warnings when converting this file
to C++ which otherwise fail the CMake build:

  cmd/tools/gvpack.cpp:270:42: error: ISO C++11 does not allow conversion from
    string literal to 'char *' [-Werror,-Wwritable-strings]

Gitlab: #2154

2 years agogvpack: cast assignment of string literal to 'rhs'
Matthew Fernandez [Thu, 14 Apr 2022 00:21:39 +0000 (17:21 -0700)]
gvpack: cast assignment of string literal to 'rhs'

This pre-emptively squashes an upcoming warning when converting this file to C++
which otherwise fails the CMake build:

  cmd/tools/gvpack.cpp:122:17: error: ISO C++11 does not allow conversion from
    string literal to 'char *' [-Werror,-Wwritable-strings]

Gitlab: #2154

2 years agogvpack: cast string literal when calling 'agnodeattr'
Matthew Fernandez [Thu, 14 Apr 2022 14:52:47 +0000 (07:52 -0700)]
gvpack: cast string literal when calling 'agnodeattr'

This pre-emptively squashes an upcoming warning when converting this file to C++
which otherwise fails the CMake build:

  cmd/tools/gvpack.cpp:178:43: error: ISO C++11 does not allow conversion from
    string literal to 'char *' [-Werror,-Wwritable-strings]

Gitlab: #2154

2 years agogvpack: take const values in various functions that call 'agattr'
Matthew Fernandez [Thu, 14 Apr 2022 00:19:15 +0000 (17:19 -0700)]
gvpack: take const values in various functions that call 'agattr'

This pre-emptively squashes several upcoming warnings when converting this file
to C++ which otherwise fail the CMake build:

  cmd/tools/gvpack.cpp:181:22: error: ISO C++11 does not allow conversion from
    string literal to 'char *' [-Werror,-Wwritable-strings]

Gitlab: #2154

2 years agogvpack: use a const char array instead of mutable variable for usage string
Matthew Fernandez [Thu, 14 Apr 2022 00:15:20 +0000 (17:15 -0700)]
gvpack: use a const char array instead of mutable variable for usage string

This pre-emptively squashes an upcoming warning when converting this file to C++
which otherwise fails the CMake build:

  cmd/tools/gvpack.cpp:82:5: error: ISO C++11 does not allow conversion from
    string literal to 'char *' [-Werror,-Wwritable-strings]

Gitlab: #2154

2 years agogvpack: cast assignment of string literal to mutable variable
Matthew Fernandez [Thu, 14 Apr 2022 00:11:34 +0000 (17:11 -0700)]
gvpack: cast assignment of string literal to mutable variable

This pre-emptively squashes an upcoming warning when converting this file to C++
which otherwise fails the CMake build:

  cmd/tools/gvpack.cpp:77:22: error: ISO C++11 does not allow conversion from
    string literal to 'char *' [-Werror,-Wwritable-strings]

Gitlab: #2154

2 years agoMerge branch 'smattr/76A06EFC-E807-41D0-B837-936234C12C31' into 'main'
Matthew Fernandez [Mon, 25 Apr 2022 01:23:00 +0000 (01:23 +0000)]
Merge branch 'smattr/76A06EFC-E807-41D0-B837-936234C12C31' into 'main'

gxl2gv: replace inline stack implementations with generic API

See merge request graphviz/graphviz!2617

2 years agogxl2gv: replace custom 'slist' string stack with generic stack
Matthew Fernandez [Sat, 5 Feb 2022 06:05:42 +0000 (17:05 +1100)]
gxl2gv: replace custom 'slist' string stack with generic stack

Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation. Apart from reducing code duplication and complexity, this
removes an unnecessary rounding of allocations. The prior code rounded up
`slist` allocations to `sizeof(void*)`, but `malloc` effectively does this
internally anyway. This also adds checks for allocation failures that were
previously missing.

Gitlab: #1793

2 years agogxl2gv: replace inline stack implementation with generic API
Matthew Fernandez [Sat, 5 Feb 2022 01:28:06 +0000 (12:28 +1100)]
gxl2gv: replace inline stack implementation with generic API

Similar to previous changes to `gc` in 4e2875fd7376338259dcb3ccc8f029d58bdf22dd,
this replaces some duplicated functionality with the generic Graphviz stack
implementation. This removes the previously hard coded nested subgraph limit of
32. The number of supported subgraphs in now solely limited by available memory.

Gitlab: #1793

2 years agoMerge branch 'smattr/06F42B8C-5B6E-438F-8110-3B743FAF61E9' into 'main'
Matthew Fernandez [Sun, 24 Apr 2022 17:32:40 +0000 (17:32 +0000)]
Merge branch 'smattr/06F42B8C-5B6E-438F-8110-3B743FAF61E9' into 'main'

de-dupe unistd compat headers; remove unistd detection

Closes #2204

See merge request graphviz/graphviz!2614

2 years agoremove no longer used compat_unistd.h
Matthew Fernandez [Mon, 18 Apr 2022 03:17:49 +0000 (20:17 -0700)]
remove no longer used compat_unistd.h

Gitlab: closes #2204

2 years agoremove no longer used unistd.h detection
Matthew Fernandez [Mon, 18 Apr 2022 02:00:39 +0000 (19:00 -0700)]
remove no longer used unistd.h detection

Gitlab: #2204

2 years agogvpr: make #includes of unistd.h unconditional
Matthew Fernandez [Sat, 16 Apr 2022 17:07:30 +0000 (10:07 -0700)]
gvpr: make #includes of unistd.h unconditional

Gitlab: #2204

2 years agoast: make #includes of unistd.h unconditional
Matthew Fernandez [Sat, 16 Apr 2022 20:34:55 +0000 (13:34 -0700)]
ast: make #includes of unistd.h unconditional

Only the one in pathfind.c was actually having the intended effect, because the
other two files were not #including config.h.

Gitlab: #2204

2 years agotreat 'X_OK' as an alias of 'R_OK' in the Windows unistd.h shim
Matthew Fernandez [Sat, 16 Apr 2022 22:05:30 +0000 (15:05 -0700)]
treat 'X_OK' as an alias of 'R_OK' in the Windows unistd.h shim

This is not technically correct (Windows does not have `X_OK` at all), but this
is an accurate approximation for the ways in which Graphviz uses `X_OK`. This is
another step towards replacing lib/ast/compat_unistd.h.

Gitlab: #2204

2 years agoimplement a 'S_ISDIR' shim for Windows
Matthew Fernandez [Sat, 16 Apr 2022 22:01:35 +0000 (15:01 -0700)]
implement a 'S_ISDIR' shim for Windows

This will enable further migration away from lib/ast/compat_unistd.h. Note that
the `S_ISDIR` wrapper there appears incorrect, in using a platform-specific
constant for the mask. Its definition of `X_OK` also seems incorrect, as this
value has no documented meaning when calling `_access` on Windows.

Gitlab: #2204