473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to find unused macros in our program?

Hi All

I have a simple program

#define DUMMY_MACRO 10

main()
{
int a;
}

When I execute lint check for the above file it states

variable "a" is unused.

Likewise is there any way to find out the macros which were used not used in our file

Thanks & Regards
Sathish Kumar
Sep 8 '08 #1
6 5239
weaknessforcats
9,208 Expert Mod 8TB
There's no direct way but you can comment-out a macro and re-compile. If you get errors, the macro is being used.
Sep 8 '08 #2
Banfa
9,065 Expert Mod 8TB
There's no direct way but you can comment-out a macro and re-compile. If you get errors, the macro is being used.
Not this method doesn't work for macros being used to control code inclusion, you just get a different program.
Sep 8 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
Not this method doesn't work for macros being used to control code inclusion, you just get a different program.
oops. Forgot about that.
Sep 9 '08 #4
donbock
2,426 Expert 2GB
There are varieties of lint that will report precisely the condition you're interested in. I seek guidance from the moderator regarding whether it would be inappropriate product-pushing to mention the lint that I use.
Cheers,
donbock
Sep 9 '08 #5
Banfa
9,065 Expert Mod 8TB
Posting the name, maker and version of the product would be fine.

Posting a link to a page selling it would not be fine that would be advertising.
Sep 10 '08 #6
donbock
2,426 Expert 2GB
Gimpel Software offers Flexelint (for unix) / PC-Lint (for Windows). This static analysis tool can report all unused macros. One problem with static analysis is the signal-to-noise ratio. You can easily configure PC-Lint to suppress warnings that you don't care about. I've used this tool for the last 15 years. I wouldn't dream of working on a C project without it.

FYI, I have no relationship with Gimpel Software other than "satisfied customer".

Cheers,
donbock
Sep 10 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
11
by: Michael B Allen | last post by:
Is there a standard method for supressing warnings regarding unused parameters? I have a function that might be called hundreds of thousands of times that looks like this: const void *...
2
by: bugzilla | last post by:
hi, all. I want to know which flag can be used to give me a warning that one declared function is not called in the program. for example: #include <stdio.h> int Nouse(); int main() {
4
by: mike | last post by:
I need to do a minor update to a 8051 program written in assembler in 1994 and assembled on a machine/language that no longer exists. I wrote the program, so I have some idea how it works. The...
9
by: ThazKool | last post by:
I am just wondering if all the methods that are never called upon during a programs execution are removed when optimizing. For example you have: class FooA { void a(); ... void z(); }
11
by: Charles Sullivan | last post by:
I have a number of functions, e.g.: int funct1( int arg1, int arg2, int arg3 ); int funct2( int arg1, int arg2, int arg3 ); int funct3( int arg1, int arg2, int arg3 ); that are called via...
8
by: Frank Rizzo | last post by:
Is there a setting in VS2005 to quickly locate methods that are unused (maybe through compiler warnings)? If not, any utilities out there that do that? Thanks
6
by: nickvans | last post by:
Hi all, I have a table called tblRecords that has "DashNum" as its primary key. The lowest value of this table is 116 and the highest value is 269, though there are some missing values. It is...
1
by: dissectcode | last post by:
I am trying to learn how to use the attribute unused so I created a little test program. Can you please tell me what is wrong? I get syntax errors "before attribute" and "before (" (sometimes). ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.