Magnus Jacobsson [Wed, 29 Sep 2021 19:06:59 +0000 (21:06 +0200)]
lib: autotools: build xdot before common
E.g. lib/common/emit.c. uses parseXDotF from lib/xdot/xdot.c.
This is the first step in fixing these errors using autotools with
MinGW:
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../lib/common/.libs/libcommon_C.a(input.o): in function `graph_cleanup':
C:\Users\magja\graphviz\lib\common/input.c:881: undefined reference to `__imp_freeXDot'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../lib/common/.libs/libcommon_C.a(emit.o): in function `init_xdot':
C:\Users\magja\graphviz\lib\common/emit.c:58: undefined reference to `__imp_parseXDotF'
The next commit in this series will add linking to xdot.
Magnus Jacobsson [Thu, 22 Jul 2021 13:59:29 +0000 (15:59 +0200)]
pathplan: autotools: use pathplan.def
Fixes these errors when using autotools with MinGW:
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .libs/cvt.o: in function `Pobsopen':
C:\Users\magja\graphviz\lib\pathplan/cvt.c:80: undefined reference to `__imp_visibility'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .libs/cvt.o: in function `Pobspath':
C:\Users\magja\graphviz\lib\pathplan/cvt.c:108: undefined reference to `__imp_ptVis'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\magja\graphviz\lib\pathplan/cvt.c:115: undefined reference to `__imp_makePath'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .libs/inpoly.o: in function `in_poly':
C:\Users\magja\graphviz\lib\pathplan/inpoly.c:32: undefined reference to `__imp_wind'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: .libs/shortestpth.o: in function `makePath':
C:\Users\magja\graphviz\lib\pathplan/shortestpth.c:98: undefined reference to `__imp_directVis'
mkFont: make it more obvious to the compiler the extent of 'flags'
All calls to this function use literals that fit in an unsigned char. Squashes
a -Wconversion warning. This also introduces a new header constant,
`GV_TEXTFONT_FLAGS_WIDTH`.
Many callers of `gvjobs_output_langname` were written as if this function
returns `NO_SUPPORT` when given an unsupported language. But this is incorrect.
It returns `FALSE`.
This function is called with int values, but the values are the result of
`getopt`. `getopt` only ever returns -1 (which is handled separately) or a valid
`char` value, so the cast here is always safe and never truncating.
This parameter cannot be removed without breaking API. Doing this does not seem
worth it just to squash a warning. Additionally this function may use the `gvc`
parameter in future.
The ctype.h `is*` functions are typically implemented as macros using a lookup
table. This is fine, but on Cygwin the compiler is somewhat picky about this:
lib/ast/fmtesc.c:116:59: warning: array subscript has type char
[-Wchar-subscripts]
116 | (c == '#' && (b == f || isspace(*(b - 1)))
| ^~~~~~~~
I expect this release to be more turbulent than others in recent times, simply
because of the greater-than-average number of changes since the last release,
both in aggregate as well as specifically to the release process itself.
use 'sed' instead of 'rm;git-checkout' to fix CRLF line endings in Cygwin CI
Only selective artifacts in the repository are sensitive to line endings. E.g.
C/C++ and Python code is happily parsed by the compiler/interpreter regardless
of which line ending style it uses.
This should hopefully accelerate the Cygwin CI tasks slightly. The assumption is
that running `sed` on a few files should be faster than deleting all files and
recreating them.
pic plugin: replace 'pic_string' with 'gvputs_nonascii'
This finishes the process of de-duping `fig_string`, `mp_string`, and
`pic_string`. This change makes this plugin more thread safe (no static buffer
is no longer used), and improves its efficiency (bytes are now written directly
into the output instead of a temporary buffer, requiring dynamic allocation and
two copies).
mp plugin: replace 'mp_string' with 'gvputs_nonascii'
This partially de-dupes some code (`pic_string` is a duplicate of `mp_string`),
makes this plugin more thread safe (no static buffer is no longer used), and
improves its efficiency (bytes are now written directly into the output instead
of a temporary buffer, requiring dynamic allocation and two copies).
fig plugin: replace 'fig_string' with 'gvputs_nonascii'
This partially de-dupes some code (`mp_string` and `pic_string` are duplicates
of `fig_string`), makes this plugin more thread safe (no static buffer is no
longer used), and improves its efficiency (bytes are now written directly into
the output instead of a temporary buffer, requiring dynamic allocation and two
copies).
GDI+ plugin: rewrite 'FileStream' reference counting to be thread safe
Based on Microsoft sample code,¹ it seems like the expectation is that consumers
of the `IStream` API may expect to concurrently manipulate reference counts.
This change guards against this by making the referencing counting code use
lock-free atomics, based on the same Microsoft sample.
Note that this is essentially proactively addressing a latent issue as it is, in
general, unsafe to use Graphviz libraries or plugins in a multithreaded
environment right now.
GDI+ plugin: use 'override' instead of 'virtual' on 'FileStream' methods
This C++11 mechanism is an improvement as it causes compilation to error out if
any of these methods were not already declared virtual in a parent class. That
is, it provides a sanity check that these overrides are really doing what they
intend.