在看公司公共库的头文件中发现了:#pragma GCC system_header一行,以前没有见过这种用法,在网上查了一下,解释如下:

从#pragma GCC system_header直到文件结束之间的代码会被编译器视为系统头文件之中的代码。系统头文件中的代码往往不能完全遵循C标准, 所以头文件之中的警告信息往往不显示。(除非用 #warning显式指明)。

可以查看gcc参考手册:http://gcc.gnu.org/onlinedocs/cpp/System-Headers.html#System-Headers

The header files declaring interfaces to the operating system and runtime libraries often cannot be written in strictly conforming C. Therefore, GCC gives code found in system headersspecial treatment. All warnings, other than those generated by ‘#warning’ (see Diagnostics), are suppressed while GCC is processing a system header. Macros defined in a system header are immune to a few warnings wherever they are expanded. This immunity is granted on an ad-hoc basis, when we find that a warning generates lots of false positives because of code in macros defined in system headers.

Normally, only the headers found in specific directories are considered system headers. These directories are determined when GCC is compiled. There are, however, two ways to make normal headers into system headers:

  • Header files found in directories added to the search path with the -isystem and -idirafter command-line options are treated as system headers for the purposes of diagnostics.
  • There is also a directive, #pragma GCC system_header, which tells GCC to consider the rest of the current include file a system header, no matter where it was found. Code that comes before the ‘#pragma’ in the file is not affected. #pragma GCC system_header has no effect in the primary source file.

#pragma GCC system_header用法的更多相关文章

  1. 【转】各个层次的gcc警告 #pragma GCC diagnostic ignored "-Wunused-parameter" --不错

    原文网址:http://blog.csdn.net/lizzywu/article/details/9419145 各个层次的gcc警告从上到下覆盖 变量(代码)级:指定某个变量警告 int a __ ...

  2. 编译器处理警告、错误 #pragma GCC diagnostic ignored "-Wunused"

    各个层次的gcc警告从上到下覆盖 变量(代码)级:指定某个变量警告 int a __attribute__ ((unused));指定该变量为"未使用的".即使这个变量没有被使用, ...

  3. gcc基本用法

    GCC基本用法 GCC最基本的用法是: gcc [option] filenames option:编译器所需要的编译选项 filenames:要编译的文件名 gcc编译流程 都以 hello.c 为 ...

  4. gcc编译器用法

    一个用c语言写的程序把他编译成计算机可执行的文件,一般有4个步骤 /*================================================================ ...

  5. gcc编译器用法(自学总结)

    GCC仅仅意味着GNU C Compiler. gcc工作四个步骤:预处理,编译,汇编,连接. 1.预处理: 编译器将C源代码中的包含的头文件如stdio.h编译进来,用户可以使用gcc的选项&quo ...

  6. 关于pragma pack的用法(一)

    一个很重要的参数#pragma pack(n) 数据边界对齐方式:以如下结构为例: struct {                    char a;                    WOR ...

  7. IOS笔记 #pragma mark的用法

    简单的来说就是为了方便查找和导航代码用的. 下面举例如何快速的定位到我已经标识过的代码. #pragma mark 播放节拍器 - (void) Run:(NSNumber *)tick { //.. ...

  8. (转)IOS笔记 #pragma mark的用法

    简单的来说就是为了方便查找和导航代码用的.   下面举例如何快速的定位到我已经标识过的代码.     #pragma mark 播放节拍器 - (void) Run:(NSNumber *)tick{ ...

  9. #pragma的一些用法

    1.#pragma message message 参数:Message参数能够在编译信息输出窗口输出相应的信息,这对于源代码的信息控制特别重要,其使用方法为: #pragma message(&qu ...

随机推荐

  1. [转]自定义Drawable实现灵动的红鲤鱼动画(上篇)

    此篇中的小鱼动画是模仿国外一个大牛做的flash动画,第一眼就爱上它了,简约灵动又不失美学,于是抽空试着尝试了一下,如下是我用Android实现的效果图:   小鱼儿 由于整个绘制分析过程比较繁琐所以 ...

  2. client高性能组件化框架React简单介绍、特点、环境搭建及经常使用语法

    [本文源址:http://blog.csdn.net/q1056843325/article/details/54729657 转载请加入该地址] 明天就是除夕了 预祝大家新春快乐 [ ]~( ̄▽ ̄) ...

  3. 在 Java SE 6 中监视和诊断性能问题

    Java™ Platform, Standard Edition 6 (Java SE) 专注于提升性能,提供的增强工具可以管理和监视应用程序以及诊断常见的问题.本文将介绍 Java SE 平台中监视 ...

  4. 【线程篇】stop() 和suspend()

    1.为什么不推荐用 stop()和 suspend() stop这个方法将终止所有未结束的方法,包括run方法.当一个线程停止时候,他会立即释放所有他锁住对象上的锁.这会导致对象处于不一致的状态.假如 ...

  5. 算法导论(CLRS)答案

    算法导论(CLRS)答案 Chapter Section I 1 2 p II 1 2 3 p III 1 2 p IV 1 2 3 4 p V 1 2 3 4 p VI 1 2 3 4 5 p VI ...

  6. js-form表单元素的自定义属性

      form表单元素的自定义属性 CreateTime--2016年9月22日09:03:40 Author:Marydon 场景: <script type="text/javasc ...

  7. 〖Android〗/system/etc/event-log-tags

    一博客中,一段的注释的解释:[From: http://blog.csdn.net/hustpzb/article/details/8525324] /** * Access to the syste ...

  8. python之函数用法iter()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法iter() #iter() #说明:对一个对象调用 iter() 就可以得到它的迭代 ...

  9. IP共享重新验证

    大家在进入共享机器的时候,在运行窗口中输入了 \\IP 然后会有账户和密码验证, 有时为了方便选择了记忆密码账号,这样下次就不会再验证了. 但是,有时你当时输入的账户没有你需要打开的某个文件的权限,就 ...

  10. 华硕M2A-VM+AMD4000超频方法

    华硕M2A-VM+AMD4000超频方法2009-07-07 09:42 1.4000+默认外频为200,倍频已经锁定为10.5,实际运行频率为2100HZ.超频是通过提高外频来实现的,只要适当提高外 ...