Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I automate finding unused #include directives?

Tags:

c

Typically when writing new code you discover that you are missing a #include because the file doesn't compile. Simple enough, you add the required #include. But later you refactor the code somehow and now a couple of #include directives are no longer needed. How do I discover which ones are no longer needed?

Of course I can manually remove some or all #include lines and add them back until the file compiles again, but this isn't really feasible in a large project with thousands of files. Are there any tools available that will help automating task?

like image 929
staffan Avatar asked Sep 09 '08 10:09

staffan


People also ask

How do you find unused IAM roles?

To view role-last-used information in the IAM Console, select Roles in the IAM navigation pane, then look for the Last activity column (see Figure 1 below). This displays the number of days that have passed since each role made an AWS service request. AWS records last-used information for the trailing 400 days.

Which AWS service would you use to monitor and alert for Role policy changes?

AWS Config continuously records changes to the configuration of your AWS resources and notifies you of these changes through Amazon Simple Notification Service (SNS).

How do I find my Iam role in AWS?

Under the AWS Management Console section, choose the role you want to view. On the Selected role page, under Manage users and groups for this role, you can view the users and groups assigned to the role.


1 Answers

You can use PC-Lint/FlexeLint to do that.

Unusually there isn't a free OS version of the tool available.

You can remove #includes by passing by reference instead of passing by value and forward declaring. This is because the compiler doesn't need to know the size of the object at compile time. This will require a large amount of manual work on your behalf however. The good thing is it will reduce your compile times.

like image 125
graham.reeds Avatar answered Oct 11 '22 16:10

graham.reeds