Mesa (master): gallium/auxiliary/pipe-loader: Fix usage of anonymous union.

Francisco Jerez currojerez at kemper.freedesktop.org
Wed May 16 16:58:33 UTC 2012


Module: Mesa
Branch: master
Commit: 03e3bc4ba56f1021899a5f773b6ec21893619e3a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=03e3bc4ba56f1021899a5f773b6ec21893619e3a

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Wed May 16 15:43:29 2012 +0200

gallium/auxiliary/pipe-loader: Fix usage of anonymous union.

Anonymous unions aren't part of the C99 standard.  Fixes build on GCC
versions older than 4.6.

https://bugs.freedesktop.org/show_bug.cgi?id=50001

Reported-by: Michael Lange <michaell at gmx.org>

---

 src/gallium/auxiliary/pipe-loader/pipe_loader.h    |    2 +-
 .../auxiliary/pipe-loader/pipe_loader_drm.c        |   12 ++++++------
 src/gallium/state_trackers/clover/core/device.cpp  |    2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index e419694..21a609f 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -58,7 +58,7 @@ struct pipe_loader_device {
          int vendor_id;
          int chip_id;
       } pci;
-   }; /**< Discriminated by \a type */
+   } u; /**< Discriminated by \a type */
 
    const char *driver_name;
    const struct pipe_loader_ops *ops;
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 7a7e994..518f3da 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -78,8 +78,8 @@ find_drm_pci_id(struct pipe_loader_drm_device *ddev)
 
    pci_id = udev_device_get_property_value(parent, "PCI_ID");
    if (!pci_id ||
-       sscanf(pci_id, "%x:%x", &ddev->base.pci.vendor_id,
-              &ddev->base.pci.chip_id) != 2)
+       sscanf(pci_id, "%x:%x", &ddev->base.u.pci.vendor_id,
+              &ddev->base.u.pci.chip_id) != 2)
       goto fail;
 
    return TRUE;
@@ -101,7 +101,7 @@ find_drm_driver_name(struct pipe_loader_drm_device *ddev)
    int i, j;
 
    for (i = 0; driver_map[i].driver; i++) {
-      if (dev->pci.vendor_id != driver_map[i].vendor_id)
+      if (dev->u.pci.vendor_id != driver_map[i].vendor_id)
          continue;
 
       if (driver_map[i].num_chips_ids == -1) {
@@ -110,7 +110,7 @@ find_drm_driver_name(struct pipe_loader_drm_device *ddev)
       }
 
       for (j = 0; j < driver_map[i].num_chips_ids; j++) {
-         if (dev->pci.chip_id == driver_map[i].chip_ids[j]) {
+         if (dev->u.pci.chip_id == driver_map[i].chip_ids[j]) {
             dev->driver_name = driver_map[i].driver;
             goto found;
          }
@@ -120,8 +120,8 @@ find_drm_driver_name(struct pipe_loader_drm_device *ddev)
    return FALSE;
 
   found:
-   debug_printf("driver for %04x:%04x: %s\n", dev->pci.vendor_id,
-                dev->pci.chip_id, dev->driver_name);
+   debug_printf("driver for %04x:%04x: %s\n", dev->u.pci.vendor_id,
+                dev->u.pci.chip_id, dev->driver_name);
    return TRUE;
 }
 
diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
index 1f40010..69b1b4a 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -75,7 +75,7 @@ _cl_device_id::vendor_id() const {
    case PIPE_LOADER_DEVICE_SOFTWARE:
       return 0;
    case PIPE_LOADER_DEVICE_PCI:
-      return ldev->pci.vendor_id;
+      return ldev->u.pci.vendor_id;
    default:
       assert(0);
       return 0;




More information about the mesa-commit mailing list