#1483 closed defect (fixed)

rtems/pci.h symbol clashes

Reported by: Ralf Corsepius Owned by: Joel Sherrill
Priority: normal Milestone: 4.10
Component: score Version: 4.10
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

rtems/pci.h typedefs a type "pci_config":
cpukit/include/rtems/pci.h:} pci_config;

This clashes with
c/src/lib/libcpu/mips/au1x00/include/au1x00.h:
#define pci_config 0x0004

Together, these causes this build breakdown for the csb350 (mips) BSP:
mips-rtems4.10-gcc --pipe -B../../../lib/ -B../../../csb350/lib/ -specs bsp_specs -qrtems -DPACKAGE_NAME=\"rtems-c-src\" -DPACKAGE_TARNAME=\"rtems-c-src\" -DPACKAGE_VERSION=\"4.9.99.0\" -DPACKAGE_STRING=\"rtems-c-src\ 4.9.99.0\" -DPACKAGE_BUGREPORT=\"http://www.rtems.org/bugzilla\" -DPACKAGE_URL=\"\" -I. -I../../../../../c/src/libchip -isystem ../../../csb350/lib/include -DINSIDE_RTEMS_BSD_TCPIP_STACK -mips32 -G0 -msoft-float -O2 -g -Wall -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -MT network/libnetchip_a-dec21140.o -MD -MP -MF network/.deps/libnetchip_a-dec21140.Tpo -c -o network/libnetchip_a-dec21140.o test -f 'network/dec21140.c' || echo '../../../../../c/src/libchip/'network/dec21140.c
In file included from ../../../../../c/src/libchip/network/dec21140.c:57:
../../../csb350/lib/include/rtems/pci.h:1136: error: expected identifier or '(' before numeric constant
../../../csb350/lib/include/rtems/pci.h:1138: error: expected identifier or '(' before numeric constant
../../../csb350/lib/include/rtems/pci.h: In function 'pci_read_config_byte':
../../../csb350/lib/include/rtems/pci.h:1148: error: 'BSP_pci_configuration' undeclared (first use in this function)
../../../csb350/lib/include/rtems/pci.h:1148: error: (Each undeclared identifier is reported only once
../../../csb350/lib/include/rtems/pci.h:1148: error: for each function it appears in.)
../../../csb350/lib/include/rtems/pci.h: In function 'pci_read_config_word':
../../../csb350/lib/include/rtems/pci.h:1160: error: 'BSP_pci_configuration' undeclared (first use in this function)
../../../csb350/lib/include/rtems/pci.h: In function 'pci_read_config_dword':
../../../csb350/lib/include/rtems/pci.h:1172: error: 'BSP_pci_configuration' undeclared (first use in this function)
../../../csb350/lib/include/rtems/pci.h: In function 'pci_write_config_byte':
../../../csb350/lib/include/rtems/pci.h:1183: error: 'BSP_pci_configuration' undeclared (first use in this function)
../../../csb350/lib/include/rtems/pci.h: In function 'pci_write_config_word':
../../../csb350/lib/include/rtems/pci.h:1195: error: 'BSP_pci_configuration' undeclared (first use in this function)
../../../csb350/lib/include/rtems/pci.h: In function 'pci_write_config_dword':
../../../csb350/lib/include/rtems/pci.h:1207: error: 'BSP_pci_configuration' undeclared (first use in this function)
gmake[2]: * [network/libnetchip_a-dec21140.o] Error 1

IMO, this breakdown is caused by several issues interacting:
a) rtems/pci.h using non-namespace-safe types.
It should use rtems_pci_* instead of pci_*

b) This breakdown is triggered by the 2009/12/08 changes to libchip/network, which cause the files inside to #include files, they haven't before, even on unsupported targets, e.g.:

# cvs diff -u -r 1.43 c/src/libchip/network/dec21140.c
...
@@ -49,17 +49,18 @@

#define DEC21140_SUPPORTED
#define PCI_DRAM_OFFSET 0

#endif

-#if defined(PPC) && (defined(mpc604) defined(mpc750) defined(ppc603e))
+#if defined(PPC)

#define DEC21140_SUPPORTED

#endif


+#include <bsp.h>
+#include <rtems/pci.h>
+

#if !defined(PCI_DRAM_OFFSET)

#undef DEC21140_SUPPORTED

#endif


#if defined(DEC21140_SUPPORTED)

-#include <bsp.h>
-#include <rtems/pci.h>

#if defined(PPC)
#include <libcpu/byteorder.h>

=> This patch moves
#include <bsp.h>
#include <rtems/pci.h>
outside of the #if defined(DEC21140_SUPPORTED)-guard, even on unsupported targets.

I am going to

  • rename "pci_config" to "rtems_pci_config_t"
  • move the "include <bsp.h>/include <rtems/pci.h>" to inside of the "*_SUPPORTED"-guard.

Change History (1)

comment:1 Changed on Jun 16, 2010 at 6:06:49 PM by Joel Sherrill

Resolution: fixed
Status: newclosed

Compiles now.

Note: See TracTickets for help on using tickets.