public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "charlie" <uber@juun.com>
To: uber@juun.com
Cc: gcc-help@gcc.gnu.org
Subject: Re: [Resolved] how to warn on unused preprocessor defines...
Date: Fri, 11 Jan 2008 18:25:00 -0000	[thread overview]
Message-ID: <200801102146.m0ALkLKg002581@rs34.luxsci.com> (raw)


Found it:

-Wunused-macros


#include <stdio.h>

#define aaa 1
#define bbb 2
#define ccc 3

int main()
{
	printf("%d:%d\n", aaa, ccc);
	return 0;
};


> gcc -Wunused-macros -o test test.c
test.c:4:1: warning: macro "bbb" is not used


- chuck




On January 10, 2008, charlie wrote:

> 
> There are hundreds of them that are suspect.  (project inherited from 
> someone else who went a little crazy with the #defines... #defines we 
> will never ever use)
> 
> That's the problem.  I want the compiler to help me out a little.
> 
> Thanks.
> 
> - chuck
> 
> 
> 
> On January 10, 2008, Andrew Bell wrote:
> 
>> On Jan 10, 2008 1:51 PM, charlie <uber@juun.com> wrote:
>>> 
>>> How can I tell gcc/cpp to warn on (or in some other way point out)
>>> unused preprocessor defines?
>> 
>> Comment them out and see if the compiler complains.
>> 
>> -- 
>> Andrew Bell
>> andrew.bell.ia@gmail.com
>> 
> 

                 reply	other threads:[~2008-01-10 21:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200801102146.m0ALkLKg002581@rs34.luxsci.com \
    --to=uber@juun.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).