All paths in this case end in a call to `exit`. But the compiler is apparently
unable to determine this, so use an explicit `break` to suppress a false
positive warning.
mm2gv: squash -Wconversion warnings for 'tolower' usage
For historical reasons, C functions/macros like `tolower` are specified to take
and return an `int`. This means sometimes one set of pedantic compilers (MinGW
with -Wconversion) complains about passing `char` values into these ctype.h
interfaces and another set of pedantic compilers (GCC with -Wconversion)
complains about coercing the result into a `char`. This change suppresses both
of these false positives.
David Seifert [Sat, 14 May 2022 17:40:31 +0000 (19:40 +0200)]
Augment QMAKE detection
* Many distros (Gentoo included) version qmake nowadays. For Qt 6,
The Qt Company has decided to use `qmake6` for versioning, and
many distros have followed this and used the same approach for Qt 5.
neatogen: remove unused 'total_gap' in 'constrained_majorization_new_with_gaps'
The CMake macOS CI job has begun erroring out:
…/lib/neatogen/quad_prog_solve.c:602:11: error: variable 'total_gap' set but
not used [-Werror,-Wunused-but-set-variable]
float total_gap, target_place;
^
While the error is accurate, nothing has changed on our side that would have
caused this. I can only assume Gitlab have upgraded the macOS runners to pull in
a new version of Clang.
mingle: remove unused 'len_total' in 'pedge_export_gv'
The CMake macOS CI job has begun erroring out:
…/lib/mingle/edge_bundling.cpp:208:27: error: variable 'len_total' set but not
used [-Werror,-Wunused-but-set-variable]
double maxwgt = 0, len, len_total, len_total0;
^
While the error is accurate, nothing has changed on our side that would have
caused this. I can only assume Gitlab have upgraded the macOS runners to pull in
a new version of Clang.
mingle: remove unused 'total_wgt' in 'agglomerative_ink_bundling_internal'
The CMake macOS CI job has begun erroring out:
…/lib/mingle/agglomerative_bundling.cpp:400:27: error: variable 'total_wgt'
set but not used [-Werror,-Wunused-but-set-variable]
double eps = 0., wgt, total_wgt = 0;
^
While the error is accurate, nothing has changed on our side that would have
caused this. I can only assume Gitlab have upgraded the macOS runners to pull in
a new version of Clang.
edgepaint: remove unused 'nnodes' in 'node_distinct_coloring'
The CMake macOS CI job has begun erroring out:
…/lib/edgepaint/node_distinct_coloring.c:204:17: error: variable 'nnodes'
set but not used [-Werror,-Wunused-but-set-variable]
int i, j, jj, nnodes = 0;
^
While the error is accurate, nothing has changed on our side that would have
caused this. I can only assume Gitlab have upgraded the macOS runners to pull in
a new version of Clang.
cgraph: replace unchecked agxbuf allocations with alloc helpers
These allocations are at the core of some work Graphviz does and were not
checked for failure. This change swaps confusing crashes on out-of-memory for a
more graceful exit.
smyrna: squash -Wmaybe-uninitialized warnings in 'set_boundaries'
This code is assuming there is at least one point to scan in the loop. In case
there is not (and to pacify the compiler) set an initial trivial bounding box.
The `cobertura` keyword was deprecated in March¹ and then completely removed on
2022-05-05,² causing all CI pipelines to now fail. This is an attempt to migrate
to the new syntax. More details in
https://gitlab.com/gitlab-org/gitlab/-/issues/361615.
For a long time, there has been confusion in the source tree with tests/ and
rtest/ each containing part of the test suite. These were initially distinct,
but over time files in tests/ have begun importing or referring to sources in
rtest/. This has been a common point of confusion for newcomers to the project:
tests/ is the logical place the test suite should live, so they run that, but
then discover it is not the full test suite.
The diff for this commit is large, so it is challenging to see that it is not a
complex change:
1. Merge rtest/Makefile.am into tests/Makefile.am
2. `git mv rtest/* tests/*`
3. Adjust all Pytest invocations from `… ci/tests.py rtest tests` to
`… ci/tests.py tests`
4. Adjust all other references to rtest/ to tests/ (e.g. .gitignore)
Now seems to be a brief period of calm when edits to the test suite are not
in-flight, so we have less chance of a painful merge conflict. The problem of a
large part of the rtest/rtest.py suite being disabled remains and is not
affected by this commit.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.