博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PCLint 帮助中关于如何获得gcc/g++编译宏定义和头文件搜索目录的方法说明
阅读量:5023 次
发布时间:2019-06-12

本文共 2506 字,大约阅读时间需要 8 分钟。

/* co-gcc.lnt: This is the seed file for configuring Lint for use with

GCC versions 2.95.3 and later.
Like all compiler options files this file is intended to be used
as follows:
lint co-gcc.lnt source-files-to-be-linted
Some of the information that co-gcc.lnt requires needs to be
furnished with the help of the gcc system itself.
If any of these directions are unclear, you may gain a better insight
into what is happening by checking the file gcc-readme.txt
For C, first create an empty file named empty.c and then
run the command (options are case sensitive):
gcc -E -dM empty.c >lint_cmac.h
This will capture macro definitions in a file that will be included
automatically at the beginning of each module by use of the -header
option within co-gcc.lnt. The macros may change as you change
compiler options so that ultimately you may want to incorporate
this step into a make facility.
Next we need to determine the search directories. If you run
gcc -c -v empty.c
you will see among other things this coveted list. For example you
might get:
...
#include "..." search starts here
#include <...> search starts here
/usr/local/include
/usr/lib/gcc/i686-apple-darwin8/4.0.1/include
/usr/include
/System/Library/Frameworks
/Library/Frameworks
End of search list.
...
For each directory shown (there are five in the list above) prefix
the directory name by a "--i" and place it in a file whose name is,
say, include.lnt. You may then begin linting programs by using the
command
lint co-gcc.lnt include.lnt source-files
Note: it is conventional to place both .lnt files into a single .lnt
file called std.lnt
For C++, run the command (options are again case sensitive):
g++ -E -dM empty.c >lint_cppmac.h
This will capture C++ macro definitions in a file that will be
included automatically at the beginning of each C++ module
at the request of co-gcc.lnt.
Next we need to determine C++ search directories. If you run
g++ -c -v empty.c
As in the case of C you should prepend a --i onto each directory
displayed and place these options into a file such as include.lnt.
Again, there is nothing sacred about the name and if you intend to
do mixed C and C++ programming it will be necessary for you to use
a differently named file. The rest proceeds as before.
Note, some options in this file (such as the size options, i.e. -sp4
indicating that pointers are four bytes wide) may need to be changed.
See "System Dependent Options" below.
*/

转载于:https://www.cnblogs.com/dongzhiquan/archive/2012/10/21/2733002.html

你可能感兴趣的文章
Nginx + Tomcat 反向代理 如何在高效的在一台服务器部署多个站点
查看>>
在Vs2012 中使用SQL Server 2012 Express LocalDB打开Sqlserver2012数据库
查看>>
在Macos下完美解决Adobe Dreamweaver CC 2018 汉化及操作方法
查看>>
【转】 Newtonsoft.Json高级用法
查看>>
CodeBlocks X64 SVN 编译版
查看>>
Excel催化剂开源第42波-与金融大数据TuShare对接实现零门槛零代码获取数据
查看>>
bug记录_signalr执行$.connnection.testhub结果为空
查看>>
【转】常用的latex宏包
查看>>
[TMS320C674x] 一、GPIO认识
查看>>
酷狗的皮肤文件存放在哪
查看>>
iOS RunLoop简介
查看>>
C++的引用
查看>>
T-SQL查询进阶--深入浅出视图
查看>>
MapKeyboard 键盘按键映射 机械革命S1 Pro-02
查看>>
Android读取url图片保存及文件读取
查看>>
完整ASP.Net Excel导入
查看>>
判断CPU大小端示例代码
查看>>
ARTS打卡第13周
查看>>
循环队列的运用---求K阶斐波那契序列
查看>>
pta 编程题14 Huffman Codes
查看>>