【LPC4357|[转]ARM Compiler 6编译error'#pragma push/pop' is an ARM Compiler 5】本文出自米尔技术社区,版权归原作者「玉米糊」所有ARM Compiler 6编译错误:
/home/system2/BSP_QC8992/Dev_env/trustzone_images/core/securemsm/trustzone/qsee/include/tzbsp_syscall.h:37:9: error: '#pragma diag_suppress' is an ARM Compiler 5 extension, and is not supported by ARM Compiler 6 [-Werror,-Warmcc-pragma-diag]
#pragma diag_suppress 1295 /* Allow argument less function prototypes. */
^
/home/system2/BSP_QC8992/Dev_env/trustzone_images/core/securemsm/trustzone/armlib/v7/inc/tzbsp_mcrmrc.h:64:9: error: '#pragma push' is an ARM Compiler 5 extension, and is not supported by ARM Compiler 6 [-Warmcc-pragma-push-pop]
#pragma push
^
/home/system2/BSP_QC8992/Dev_env/trustzone_images/core/securemsm/trustzone/armlib/v7/inc/tzbsp_mcrmrc.h:65:9: error: '#pragma arm' is an ARM Compiler 5 extension, and is not supported by ARM Compiler 6 [-Warmcc-pragma-arm]
#pragma arm
^
/home/system2/BSP_QC8992/Dev_env/trustzone_images/core/securemsm/trustzone/armlib/v7/inc/tzbsp_mcrmrc.h:91:9: error: '#pragma pop' is an ARM Compiler 5 extension, and is not supported by ARM Compiler 6 [-Warmcc-pragma-push-pop]
#pragma pop
^
4 errors generated.
scons: *** [/home/system2/BSP_QC8992/Dev_env/trustzone_images/core/securemsm/trustzone/qsee/kernel/build/qsee/scorpion/BAWAANAA/src/tzbsp_dload_mode.o] Error 1
这个错误包含了”#pragma push”、”#pragma arm” 和 “#pragma pop” 等错误。
当前的程序指定用于ARM Compiler 5及其早起版本,默认情况下会被ARM Compiler 6.00忽略,包括
ARM Compiler 6.00 (build 18)
ARM Compiler 6.00 update1(build 21)
ARM Compiler 6.00 update2(build 46)
为了帮助用户从ARM Compiler 5迁移到 ARM Compiler 5时,尽量识别潜在的重要问题,ARM Compiler 6.01 (build 22)后更改了一些行为。
ARM Compiler 6.01 迁移和兼容性指南请参考:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0742b/chr1398871316050.html
这个页面描述如何使用“-Wno-error=”选项,从而降级错误为警告级别:
-Wno-error=armcc-pragma-push-pop 解决错误:#pragma push、#pragma pop
-Wno-error=armcc-pragma-arm 解决错误:#pragma arm
-Wno-error=armcc-pragma-diag 解决错误:#pragma diag_suppress
例如:
#pragma push
#pragma armint fn(int x) {
return 2 * x;
}#pragma pop
编译会出错:
$ armclang --target=aarch64-arm-none-eabi -c foo.cfoo.c:2:9: error: '#pragma push' is an ARM Compiler 5 extension, and is not
supported by ARM Compiler 6 [-Warmcc-pragma-push-pop]
#pragma push
^
foo.c:3:9: error: '#pragma arm' is an ARM Compiler 5 extension, and is not
supported by ARM Compiler 6 [-Warmcc-pragma-arm]
#pragma arm
^
foo.c:9:9: error: '#pragma pop' is an ARM Compiler 5 extension, and is not
supported by ARM Compiler 6 [-Warmcc-pragma-push-pop]
#pragma pop
^
3 errors generated.
加上编译选项后:
$ armclang --target=aarch64-arm-none-eabi -c foo.c -Wno-error=armcc-pragma-push-pop -Wno-error=armcc-pragma-arm
foo.c:2:9: warning: '#pragma push' is an ARM Compiler 5 extension, and is not
supported by ARM Compiler 6 [-Warmcc-pragma-push-pop]
#pragma push
^
foo.c:3:9: warning: '#pragma arm' is an ARM Compiler 5 extension, and is not
supported by ARM Compiler 6 [-Warmcc-pragma-arm]
#pragma arm
^
foo.c:9:9: warning: '#pragma pop' is an ARM Compiler 5 extension, and is not
supported by ARM Compiler 6 [-Warmcc-pragma-push-pop]
#pragma pop
^
3 warnings generated.