简体   繁体   中英

“error: expected primary-expression before 'volatile'”

I'm trying to compile NRF driver with MinGW 4.8.2. I'm getting this error:

In file included from

b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/device/nrf51.h:119:0,
                 from b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/softdevice/s130/headers/nrf_soc.h:50,
                 from b:/nrfdriver/pc-ble-driver-0.5.0/driver/inc_override/nrf_soc.h:21,
                 from b:/nrfdriver/pc-ble-driver-0.5.0/driver/inc_override/app_util_platform.h:26,
                 from b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf/uart/app_uart.h:27,
                 from b:\nrfdriver\pc-ble-driver-0.5.0\driver\src\app_uart_pc.c:13:
C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.2/include/xmmintrin.h:
In function 'void _mm_setcsr(unsigned int)':
b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc/core_cm0.h:164:21:
error: expected primary-expression before 'volatile'    #define   __I 
volatile             /*!< Defines 'read only' permissions   */
                     ^ driver\CMakeFiles\s130_nrf51_ble_driver.dir\build.make:297: recipe for
target 'driver/CMakeFiles/s130_nrf51_ble_driver.dir/src/app_uart_pc.c
.obj' failed

Error comes from this line:

#define   __I     volatile             /*!< Defines 'read only' permissions                 */

How can such a simple #define lead to a compiler error and any idea how I should fix that? (upgrading the compiler is not an option as this version of the driver is supposed to be built with this version of MinGW).

Note that the driver is meant to be built in 32bits and I'm trying to build it targetting 64bits, dunno if that could be the cause of the problem...

What if we also look in the xmmintrin.h header?

/* Set the control register to I.  */
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_setcsr (unsigned int __I)
{
  __builtin_ia32_ldmxcsr (__I);
}

Ouch, another use of __I .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM