fix multiple definitions of tcldot_builtins variables
Similar to preceding commits, this fixes an issue where MinGW was seeing
__declspec alternatives but implementing GCC semantics and hence treating
declarations as definitions.
fix multiple definitions of lt_preloaded_symbols under MinGW
Similar to preceding commits, this fixes an issue where MinGW was seeing
__declspec alternatives but implementing GCC semantics and hence treating
declarations as definitions.
Similarly to the previous commit, this was causing problems on MinGW where the
compiler would see the __declspec alternatives for CGRAPH_API, but then
implement GCC semantics where a non-extern marked declaration is a definition.
Related to #1940. Thanks to @swaldhoer for guiding me to a patch here.
fix multiple definitions of CDT variables under MinGW on Windows
Building with MinGW on Windows resulted in lots of build errors of the form:
…/x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\cdt.dir/objects.a(dtdisc.c.obj):
dtdisc.c:(.bss+0x0): multiple definition of `Dtset';
CMakeFiles\cdt.dir/objects.a(dtclose.c.obj):dtclose.c:(.bss+0x0): first
defined here
The problem is that this environment defines _WIN32, so it sees the __declspec
alternatives for CDT_API in cdt.h. This is fine as GCC understands __declspec,
but it results in variable declarations in this header then missing the extern
qualifier. GCC’s semantics, in contrast to MSVC, interpret this as a definition
rather than a declaration.
The solution here is to *always* apply extern to these declarations, as MSVC is
happy with this as well. This is only addressing the immediate cause, and not
the longer term issue that __declspec(dllexport) and __declspec(dllimport) in a
Windows build should really be mapped to __attribute__((visibility("default")))
and __attribute__((visibility("hidden"))) in a non-Windows build, not to extern.
Thanks to @Synoecium and @swaldhoer for guidance on this fix.
standardize on two spaces for indentation in Python
The existing code was a mixture of two spaces and four spaces. Aligning on two
spaces allows writing more concise code and more closely matches the LLVM C
style we aspire to for new C code in the code base.
standardize on double quotes for string delimiters in Python
Python supports using either single quotes or double quotes for strings. Given
Graphviz is predominantly a C application, it is expected developers working
within the code base will be most familiar with C. So using double quotes is
more intuitive for such programmers.
gdiplus plugin: remove the use of C-style casts to convert void pointers
In C++, C-style casts are a heavy hammer that is generally too powerful for your
needs. It effectively says to the compiler, “shut up, I know what I’m doing” and
impedes its ability to give you useful diagnostics. By using less powerful
reinterpret_casts, we preserve the compiler’s ability to warn about, e.g.,
implicitly converting a const pointer to non-const.
When running on the native Linux host in Gitlab CI instead of within a Docker
container, ID_LIKE is not set in /etc/os-release. So we set it based on ID if
that is available. Related to #1881.
When we need to maintain a fallback option anyway, having a vasprintf
implementation does not gain us much. Moreover, nothing in the build system was
checking for the existence of vasprintf, so this code was never being used
anyway.
While this often works out on certain architectures, it is technically not
allowed to use a va_list twice. This change fixes the el function for platforms
where reusing va_lists is not possible.
C99 vsnprintf semantics let you call the function with a NULL pointer to
discover the required number of bytes to print the given string. With this
ability, there is no longer any advantage to having two paths through this
function.
The atoi function has no ability to report failure. There is no advantage to
using it over the safer strto* functions. This change also removes a
-Wconversion warning.
manage _run member of Text as a value instead of a pointer
This member is never set to NULL and the Run class is not involved in any
inheritance hierarchy. So there is no need to heap-allocate it or pass it around
by pointer.
This removes the need to manually manage memory for this member but, more
importantly makes this class copy-safe. The implicit copy constructor of this
class would copy the pointer in the _text member. When either the original
object or the new copy was deleted, the pointer would be freed leaving its
duplicate in the other copy dangling. Any attempt to access this would result in
use-after-free and deleting the object would cause a double-free.
Following this change, it is safe to copy a Run object. This issue was latent,
because no existing code causes a Run object to be copied.