From 2e20e2e32f0d284eaa4f6f616e61c30de75d07a0 Mon Sep 17 00:00:00 2001 From: Christian Fibich Date: Fri, 22 Jun 2018 11:06:45 +0200 Subject: [PATCH] Workaround for g++ and glibc that define `minor` in ``. 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 . For historical compatibility, it is currently defined by as well, but we plan to remove this soon. To use "minor", include directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including . [-Werror] uint8_t minor() const; ^~~~~~~~~~~ This is related to these two bugs: https://sourceware.org/bugzilla/show_bug.cgi?format=multiple&id=19239 https://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 --- lib/include/prjxray/xilinx/xc7series/frame_address.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/include/prjxray/xilinx/xc7series/frame_address.h b/lib/include/prjxray/xilinx/xc7series/frame_address.h index e668034e..c15b87f4 100644 --- a/lib/include/prjxray/xilinx/xc7series/frame_address.h +++ b/lib/include/prjxray/xilinx/xc7series/frame_address.h @@ -7,6 +7,10 @@ #include #include +#ifdef _GNU_SOURCE +#undef minor +#endif + namespace prjxray { namespace xilinx { namespace xc7series {