Print this page
3373 gcc >= 4.5 concerns about offsetof()


 156 
 157 /* For serialization. */
 158 #define USBVC_SER_NOSIG B_FALSE
 159 #define USBVC_SER_SIG           B_TRUE
 160 
 161 /*
 162  * Masks for debug printing
 163  */
 164 #define PRINT_MASK_ATTA         0x00000001
 165 #define PRINT_MASK_OPEN         0x00000002
 166 #define PRINT_MASK_CLOSE        0x00000004
 167 #define PRINT_MASK_READ         0x00000008
 168 #define PRINT_MASK_IOCTL        0x00000010
 169 #define PRINT_MASK_PM   0x00000020
 170 #define PRINT_MASK_CB   0x00000040
 171 #define PRINT_MASK_HOTPLUG      0x00000080
 172 #define PRINT_MASK_DEVCTRL      0x00000100
 173 #define PRINT_MASK_DEVMAP       0x00000200
 174 #define PRINT_MASK_ALL          0xFFFFFFFF
 175 



 176 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))

 177 
 178 #define USBVC_MAX_PKTS 40
 179 
 180 #define USBVC_DEFAULT_READ_BUF_NUM 3
 181 #define USBVC_MAX_READ_BUF_NUM 40
 182 #define USBVC_MAX_MAP_BUF_NUM 40
 183 
 184 /* According to UVC specs, the frame interval is in 100ns unit */
 185 #define USBVC_FRAME_INTERVAL_DENOMINATOR        10000000
 186 
 187 /* Only D3...D0 are writable, Table 4-6, UVC Spec */
 188 #define USBVC_POWER_MODE_MASK   0xf0;
 189 
 190 enum usbvc_buf_status {
 191         USBVC_BUF_INIT          = 0,  /* Allocated, to be queued */
 192             USBVC_BUF_MAPPED    = 1,  /* For map I/O only. Memory is mapped. */
 193             USBVC_BUF_EMPTY             = 2, /* not initialized, to be filled */
 194 
 195         /*
 196          * buf is filled with a full frame without any errors,




 156 
 157 /* For serialization. */
 158 #define USBVC_SER_NOSIG B_FALSE
 159 #define USBVC_SER_SIG           B_TRUE
 160 
 161 /*
 162  * Masks for debug printing
 163  */
 164 #define PRINT_MASK_ATTA         0x00000001
 165 #define PRINT_MASK_OPEN         0x00000002
 166 #define PRINT_MASK_CLOSE        0x00000004
 167 #define PRINT_MASK_READ         0x00000008
 168 #define PRINT_MASK_IOCTL        0x00000010
 169 #define PRINT_MASK_PM   0x00000020
 170 #define PRINT_MASK_CB   0x00000040
 171 #define PRINT_MASK_HOTPLUG      0x00000080
 172 #define PRINT_MASK_DEVCTRL      0x00000100
 173 #define PRINT_MASK_DEVMAP       0x00000200
 174 #define PRINT_MASK_ALL          0xFFFFFFFF
 175 
 176 #if defined(__GNUC__)
 177 #define offsetof(s, m)  __builtin_offsetof(s, m)
 178 #else
 179 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
 180 #endif
 181 
 182 #define USBVC_MAX_PKTS 40
 183 
 184 #define USBVC_DEFAULT_READ_BUF_NUM 3
 185 #define USBVC_MAX_READ_BUF_NUM 40
 186 #define USBVC_MAX_MAP_BUF_NUM 40
 187 
 188 /* According to UVC specs, the frame interval is in 100ns unit */
 189 #define USBVC_FRAME_INTERVAL_DENOMINATOR        10000000
 190 
 191 /* Only D3...D0 are writable, Table 4-6, UVC Spec */
 192 #define USBVC_POWER_MODE_MASK   0xf0;
 193 
 194 enum usbvc_buf_status {
 195         USBVC_BUF_INIT          = 0,  /* Allocated, to be queued */
 196             USBVC_BUF_MAPPED    = 1,  /* For map I/O only. Memory is mapped. */
 197             USBVC_BUF_EMPTY             = 2, /* not initialized, to be filled */
 198 
 199         /*
 200          * buf is filled with a full frame without any errors,