Skip to content

Extend UNITY_NORETURN mapping for (older) IAR compilers #780

@rstahn

Description

@rstahn

#742 introduced a mapping of the define UNITY_NORETURN for different C/C++ standards and specific compilers (GCC, Visual Studio, etc.). This mapping can be extended for IAR compilers which provide a __noreturn keyword. This seems to be supported by IAR compilers for different platforms (ARM, AVR, MSP430), which can be identified by the define __IAR_SYSTEMS_ICC__ providing an indication for the compiler platform version (see also cmake IAR compiler identifcation).

Proposed code extension:

    #elif defined(__IAR_SYSTEMS_ICC__) && (__IAR_SYSTEMS_ICC__ >= 8)
      /* For IAR compilers supporting at least C99 use the IAR specific '__noreturn' keyword */
      /* Based on tests and: */
      /* https://wwwfiles.iar.com/arm/webic/doc/EWARM_DevelopmentGuide.ENU.pdf */
      /* https://wwwfiles.iar.com/AVR/webic/doc/EWAVR_CompilerGuide.pdf */
      /* https://wwwfiles.iar.com/msp430/webic/doc/EW430_CompilerReference.pdf */
      #define UNITY_NORETURN __noreturn

Recent IAR compiler versions support the latest C11/C21 and CPP standards and already use the standard-conform mappings. The addition therefore mainly aims at older compiler versions supporting C99 only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions