We are planning to make better use of the const qualifier in our C code.

To speed this up for our existing codebase, I'm looking for a tool that automatically applies const to function parameters that are not modified within the function.

Is there a tool, or a feature within another source analysis tool, that could do this?


What you need is a tool that can parse (real) C code, compute side effects of functions (and check to see if the parameters are in that list), can modify the parameter lists and regenerate the source code.

Our DMS Software Reengineering Toolkit can do all of these tasks. It has full C front end, does control and data flow analysis on C which is used to compute side effects, and can apply source-to-source transformations to change the code where necessary.

OPs solution isn't off the shelf. Instead one configures DMS to implement that analysis and code changes desired.

Whether this is cost effective will depend on the size of OP's code base.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.