gvmap: fix pointer-vs-int confusion in calling 'gv_recalloc'
This was a typo in 0e53497fae6e05a59c31b7f124ddd1166901759f. It seemingly went
unnoticed amid the torrent of warnings the Autotools build emits. I only picked
this up when enabling this code in the CMake build system that compiles with
-Werror in CI.
Magnus Jacobsson [Sun, 15 May 2022 09:19:26 +0000 (11:19 +0200)]
upgrade jinja2 to version 2.11.3
Fixes this error when using python 3.10:
Traceback (most recent call last):
File "/usr/bin/gcovr", line 33, in <module>
sys.exit(load_entry_point('gcovr==5.0', 'console_scripts', 'gcovr')())
File "/usr/lib/python3/dist-packages/gcovr/__main__.py", line 280, in main
error_occurred = print_reports(covdata, options, logger)
File "/usr/lib/python3/dist-packages/gcovr/__main__.py", line 432, in print_reports
if generator(covdata, output.abspath, options):
File "/usr/lib/python3/dist-packages/gcovr/writer/html.py", line 281, in print_html_report
css_data = CssRenderer.render(options)
File "/usr/lib/python3/dist-packages/gcovr/writer/html.py", line 121, in render
template = templates().get_template('style.css')
File "/usr/lib/python3/dist-packages/gcovr/writer/html.py", line 44, in __call__
return self.get(*args)
File "/usr/lib/python3/dist-packages/gcovr/writer/html.py", line 33, in load
result = fn(*args)
File "/usr/lib/python3/dist-packages/gcovr/writer/html.py", line 52, in templates
from jinja2 import Environment, PackageLoader
File "/root/.local/lib/python3.10/site-packages/jinja2/__init__.py", line 33, in <module>
from jinja2.environment import Environment, Template
File "/root/.local/lib/python3.10/site-packages/jinja2/environment.py", line 16, in <module>
from jinja2.defaults import BLOCK_START_STRING, \
File "/root/.local/lib/python3.10/site-packages/jinja2/defaults.py", line 32, in <module>
from jinja2.tests import TESTS as DEFAULT_TESTS
File "/root/.local/lib/python3.10/site-packages/jinja2/tests.py", line 13, in <module>
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
We cannot upgrade to jinja 3.x since gcovr would then give this error:
Traceback (most recent call last):
File "/usr/bin/gcovr", line 33, in <module>
sys.exit(load_entry_point('gcovr==5.0', 'console_scripts', 'gcovr')())
File "/usr/lib/python3/dist-packages/gcovr/__main__.py", line 280, in main
error_occurred = print_reports(covdata, options, logger)
File "/usr/lib/python3/dist-packages/gcovr/__main__.py", line 432, in print_reports
if generator(covdata, output.abspath, options):
File "/usr/lib/python3/dist-packages/gcovr/writer/html.py", line 401, in print_html_report
lines = formatter.highlighter_for_file(data['filename'])(source_file.read())
File "/usr/lib/python3/dist-packages/gcovr/writer/html.py", line 159, in highlighter_for_file
from jinja2 import Markup
ImportError: cannot import name 'Markup' from 'jinja2' (/root/.local/lib/python3.10/site-packages/jinja2/__init__.py)
xdot: replace inline agxbuf copy with canonical cgraph version
This de-duplicates some code, reducing ongoing maintenance. It also fixes some
int-as-size_t usage as well as some allocations that were unchecked for failure.
These functions are good candidates for inlining, which can be made possible
even without Link-Time Optimization by inlining them into this header. However
the main motivation for this change is to allow using these in code that does
not link against cgraph, lib/xdot, and thereby de-duplicate some code.
This required adding explicit casts to the alloc wrapper calls because this code
is seen by the C++ compiler when compiling parts of Graphviz. We can also drop
the API macros and C linkage, as these are not relevant for symbols that are not
exported.
This will be relevant in an upcoming commit that inlines these implementations
into the header, needing to call `agxbmore` which previously was only prototyped
below them.
This provides stronger type safety with no loss of performance. Note that this
also alters the implied type signature of `agxbuflen` to have a more appropriate
return type. This allows dropping one cast at a call site squashing another
warning.
gv2gml: remove 'outFile' parameter to 'emitSpline'
The only call to this function passes `outFile`, an already available global
that this parameter was shadowing. This removes numerous -Wshadow warnings.
The only calls to this function pass `outFile`, an already available global that
this parameter was shadowing. This removes numerous -Wshadow warnings.
gv2gml: remove 'outFile' parameter to 'emitNodeAttrs'
The only call to this function passes `outFile`, an already available global
that this parameter was shadowing. This removes numerous -Wshadow warnings.
gv2gml: remove 'outFile' parameter to 'emitEdgeAttrs'
The only call to this function passes `outFile`, an already available global
that this parameter was shadowing. This removes numerous -Wshadow warnings.
The only call to this function passes `outFile`, an already available global
that this parameter was shadowing. This removes numerous -Wshadow warnings.
The only call to this function passes `outFile`, an already available global
that this parameter was shadowing. This removes numerous -Wshadow warnings.
`gv2gml` would produce GML that `gml2gv` was unable to parse. The GML spec¹ is
imprecise about what is allowed, so lets be generous and assume integer values
are acceptable.
graphml2gv: undo micro-optimization in 'endElementHandler'
This code was deciding between using a static stack buffer and a dynamic heap
buffer depending on the length of the string it needed to deal with. This kind
of optimization is unnecessary on modern platforms with performant allocators.
The branching and structure duplication involved in this is often now a
_de-optimization_ instead of the intended optimization.
This commit undoes this trick and instead unconditionally uses heap allocation.
David Seifert [Sat, 14 May 2022 22:50:04 +0000 (00:50 +0200)]
Add option for disabling/customizing of demos
* Many distros have different directories for where to
install example files to. Gentoo installs them under
`$(docdir)/examples`. With `--without-demos`, we can suppress
installation of the demos altogether.
These variables and numerous others in `gvgen` should probably be using
`size_t`. But everywhere else is using `int` currently, so this change at least
makes things consistent and squashes five -Wsign-conversion warnings.
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.