9.150 Predefined macros

The ARM compiler predefines a number of macros. These macros provide information about toolchain version numbers and compiler options.

The following table lists the macro names predefined by the ARM compiler for C and C++. Where the value field is empty, the symbol is only defined.

Table 9-21 Predefined macros

Name Value When defined
__arm__ -
Always defined for the ARM compiler, even when you specify the --thumb option.
See also __ARMCC_VERSION.
__ARMCC_VERSION ver
Always defined. It is a decimal number, and is guaranteed to increase between releases. The format is PVVbbbb where:
  • P is the major version
  • VV is the minor version
  • bbbb is the build number.

Note

Use this macro to distinguish between ARM Compiler 4.1 or later, and other tools that define __arm__.
__APCS_INTERWORK -
When you specify the --apcs /interwork option or set the target processor architecture to ARMv5T or later.
__APCS_ROPI -
When you specify the --apcs /ropi option.
__APCS_RWPI -
When you specify the --apcs /rwpi option.
__APCS_FPIC -
When you specify the --apcs /fpic option.
__ARRAY_OPERATORS - In C++ compiler mode, to specify that array new and delete are enabled.
__BASE_FILE__ name
Always defined. Similar to __FILE__, but indicates the primary source file rather than the current one (that is, when the current file is an included file).
__BIG_ENDIAN - If compiling for a big-endian target.
_BOOL -
In C++ compiler mode, to specify that bool is a keyword.
__cplusplus - In C++ compiler mode.
__CC_ARM 1
Always set to 1 for the ARM compiler, even when you specify the --thumb option.
__DATE__ date Always defined.
__EDG__ -
Always defined.
__EDG_IMPLICIT_USING_STD -
In C++ mode when you specify the --using_std option.
__EDG_VERSION__ -
Always set to an integer value that represents the version number of the Edison Design Group (EDG) front-end. For example, version 3.8 is represented as 308.

Note

The version number of the EDG front-end does not necessarily match the version number of the ARM compiler toolchain.

__EXCEPTIONS 1
In C++ mode when you specify the --exceptions option.
__FEATURE_SIGNED_CHAR -
When you specify the --signed_chars option (used by CHAR_MIN and CHAR_MAX).
__FILE__ name Always defined as a string literal.
__FP_FAST -
When you specify the --fpmode=fast option.
__FP_FENV_EXCEPTIONS -
When you specify the --fpmode=ieee_full or --fpmode=ieee_fixed options.
__FP_FENV_ROUNDING -
When you specify the --fpmode=ieee_full option.
__FP_IEEE -
When you specify the --fpmode=ieee_full, --fpmode=ieee_fixed, or --fpmode=ieee_no_fenv options.
__FP_INEXACT_EXCEPTION -
When you specify the --fpmode=ieee_full option.
__IMPLICIT_INCLUDE -
When you specify the --implicit_include option.
__LINE__ num Always set. It is the source line number of the line of code containing this macro.
__MODULE__ mod
Contains the filename part of the value of __FILE__.
__MULTIFILE - When you explicitly or implicitly use the --multifile option.a
__OPTIMISE_LEVEL num
Always set to 2 by default, unless you change the optimization level using the -Onum option.a
__OPTIMISE_SPACE -
When you specify the -Ospace option.
__OPTIMISE_TIME -
When you specify the -Otime option.
__OPTIMIZE__ -
When -O1, -O2, or -O3 is specified in GNU mode.
__OPTIMIZE_SIZE__ -
When -Ospace is specified in GNU mode.
__PLACEMENT_DELETE - In C++ mode to specify that placement delete (that is, an operator delete corresponding to a placement operator new, to be called if the constructor throws an exception) is enabled. This is only relevant when using exceptions.
__RTTI - In C++ mode when RTTI is enabled.
__sizeof_int 4
For sizeof(int), but available in preprocessor expressions.
__sizeof_long 4
For sizeof(long), but available in preprocessor expressions.
__sizeof_ptr 4
For sizeof(void *), but available in preprocessor expressions.
__SOFTFP__ -
If compiling to use the software floating-point calling standard and library. Set when you specify the --fpu=softvfp option for ARM or Thumb, or when you specify --fpu=softvfp+vfpv2 for Thumb.
__STDC__ - In all compiler modes.
__STDC_VERSION__ - Standard version information.
__STRICT_ANSI__ -
When you specify the --strict option.
__SUPPORT_SNAN__ - Support for signalling NaNs when you specify --fpmode=ieee_fixed or --fpmode=ieee_full.
__TARGET_ARCH_ARM num The number of the ARM base architecture of the target processor irrespective of whether the compiler is compiling for ARM or Thumb. For possible values of __TARGET_ARCH_ARM in relation to the ARM architecture versions, see the table below.
__TARGET_ARCH_THUMB num
The number of the Thumb base architecture of the target processor irrespective of whether the compiler is compiling for ARM or Thumb. The value is defined as zero if the target does not support Thumb. For possible values of __TARGET_ARCH_THUMB in relation to the ARM architecture versions, see the table below.
__TARGET_ARCH_XX -
XX represents the target architecture and its value depends on the target architecture. For example, if you specify the compiler options --cpu=4T or --cpu=ARM7TDMI then __TARGET_ARCH_4T is defined.
__TARGET_CPU_XX -
XX represents the target processor. The value of XX is derived from the --cpu compiler option, or the default if none is specified. For example, if you specify the compiler option --cpu=ARM7TM then __TARGET_CPU_ARM7TM is defined and no other symbol starting with __TARGET_CPU_ is defined.
If you specify the target architecture, then __TARGET_CPU_generic is defined.
If the processor name specified with --cpu is in lowercase, it is converted to uppercase. For example, --cpu=Cortex-R4 results in __TARGET_CPU_CORTEX_R4 being defined (rather than __TARGET_CPU_Cortex_R4).
If the processor name contains hyphen (-) characters, these are mapped to an underscore (_). For example, --cpu=ARM1136JF-S is mapped to __TARGET_CPU_ARM1136JF_S.
__TARGET_FEATURE_DOUBLEWORD -
ARMv5T and above.
__TARGET_FEATURE_DSPMUL - If the DSP-enhanced multiplier is available, for example ARMv5TE.
__TARGET_FEATURE_MULTIPLY -
If the target architecture supports the long multiply instructions MULL and MULAL.
__TARGET_FEATURE_DIVIDE -
If the target architecture supports the hardware divide instruction (that is, ARMv7-M or ARMv7-R).
__TARGET_FEATURE_THUMB - If the target architecture supports Thumb, ARMv4T or later.
__TARGET_FPU_xx -
One of the following is set to indicate the FPU usage:
  • __TARGET_FPU_NONE
  • __TARGET_FPU_VFP
  • __TARGET_FPU_SOFTVFP
In addition, if compiling with one of the following --fpu options, the corresponding target name is set:
  • --fpu=softvfp+vfpv2, __TARGET_FPU_SOFTVFP_VFPV2
  • --fpu=softvfp+vfpv3, __TARGET_FPU_SOFTVFP_VFPV3
  • --fpu=softvfp+vfpv3_fp16, __TARGET_FPU_SOFTVFP_VFPV3_FP16
  • --fpu=softvfp+vfpv3_d16, __TARGET_FPU_SOFTVFP_VFPV3_D16
  • --fpu=softvfp+vfpv3_d16_fp16, __TARGET_FPU_SOFTVFP_VFPV3_D16_FP16
  • --fpu=softvfp+vfpv4, __TARGET_FPU_SOFTVFP_VFPV4
  • --fpu=softvfp+vfpv4_d16, __TARGET_FPU_SOFTVFP_VFPV4_D16
  • --fpu=softvfp+fpv4-sp, __TARGET_FPU_SOFTVFP_FPV4_SP
  • --fpu=vfp, __TARGET_FPU_VFPV2
  • --fpu=vfpv2, __TARGET_FPU_VFPV2
  • --fpu=vfpv3, __TARGET_FPU_VFPV3
  • --fpu=vfpv3_fp16, __TARGET_FPU_VFPV3_FP16
  • --fpu=vfpv3_d16, __TARGET_FPU_VFPV3_D16
  • --fpu=vfpv3_d16_fp16, __TARGET_FPU_VFPV3_D16_FP16
  • --fpu=vfpv4, __TARGET_FPU_VFPV4
  • --fpu=vfpv4_d16, __TARGET_FPU_VFPV4_D16
  • --fpu=fpv4-sp, __TARGET_FPU_FPV4_SP
__TARGET_PROFILE_R   When you specify the --cpu=7-R option.
__TARGET_PROFILE_M  
When you specify any of the following options:
  • --cpu=6-M
  • --cpu=6S-M
  • --cpu=7-M
__thumb__ -
When the compiler is in Thumb state. That is, you have either specified the --thumb option on the command-line or #pragma thumb in your source code.

Note

  • The compiler might generate some ARM code even if it is compiling for Thumb.
  • __thumb and __thumb__ become defined or undefined when using #pragma thumb or #pragma arm, but do not change in cases where Thumb functions are generated as ARM code for other reasons (for example, a function specified as __irq).
__TIME__ time
Always defined.
_WCHAR_T -
In C++ mode, to specify that wchar_t is a keyword.
The following table shows the possible values for __TARGET_ARCH_THUMB, and how these values relate to versions of the ARM architecture.
 
 

9.150 Predefined macros的更多相关文章

  1. Cross Platform Note: STD C++ Preprocessor directives & pre-defined macros

    ref: http://www.cplusplus.com/doc/tutorial/preprocessor/ concolusion: directives: #define #undef #in ...

  2. Windows Platform Predefined Macros

    https://msdn.microsoft.com/en-us/library/b0084kay.aspx

  3. [原]__FILE__宏

    在vs中__FILE__宏代表了当前文件,如果有/FC那么__FILE__代表了当前文件的全路径!否则只表示当前文件名   参考 https://msdn.microsoft.com/en-us/li ...

  4. C++预处理详解

    本文在参考ISO/IEC 14882:2003和cppreference.com的C++ Preprocessor的基础上,对C++预处理做一个全面的总结讲解.如果没有特殊说明,所列内容均依据C++9 ...

  5. VS2010 C++环境下DLL和LIB文件目录及名称修改

    VS2010 C++环境下DLL和LIB文件目录及名称修改 转自:http://blog.csdn.net/archielau/article/details/8507581 DLL工程,Debug版 ...

  6. gcc 编译器参数

    一.GCC编译过程 参考:http://hi.baidu.com/zengzhaonong/item/c00e079f500adccab625314f------------------------- ...

  7. C++ 中常见预定义宏的使用

    http://blog.csdn.net/hgl868/article/details/7058906 替代字符串: #define DOWNLOAD_IMAGE_LOG /var/log/png.l ...

  8. C++ 中宏的使用 --来自:http://blog.csdn.net/hgl868/article/details/7058906

    宏在代码中的使用实例: g_RunLog2("Middleware client for Linux, build:%s %s", __DATE__, __TIME__); 下面详 ...

  9. [C] zintrin.h : 智能引入intrinsic函数。支持VC、GCC,兼容Windows、Linux、Mac OS X

    博客来源:http://blog.csdn.net/zyl910/article/details/8100744 现在很多编译器支持intrinsic函数,这给编写SSE等SIMD代码带来了方便.但是 ...

  10. __LINE__ __DATE__ __FILE__ __TIME__ 等宏定义解释

    Names the predefined ANSI C and Microsoft C++ implementation macros. The compiler recognizes predefi ...

随机推荐

  1. python 动态导入模块并结合反射,动态获取类、方法(反射太好用),动态执行方法

    背景: 关键字驱动框架,不同的关键字方法分别定义在不同的类,真正执行关键字方法又在不同的类(简称A),这样就需要在执行前,要在文件A下import要使用的模块,如果有很多页面操作或很多模块时,就需要每 ...

  2. Vite-Wechat网页聊天室|vite5.x+vue3+pinia+element-plus仿微信客户端

    基于Vue3+Pinia+ElementPlus仿微信网页聊天模板Vite5-Vue3-Wechat. vite-wechat使用最新前端技术vite5+vue3+vue-router@4+pinia ...

  3. 大数据面试吹牛草稿V2.0

    面试吹牛之前先打个草稿! 各位面试官好! 我叫 xxx,毕业于 xxx,之前在 xxx 公司待了 1 年多,期间⼀直从事的是 IT 行业,刚开始的时候做的是 Java 开发后来转岗到大数据方向做大数据 ...

  4. 关于docker-compose up -d 出现超时情况处理

    由于要搭建一个ctf平台,用docker一键搭建是出现超时情况 用了很多办法,换源,等之类的一样没办法,似乎它就是只能用官方那个一样很怪. 只能用一种笨办法来处理了,一个个pull. 打个比如: 打开 ...

  5. FM20S用户手册--Linux系统启动卡制作及系统固化

  6. QT自定义右键菜单

    利用QMenu和QAction可以实现非常实用的右键菜单功能.具体实现思路如下: 1.在xxx.h文件中添加如下头文件 #include <QMenu> #include <QCon ...

  7. C#多窗口切换的实现

    本文关键字: 多窗口切换 label splitContainer 窗口背景颜色设置 字体设置 窗口布局 按钮事件 按钮 新建项目: 开发MainForm: MainForm先添加1个splitCon ...

  8. 1. C++ 开发环境

    C++ 开发环境 Visual C++ / GCC(G++) / Clang(Clang++) 集成开发环境:Visual Studio / CodeLite / Code::blocks / CLi ...

  9. Python爬虫Post请求返回值为-1000

    今天写了一个简单的爬虫程序,为了爬取kfc官网的餐厅数据,代码如下 # ajax的post请求--肯德基官网 def create_request(page): url='http://www.kfc ...

  10. 浅谈:HTTP 和 HTTPS 通信原理

    1.HTTP基本概念 1.1 HTTP是什么?  HTTP (超文本传输协议)协议被用于在 Web 浏览器和网站服务器之间传递信息, HTTP 协议以明文方式发送内容,不提供任何方式的数据加密,如果攻 ...