lib/database.cc used glob(3) to enumerate segbits files, which is
unavailable on Windows. Add an #ifdef _WIN32 branch using
FindFirstFileA/FindNextFileA; the POSIX glob path is unchanged.
lib/memory_mapped_file.cc used POSIX open/fstat/mmap, which does not
exist under mingw-w64, blocking a native Windows build of the prjxray
tools. Add an #ifdef _WIN32 branch using
CreateFileA/CreateFileMappingA/MapViewOfFile; the POSIX path is
byte-for-byte unchanged.
One behavioural note: a zero-length file cannot be mapped on Windows,
so that case returns an object with nullptr data and zero size to
preserve the "file exists" contract of InitWithFile.
configuration.cc explicitly specializes
Configuration<Spartan6>::createType2ConfigurationPacketData and
Configuration<...>::createConfigurationPackage (Spartan6, Series7,
UltraScale, UltraScalePlus), but none of those specializations were
declared in configuration.h. The standard requires an explicit
specialization to be declared in every translation unit that uses it
([temp.expl.spec]); without the declaration, a TU calling
createType2ConfigurationPacketData for Spartan6 instantiates the
primary template — which is defined in this header — and emits its own
COMDAT copy of the symbol.
That copy collides with the strong definition from configuration.cc
when linking xc7frames2bit/xc7patch with mingw-w64 ld ("multiple
definition of ...createType2ConfigurationPacketData..."), which is why
Windows builds needed -Wl,--allow-multiple-definition. ELF linkers
happen to resolve the collision silently in favour of the strong
symbol, so Linux builds never noticed.
Declare all five specializations in the header so every user
references the single definition in configuration.cc. Verified with a
mingw-w64 cross build: the tools now link without the workaround
linker flag. No behaviour change on ELF.
updated the code which was using the std::iterator class, which has been marked as deprecated in the C++17 standard
Signed-off-by: ABHISHEK ANAND <abhishekabhishek1012@gmail.com>
Add `make format-trailing-ws`. This recipe finds all _files_ (not
links) known to Git and uses `sed` to remove trailing whitespace.
Signed-off-by: Jake Mercer <jake.mercer@civica.co.uk>
The previous commit caused the segbits file reader test to fail as
trailing whitespace was removed from the test_data. Updated the reader
to additionally handle a tag immediately followed by a newline.
Signed-off-by: Jake Mercer <jake.mercer@civica.co.uk>
Changes after running `make format`. Future commits which add
whitespace should be caught by CI at the PR stage.
Signed-off-by: Jake Mercer <jake.mercer@civica.co.uk>
Building prjxray using g++ 7.3.0 and glibc 2.27-3 produces the following warning that is treated as an error:
In file included from [...]/prjxray/lib/include/prjxray/xilinx/xc7series/configuration_column.h:8:0,
from [...]/prjxray/lib/include/prjxray/xilinx/xc7series/configuration_bus.h:10,
from [...]/prjxray/lib/xilinx/xc7series/configuration_bus.cc:1:
[...]/prjxray/lib/include/prjxray/xilinx/xc7series/frame_address.h:32:13: error: In the GNU C Library, "minor" is defined
by <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "minor", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"minor", you should undefine it after including <sys/types.h>. [-Werror]
uint8_t minor() const;
^~~~~~~~~~~
This is related to these two bugs:
https://sourceware.org/bugzilla/show_bug.cgi?format=multiple&id=19239https://bugzilla.redhat.com/show_bug.cgi?id=130601
This patch is a workaround that undefines `minor` if `_GNU_SOURCE` is defined.
Signed-off-by: Christian Fibich <fibich@technikum-wien.at>