Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detecting deprecated functions in C++

In a C++ project documented with Doxygen, I have marked some functions as \deprecated in the Doxygen comments. Is there any way to use these comments (with Doxygen or another tool) in order to detect that another non-deprecated function is calling a deprecated one ? (The project is pretty big and going through all the classes would take a lot of time).

Thanks

like image 565
sunmat Avatar asked Oct 11 '12 12:10

sunmat


1 Answers

If you are using GCC or clang to compile your code you could manually annotate functions.

__attribute__((__deprecated__))
void dep_fun() { }

Then calling dep_fun anywhere in your code will emit a diagnostic message.

If you placed doxygen's \deprecated annotation consistently you should be able to update the code automatically with tools like sed.

like image 158
Benjamin Bannier Avatar answered Sep 16 '22 19:09

Benjamin Bannier