12.07.2015 Views

RealView 编译工具编译器参考指南 - ARM Information Center

RealView 编译工具编译器参考指南 - ARM Information Center

RealView 编译工具编译器参考指南 - ARM Information Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

编 译 器 特 有 的 功 能4.3.9 __attribute__((nonnull))此 函 数 属 性 指 定 不 假 定 为 空 指 针 的 函 数 参 数 。 这 将 使 编 译 器 在 遇 到 此 类 参 数 时生 成 警 告 。注 意此 函 数 属 性 是 <strong>ARM</strong> 编 译 器 支 持 的 GNU 编 译 器 扩 展 。语 法__attribute__((nonnull(arg-index, ...)))其 中 , arg-index, ... 表 示 参 数 索 引 列 表 。如 果 未 指 定 参 数 索 引 列 表 , 则 所 有 指 针 参 数 都 被 标 记 为 非 零 。示 例以 下 声 明 是 等 效 的 :void * my_memcpy (void *dest, const void *src, size_t len)__attribute__((nonnull (1, 2)));void * my_memcpy (void *dest, const void *src, size_t len)__attribute__((nonnull));4.3.10 __attribute__((noreturn))此 函 数 属 性 指 示 编 译 器 函 数 不 返 回 值 。 随 后 , 编 译 器 可 通 过 删 除 从 不 会 到 达 的代 码 来 执 行 优 化 。注 意此 函 数 属 性 是 <strong>ARM</strong> 编 译 器 支 持 的 GNU 编 译 器 扩 展 。 它 具 有 等 效 的 __declspec__declspec(noreturn)。 但 是 , __attribute((noreturn)) 和 __declspec(noreturn) 的不 同 之 处 在 于 , 在 编 译 函 数 定 义 时 , 如 果 函 数 到 达 显 式 或 隐 式 返 回 , 则__attribute((noreturn)) 将 被 忽 略 , 同 时 编 译 器 生 成 警 告 消 息 , 而__declspec(noreturn) 不 会 被 忽 略 。示 例int Function_Attributes_NoReturn_0(void) __attribute__ ((noreturn));4-36 Copyright © 2007-2009 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0348BCNon-Confidential, Unrestricted AccessID090708

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!