[flashrom] [commit] r1061 - trunk

repository service svn at flashrom.org
Fri Jun 25 15:18:49 CEST 2010


Author: hailfinger
Date: Fri Jun 25 15:18:48 2010
New Revision: 1061
URL: http://flashrom.org/trac/coreboot/changeset/1061

Log:
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.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Acked-by: Stuart Henderson <sthen at openbsd.org>

Modified:
   trunk/Makefile
   trunk/hwaccess.h

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	Thu Jun 24 13:51:12 2010	(r1060)
+++ trunk/Makefile	Fri Jun 25 15:18:48 2010	(r1061)
@@ -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 )

Modified: trunk/hwaccess.h
==============================================================================
--- trunk/hwaccess.h	Thu Jun 24 13:51:12 2010	(r1060)
+++ trunk/hwaccess.h	Fri Jun 25 15:18:48 2010	(r1061)
@@ -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__)




More information about the flashrom mailing list