RealView Compiler Reference Guide

Keil™, An ARM® Company

Version 4.0


Table of Contents

Preface
About this book
Intended audience
Using this book
Typographical conventions
Further reading
Feedback
Feedback on RealView Compilation Tools
Feedback on this book
1. Introduction
1.1. About the ARM compiler
1.2. Source language modes
1.2.1. ISO C90
1.2.2. ISO C99
1.2.3. ISO C++
1.3. Language extensions and language compliance
1.3.1. Language extensions
1.3.2. Language compliance
1.4. The C and C++ libraries
2. Compiler Command-line Options
2.1. Command-line options
2.1.1. -Aopt
2.1.2. --allow_null_this, --no_allow_this
2.1.3. --alternative_tokens, --no_alternative_tokens
2.1.4. --anachronisms, --no_anachronisms
2.1.5. --apcs=qualifer...qualifier
2.1.6. --arm
2.1.7. --arm_only
2.1.8. --asm
2.1.9. --autoinline, --no_autoinline
2.1.10. --bigend
2.1.11. --bitband
2.1.12. --brief_diagnostics, --no_brief_diagnostics
2.1.13. --bss_threshold=num
2.1.14. -c
2.1.15. -C
2.1.16. --c90
2.1.17. --c99
2.1.18. --code_gen, --no_code_gen
2.1.19. --compatible=name
2.1.20. --compile_all_input, --no_compile_all_input
2.1.21. --cpp
2.1.22. --create_pch=filename
2.1.23. -Dname[(parm-list)][=def]
2.1.24. --data_reorder, --no_data_reorder
2.1.25. --debug, --no_debug
2.1.26. --debug_macros, --no_debug_macros
2.1.27. --default_extension=ext
2.1.28. --dep_name, --no_dep_name
2.1.29. --depend=filename
2.1.30. --depend_system_headers, --no_depend_system_headers
2.1.31. --depend_target=target
2.1.32. --device=list
2.1.33. --device=name
2.1.34. --device_opt=arg
2.1.35. --diag_error=tag[,tag,...]
2.1.36. --diag_remark=tag[,tag,... ]
2.1.37. --diag_style={arm|ide|gnu}
2.1.38. --diag_suppress=tag[,tag,...]
2.1.39. --diag_suppress=optimizations
2.1.40. --diag_warning=tag[,tag,...]
2.1.41. --diag_warning=optimizations
2.1.42. --dollar, --no_dollar
2.1.43. --dwarf2
2.1.44. --dwarf3
2.1.45. -E
2.1.46. --emit_frame_directives, --no_emit_frame_directives
2.1.47. --enum_is_int
2.1.48. --errors=filename
2.1.49. --exceptions, --no_exceptions
2.1.50. --exceptions_unwind, --no_exceptions_unwind
2.1.51. --export_defs_implicitly, --no_export_defs_implicitly
2.1.52. --extended_initializers, --no_extended_initializers
2.1.53. --feedback=filename
2.1.54. --force_new_nothrow, --no_force_new_nothrow
2.1.55. --forceinline
2.1.56. --fpmode=model
2.1.57. --fpu=list
2.1.58. --fpu=name
2.1.59. --friend_injection, --no_friend_injection
2.1.60. -g
2.1.61. --global_reg=reg_name[,reg_name,...]
2.1.62. --gnu
2.1.63. --gnu_instrument, --no_gnu_instrument
2.1.64. --gnu_version=version
2.1.65. --guiding_decls, --no_guiding_decls
2.1.66. --help
2.1.67. --hide_all, --no_hide_all
2.1.68. -Idir[,dir,...]
2.1.69. --ignore_missing_headers
2.1.70. --implicit_include, --no_implicit_include
2.1.71. --implicit_include_searches, --no_implicit_include_searches
2.1.72. --implicit_typename, --no_implicit_typename
2.1.73. --info=totals
2.1.74. --inline, --no_inline
2.1.75. --interface_enums_are_32_bit
2.1.76. --interleave
2.1.77. -Jdir[,dir,...]
2.1.78. --kandr_include
2.1.79. -Lopt
2.1.80. --library_interface=lib
2.1.81. --library_type=lib
2.1.82. --list
2.1.83. --list_macros
2.1.84. --littleend
2.1.85. --locale=lang_country
2.1.86. --long_long
2.1.87. --loose_implicit_cast
2.1.88. --lower_ropi, --no_lower_ropi
2.1.89. --lower_rwpi, --no_lower_rwpi
2.1.90. --ltcg
2.1.91. -M
2.1.92. --md
2.1.93. --message_locale=lang_country[.codepage]
2.1.94. --min_array_alignment=opt
2.1.95. --mm
2.1.96. --multibyte_chars, --no_multibyte_chars
2.1.97. --multifile, --no_multifile
2.1.98. --multiply_latency=cycles
2.1.99. --nonstd_qualifier_deduction, --no_nonstd_qualifier_deduction
2.1.100. -o filename
2.1.101. -Onum
2.1.102. --old_specializations, --no_old_specializations
2.1.103. -Ospace
2.1.104. -Otime
2.1.105. --parse_templates, --no_parse_templates
2.1.106. --pch
2.1.107. --pch_dir=dir
2.1.108. --pch_messages, --no_pch_messages
2.1.109. --pch_verbose, --no_pch_verbose
2.1.110. --pending_instantiations=n
2.1.111. --phony_targets
2.1.112. --pointer_alignment=num
2.1.113. --preinclude=filename
2.1.114. --preprocessed
2.1.115. --reduce_paths, --no_reduce_paths
2.1.116. --relaxed_ref_def, --no_relaxed_ref_def
2.1.117. --remarks
2.1.118. --remove_unneeded_entities, --no_remove_unneeded_entities
2.1.119. --restrict, --no_restrict
2.1.120. --retain=option
2.1.121. --rtti, --no_rtti
2.1.122. -S
2.1.123. --show_cmdline
2.1.124. --signed_bitfields, --unsigned_bitfields
2.1.125. --signed_chars, --unsigned_chars
2.1.126. --split_ldm
2.1.127. --split_sections
2.1.128. --strict, --no_strict
2.1.129. --strict_warnings
2.1.130. --sys_include
2.1.131. --thumb
2.1.132. --trigraphs, --no_trigraphs
2.1.133. -Uname
2.1.134. --unaligned_access, --no_unaligned_access
2.1.135. --use_pch=filename
2.1.136. --using_std, --no_using_std
2.1.137. --vfe, --no_vfe
2.1.138. --via=filename
2.1.139. --vla, --no_vla
2.1.140. --vsn
2.1.141. -W
2.1.142. --wchar, --no_wchar
2.1.143. --wchar16
2.1.144. --wchar32
2.1.145. --whole_program
2.1.146. --wrap_diagnostics, --no_wrap_diagnostics
3. Language Extensions
3.1. Preprocessor extensions
3.1.1. #assert
3.1.2. #include_next
3.1.3. #unassert
3.1.4. #warning
3.2. C99 language features available in C90
3.2.1. // comments
3.2.2. Subscripting struct
3.2.3. Flexible array members
3.3. C99 language features available in C++ and C90
3.3.1. Variadic macros
3.3.2. long long
3.3.3. restrict
3.3.4. Hex floats
3.4. Standard C language extensions
3.4.1. Constant expressions
3.4.2. Array and pointer extensions
3.4.3. Block scope function declarations
3.4.4. Dollar signs in identifiers
3.4.5. Top-level declarations
3.4.6. Benign redeclarations
3.4.7. External entities
3.4.8. Function prototypes
3.5. Standard C++ language extensions
3.5.1. ? operator
3.5.2. Declaration of a class member
3.5.3. friend
3.5.4. Read/write constants
3.5.5. Scalar type constants
3.5.6. Specialization of nonmember function templates
3.5.7. Type conversions
3.6. Standard C and standard C++ language extensions
3.6.1. Address of a register variable
3.6.2. Arguments to functions
3.6.3. Anonymous classes, structures and unions
3.6.4. Assembler labels
3.6.5. Empty declaration
3.6.6. Hexadecimal floating-point constants
3.6.7. Incomplete enums
3.6.8. Integral type extensions
3.6.9. Label definitions
3.6.10. Long float
3.6.11. Non static local variables
3.6.12. Structure, union, enum, and bitfield extensions
3.7. GNU language extensions
3.7.1. Alternate keywords
3.7.2. asm keyword
3.7.3. Case ranges
3.7.4. Cast of a union
3.7.5. Character escape sequences
3.7.6. Compound literals
3.7.7. Conditionals
3.7.8. Designated inits
3.7.9. Extended lvalues
3.7.10. Initializers
3.7.11. Inline
3.7.12. Labels as values
3.7.13. Pointer arithmetic
3.7.14. Statement expressions
3.7.15. Unnamed fields
4. Compiler-specific Features
4.1. Keywords and operators
4.1.1. __align
4.1.2. __alignof__
4.1.3. __ALIGNOF__
4.1.4. __asm
4.1.5. __forceinline
4.1.6. __global_reg
4.1.7. __inline
4.1.8. __int64
4.1.9. __INTADDR__
4.1.10. __irq
4.1.11. __packed
4.1.12. __pure
4.1.13. __smc
4.1.14. __softfp
4.1.15. __svc
4.1.16. __svc_indirect
4.1.17. __svc_indirect_r7
4.1.18. __value_in_regs
4.1.19. __weak
4.1.20. __writeonly
4.2. __declspec attributes
4.2.1. __declspec(dllexport)
4.2.2. __declspec(dllimport)
4.2.3. __declspec(noinline)
4.2.4. __declspec(noreturn)
4.2.5. __declspec(nothrow)
4.2.6. __declspec(notshared)
4.2.7. __declspec(thread)
4.3. Function attributes
4.3.1. __attribute__((alias))
4.3.2. __attribute__((always_inline))
4.3.3. __attribute__((const))
4.3.4. __attribute__((deprecated))
4.3.5. __attribute__((malloc))
4.3.6. __attribute__((noinline))
4.3.7. __attribute__((no_instrument_function))
4.3.8. __attribute__((nomerge))
4.3.9. __attribute__((nonnull))
4.3.10. __attribute__((noreturn))
4.3.11. __attribute__((notailcall))
4.3.12. __attribute__((pure))
4.3.13. __attribute__((section("name")))
4.3.14. __attribute__((unused))
4.3.15. __attribute__((used))
4.3.16. __attribute__((visibility("visibility_type")))
4.3.17. __attribute__((weak))
4.4. Type attributes
4.4.1. __attribute__((bitband))
4.4.2. __attribute__((aligned))
4.4.3. __attribute((packed))
4.4.4. __attribute__((transparent_union))
4.5. Variable attributes
4.5.1. __attribute__((alias))
4.5.2. __attribute__((at(address)))
4.5.3. __attribute__((aligned))
4.5.4. __attribute__((deprecated))
4.5.5. __attribute__((packed))
4.5.6. __attribute__((section("name")))
4.5.7. __attribute__((transparent_union))
4.5.8. __attribute__((unused))
4.5.9. __attribute__((used))
4.5.10. __attribute__((visibility("visibility_type")))
4.5.11. __attribute__((weak))
4.5.12. __attribute__((zero_init))
4.6. Pragmas
4.6.1. #pragma anon_unions, #pragma no_anon_unions
4.6.2. #pragma arm
4.6.3. #pragma arm section [section_sort_list]
4.6.4. #pragma diag_default tag[,tag,...]
4.6.5. #pragma diag_error tag[,tag,...]
4.6.6. #pragma diag_remark tag[,tag,...]
4.6.7. #pragma diag_suppress tag[,tag,...]
4.6.8. #pragma diag_warning tag[, tag, ...]
4.6.9. #pragma exceptions_unwind, #pragma no_exceptions_unwind
4.6.10. #pragma hdrstop
4.6.11. #pragma import symbol_name
4.6.12. #pragma import(__use_full_stdio)
4.6.13. #pragma inline, #pragma no_inline
4.6.14. #pragma no_pch
4.6.15. #pragma Onum
4.6.16. #pragma once
4.6.17. #pragma Ospace
4.6.18. #pragma Otime
4.6.19. #pragma pack(n)
4.6.20. #pragma pop
4.6.21. #pragma push
4.6.22. #pragma softfp_linkage, #pragma no_softfp_linkage
4.6.23. #pragma unroll [(n)]
4.6.24. #pragma unroll_completely
4.6.25. #pragma thumb
4.7. Instruction intrinsics
4.7.1. __breakpoint
4.7.2. __cdp
4.7.3. __clrex
4.7.4. __clz
4.7.5. __current_pc
4.7.6. __current_sp
4.7.7. __disable_fiq
4.7.8. __disable_irq
4.7.9. __enable_fiq
4.7.10. __enable_irq
4.7.11. __fabs
4.7.12. __fabsf
4.7.13. __force_stores
4.7.14. __ldrex
4.7.15. __ldrexd
4.7.16. __ldrt
4.7.17. __memory_changed
4.7.18. __nop
4.7.19. __pld
4.7.20. __pli
4.7.21. __qadd
4.7.22. __qdbl
4.7.23. __qsub
4.7.24. __rbit
4.7.25. __rev
4.7.26. __return_address
4.7.27. __ror
4.7.28. __schedule_barrier
4.7.29. __sev
4.7.30. __sqrt
4.7.31. __sqrtf
4.7.32. __ssat
4.7.33. __strex
4.7.34. __strexd
4.7.35. __strt
4.7.36. __swp
4.7.37. __usat
4.7.38. __wfe
4.7.39. __wfi
4.7.40. __yield
4.7.41. ARMv6 SIMD intrinsics
4.7.42. ETSI basic operations
4.7.43. C55x intrinsics
4.7.44. Named register variables
4.8. VFP status intrinsic
4.8.1. __vfp_status
4.9. GNU builtin functions
4.9.1. Nonstandard functions
4.9.2. C99 functions
4.9.3. C99 functions in the C90 reserved namespace
4.9.4. C94 functions
4.9.5. C90 functions
4.9.6. C99 floating-point functions
4.9.7. Other builtin functions
4.10. Compiler predefines
4.10.1. Predefined macros
4.10.2. Function names
5. C and C++ Implementation Details
5.1. C and C++ implementation details
5.1.1. Character sets and identifiers
5.1.2. Basic data types
5.1.3. Operations on basic data types
5.1.4. Structures, unions, enumerations, and bitfields
5.2. C++ implementation details
5.2.1. Using the ::operator new function
5.2.2. Tentative arrays
5.2.3. Old-style C parameters in C++ functions
5.2.4. Anachronisms
5.2.5. Template instantiation
5.2.6. Namespaces
5.2.7. C++ exception handling
5.2.8. Extern inline functions
A. Via File Syntax
A.1. Overview of via files
A.1.1. Via file evaluation
A.2. Syntax
B. Standard C Implementation Definition
B.1. Implementation definition
B.1.1. Translation
B.1.2. Environment
B.1.3. Identifiers
B.1.4. Characters
B.1.5. Integers
B.1.6. Floating-point
B.1.7. Arrays and pointers
B.1.8. Registers
B.1.9. Structures, unions, enumerations, and bitfields
B.1.10. Qualifiers
B.1.11. Expression evaluation
B.1.12. Preprocessing directives
B.1.13. Library functions
B.2. Behaviors considered undefined by the ISO C Standard
C. Standard C++ Implementation Definition
C.1. Integral conversion
C.2. Calling a pure virtual function
C.3. Major features of language support
C.4. Standard C++ library implementation definition
D. C and C++ Compiler Implementation Limits
D.1. C++ ISO/IEC standard limits
D.2. Limits for integral numbers
D.3. Limits for floating-point numbers

List of Tables

2.1. Compiling with the --asm option
2.2. Compatible processor or architecture combinations
2.3. Supported device names and permitted usage
2.4. Supported device names restricted by product variants
2.5. Compiling with the ---interleave option
2.6. Compiling with the -o option
2.7. Compiling without the -o option
4.1. Keyword extensions supported by the ARM compiler
4.2. __declspec attributes supported by the compiler and their equivalents
4.3. Function attributes supported by the compiler and their equivalents
4.4. Type attributes supported by the compiler and their equivalents
4.5. Variable attributes supported by the compiler and their equivalents
4.6. Pragmas supported by the compiler
4.7. Instruction intrinsics supported by the ARM compiler
4.8. Access widths supported by the __ldrex intrinsic
4.9. Access widths supported by the __ldrex intrinsic
4.10. Access widths supported by the __ldrt intrinsic
4.11. Access widths supported by the __strex intrinsic
4.12. Access widths supported by the __strexd intrinsic
4.13. Access widths supported by the __strt intrinsic
4.14. Access widths supported by the __swp intrinsic
4.15. ETSI basic operations supported in RVCT
4.16. ETSI status flags exposed in RVCT
4.17. TI C55x intrinsics supported in RVCT
4.18. Named registers available on ARM architecture-based processors
4.19. Named registers available on targets with a VFP
4.20. Predefined macros
4.21. Thumb architecture versions in relation to ARM architecture versions
4.22. Builtin variables
5.1. Character escape codes
5.2. Size and alignment of data types
C.1. Major feature support for language
D.1. Implementation limits
D.2. Integer ranges
D.3. Floating-point limits
D.4. Other floating-point characteristics

Proprietary Notice

Words and logos marked with ® or ™ are registered trademarks or trademarks owned by ARM® Limited. Other brands and names mentioned herein may be the trademarks of their respective owners.

Neither the whole nor any part of the information contained in, or the product described in, this document may be adapted or reproduced in any material form except with the prior written permission of the copyright holder.

The product described in this document is subject to continuous developments and improvements. All particulars of the product and its use contained in this document are given by ARM in good faith. However, all warranties implied or expressed, including but not limited to implied warranties of merchantability, or fitness for purpose, are excluded.

This document is intended only to assist the reader in the use of the product. ARM Limited shall not be liable for any loss or damage arising from the use of any information in this document, or any error or omission in such information, or any incorrect use of the product.

Where the term ARM is used it means “ARM or any of its subsidiaries as appropriate”.

Some material in this document is based on IEEE 754 - 1985 IEEE Standard for Binary Floating-Point Arithmetic. The IEEE disclaims any responsibility or liability resulting from the placement and use in the described manner.

Confidentiality Status

This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in accordance with the terms of the agreement entered into by ARM and the party that ARM delivered this document to.

Unrestricted Access is an ARM internal classification.

Product Status

The information in this document is final, that is for a developed product.

Revision History
Revision A May 2007 Release for RVCT for µVision v3.1
Revision B December 2008 Release for RVCT for µVision v4.0
ARM KUI 0098A
Non-Confidential