When calling through a function pointer in C, you do not need to explicitly
dereference it. The compiler understands how to deal with these addressing
complications.
Using the heap for a statically-known array of two pointers is inefficient. This
can just be stack-allocated, improving the compiler’s visibility and ability to
optimize. Removes a -Wsign-conversion compiler warning.
This constant is only ever used as a float, but triggers warnings because 0.8
cannot be precisely expressed as a 32-bit IEEE float. If we want to use the
closest 32-bit float to 0.8 let's just say so. This change squashes 3
-Wfloat-conversion warnings.
Similar to preceding commits, this fixes an issue where MinGW was seeing
__declspec alternatives but implementing GCC semantics and hence treating
declarations as definitions.
Similar to preceding commits, this fixes an issue where MinGW was seeing
__declspec alternatives but implementing GCC semantics and hence treating
declarations as definitions.
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 MemTest and GvExitOnUsage
Similar to preceding commits, this fixes an issue where MinGW was seeing
__declspec alternatives but implementing GCC semantics and hence treating
declarations as definitions.
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 gvplugin_neato_layout_LTX_library
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 dot_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 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.