From 7237683faff7d67a7caac9addb6ef5e6944db0b1 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Fri, 25 Jun 2010 13:18:48 +0000 Subject: Work around shadowing warnings in libpci headers This is needed for warning-free compilation on older gcc versions (3.x and probably older). Such a gcc version is the default on i386 OpenBSD. Corresponding to flashrom svn r1061. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Stuart Henderson --- Makefile | 4 +++- hwaccess.h | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 723a15b..00ab0b2 100644 --- a/Makefile +++ b/Makefile @@ -310,7 +310,9 @@ compiler: featuresavailable ifeq ($(CHECK_LIBPCI), yes) pciutils: compiler @printf "Checking for libpci headers... " - @$(shell ( echo "#include "; \ + @# Avoid a failing test due to libpci header symbol shadowing breakage + @$(shell ( echo "#define index shadow_workaround_index"; \ + echo "#include "; \ echo "struct pci_access *pacc;"; \ echo "int main(int argc, char **argv)"; \ echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c ) diff --git a/hwaccess.h b/hwaccess.h index 91366a6..53e908a 100644 --- a/hwaccess.h +++ b/hwaccess.h @@ -31,7 +31,14 @@ #endif #if NEED_PCI == 1 +/* + * libpci headers use the variable name "index" which triggers shadowing + * warnings on systems which have the index() function in a default #include + * or as builtin. + */ +#define index shadow_workaround_index #include +#undef index #endif #if defined (__i386__) || defined (__x86_64__) -- cgit v1.1