在看公司公共库的头文件中发现了:#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. spring boot 环境搭建

    1.开发工具 https://spring.io/tools/sts/all 2.demo https://start.spring.io 3.下载maven https://maven.apache ...

  2. quartz实现定时任务调度

    一. 业务需求: 实际工作中我们一般会遇到这种需求: 使用Ajax技术每隔几秒从缓存或数据库中读取一些数据, 然后再显示在页面上, 眼下有一个比較好的定时调度框架: quartz能够满足我们的需求. ...

  3. Openerp 7.0消息推送

    在一个文档的state变化时,需要将变化情况告知关注用户,通过研究account.invoice的代码,发现是经过如下过程实现此功能的: 1.添加一个消息阶段: <record id=" ...

  4. JQuery URL的GET参数值获取方法

    // jQuery url get parameters function [获取URL的GET参数值] // <code> // var GET = $.urlGet(); //获取UR ...

  5. EXCEPTION-SQL语句

      CreateTime--2017年1月12日14:37:52Author:Marydon 声明:异常类文章主要是记录了我遇到的异常信息及解决方案,解决方案大部分都是百度解决的,(这里只是针对我遇到 ...

  6. JUC-闭锁:CountDownLatch

    CountDownLatch::闭锁,在完成某些运算是,只有其他所有线程的运算全部完成,当前运算才继续执行. 实例化:参数:设置一个计数器的值. final CountDownLatch latch ...

  7. MySQL Workbench--Window安装试用

    MySQL Workbench 01.概述 MySQL Workbench provides DBAs and developers an integrated tools environment f ...

  8. Windows I/O完成端口

    内容: 1.基本概念     2.WINDOWS完成端口的特点     3.完成端口(Completion Ports )相关数据结构和创建     4.完成端口线程的工作原理     5.Windo ...

  9. 利用 AFN 上传相册或拍照图片

    概述 自定义上传图片请求,自定义调取相册及拍照,方便多处使用时调用. 详细 代码下载:http://www.demodashi.com/demo/10718.html 由于项目中多处需要上传图片,我们 ...

  10. HDUOJ Children’s Queue

    Children’s Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...