博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
(GCC) How can I hide "defined but not used" warnings in GCC?
阅读量:4179 次
发布时间:2019-05-26

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

2014-02-14 wcdj

May happy ending of love belong to every developer.

From: 

Question:

How can I hide "defined but not used" warnings in GCC?

Answers:

Just saw this thread while searching for solutions to this problem. I post here for completeness the solution I found...

The GCC compiler flags that control unused  include:

-Wunused-function-Wunused-label-Wunused-parameter-Wunused-value-Wunused-variable-Wunused (=all of the above)

Each of these has a corresponding negative form with "no-" inserted after the W which turns off the warning (in case it was turned on by -Wall, for example). Thus, in your case you should use

-Wno-unused-function
 

Of course this works for the whole code, not just compile-time asserts. For function-specific behaviour, have a look at.

处理办法:

GCC编译有一个参数-Wall,其实是包含其他许多的警告选项,如-Wunused, -Wformat等等。

假如我想使用-Wall选项,但会有许多函数定义未使用的提示,如何在使用-Wall参数的时候关闭-Wunused选项,请问有什么办法?

试试 -Wall -Wno-unused,我这里管用

stackoverflow:

转载地址:http://zbeai.baihongyu.com/

你可能感兴趣的文章
《tiny6410裸机程序》第四章:汇编与C混合编程
查看>>
《tiny6410裸机程序》第五章:汇编与C混合编程-LED跑马灯最终说明、myled再次精简
查看>>
《tiny6410裸机程序》第六章:myled通过usb下载至nandflash不能运行
查看>>
《tiny6410裸机程序》第七章:S3C6410外部中断简介
查看>>
《tiny6410裸机程序》第八章:S3C6410外部中断控制寄存器
查看>>
《tiny6410裸机程序》第八章:S3C6410总中断控制寄存器
查看>>
《tiny6410裸机程序》第九章:tiny6410按键控制蜂鸣器程序
查看>>
有关free()函数的一个问题
查看>>
《Android系统学习》之bug定位
查看>>
《Linux内核编程》第七章:USB CORE与USB键鼠驱动
查看>>
《Android系统学习》之JAVA与C混合编程——JNI
查看>>
《C预处理》之#ifndef
查看>>
《Linux内核编程》第十三章:Linux对进程内存的二级页式管理
查看>>
ARM协处理器
查看>>
《miniOS分析》前言
查看>>
《Linux内核编程》第十四章:Linux驱动基础
查看>>
Linux平台下ARM-Linux交叉编译工具链
查看>>
Window平台下ADS自带ARMCC编译工具链
查看>>
micro2440/tiny6410使用JLINK直接烧录nand flash
查看>>
C编译器、连接器与可执行机器码文件
查看>>