There is no need to manually allocate memory for these sets. We can simply let
the compiler take care of this. Note that this is also unlikely to affect the
performance characteristics of getLeftNeighbours and getRightNeighbours because
Named Return Value Optimization (NRVO) is applicable to these functions.
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.