NetBSD, 2.0.9, C90 build failure

Apologies if this isn’t the proper place to post; but:

…src/vendor/SDL2/src/joystick/bsd/SDL_sysjoystick.c:353:5: error:
ISO C90 forbids mixed declarations and code
[-Werror=declaration-after-statement]

Index: src/vendor/SDL2/src/joystick/bsd/SDL_sysjoystick.c
==================================================================
--- src/vendor/SDL2/src/joystick/bsd/SDL_sysjoystick.c
+++ src/vendor/SDL2/src/joystick/bsd/SDL_sysjoystick.c
@@ -299,10 +299,14 @@
     struct hid_item hitem;
     struct hid_data *hdata;
     struct report *rep = NULL;
     int fd;
     int i;
+#if defined(__NetBSD__)
+    usb_device_descriptor_t udd;
+    struct usb_string_desc usd;
+#endif

     fd = open(path, O_RDONLY);
     if (fd == -1) {
         return SDL_SetError("%s: %s", path, strerror(errno));
     }
@@ -348,12 +352,10 @@
     if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
 #endif
         rep->rid = -1;          /* XXX */
     }
 #if defined(__NetBSD__)
-    usb_device_descriptor_t udd;
-    struct usb_string_desc usd;
     if (ioctl(fd, USB_GET_DEVICE_DESC, &udd) == -1)
         goto desc_failed;

     /* Get default language */
     usd.usd_string_index = USB_LANGUAGE_TABLE;

Fixed: http://hg.libsdl.org/SDL/rev/61b267339239
Thanks.

Reporting bugs & posting patches: https://bugzilla.libsdl.org

1 Like