Next try.
Thanks to Stuart Henderson for finding a bug in the first version.

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 OpenBSD.


Signed-off-by: Carl-Daniel Hailfinger <[email protected]>

Stuart, if this works for you, please respond with
Acked-by: Your Name <y...@email>

Index: flashrom-libpci_header_shadow_warning/hwaccess.h
===================================================================
--- flashrom-libpci_header_shadow_warning/hwaccess.h    (Revision 1060)
+++ flashrom-libpci_header_shadow_warning/hwaccess.h    (Arbeitskopie)
@@ -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 <pci/pci.h>
+#undef index
 #endif
 
 #if defined (__i386__) || defined (__x86_64__)
Index: flashrom-libpci_header_shadow_warning/Makefile
===================================================================
--- flashrom-libpci_header_shadow_warning/Makefile      (Revision 1060)
+++ flashrom-libpci_header_shadow_warning/Makefile      (Arbeitskopie)
@@ -310,7 +310,9 @@
 ifeq ($(CHECK_LIBPCI), yes)
 pciutils: compiler
        @printf "Checking for libpci headers... "
-       @$(shell ( echo "#include <pci/pci.h>";            \
+       @# Avoid a failing test due to libpci header symbol shadowing breakage
+       @$(shell ( echo "#define index shadow_workaround_index"; \
+                  echo "#include <pci/pci.h>";            \
                   echo "struct pci_access *pacc;";        \
                   echo "int main(int argc, char **argv)"; \
                   echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c )


-- 
http://www.hailfinger.org/


_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to