Define statements are used to make code mode readeable, but often defines are changed, new ones are created, and after months of coding, there could be a lot of them unused.
Three are a huge number of code analisys tools that will do the job, but if you don’t want to buy or install them, you can use the bash to find which defines are unused.
Imagine you have your code into the directory ~/code, cd into it
create a list containing all the defines mnemonics
search into your source code how many times is used each entry in the ../list.txt. To do this, create an new script named checkMacros.sh, containing the following lines of code:
Save it and then make it executable
Now run the script
Last, sort the list1.txt file
Now in the list2.txt you have the list of macro sorted by the number of occurences. The ones for which the occurence is 1 are surely unused.
Note that this method is not exhaustive since you can have some occurrences of a mnemonics into dead code, commented code or other files.