Developer Support for Understanding Preprocessor Macro Expansions

Abstract

In the age of advanced integrated development environments there is a lack of support for understanding preprocessor macros. The preprocessor has proven to be a powerful tool for decades, but the developer is still guided poorly when the debugger stops at a source code line containing macros. The main problem is that the developer sees the original code, while the compiler uses the preprocessed code in the background. Investigating the usually nested macro calls can be a labor intensive tasks, which increases the overall effort spent on development and maintenance. There are several possibilities to help the developer in similar situations, but these are rarely employed since the preprocessor has its own, separate language to be analyzed. We implemented a Visual Studio plug-in (AddIn) that provides hand-on information on macros to increase the productivity of developers during debugging or program comprehension tasks. We enhanced the idea of macro folding, a technique to show/hide macro names and values within the source code editor; and defined a graphical view for macro expansions. In the background precise dynamic analysis of directives takes place, so the hint given for the developers considers all kind of preprocessor constructs like macros in conditionals and concatenating operators in the replacement text.

Publication
Proceedings of the 2012 International Conference on Advanced Software Engineering & Its Applications (ASEA 2012), Jeju Island, Korea, Pages 121–130

BibTeX:

@InProceedings{VDF12,
    author    = {Vid\'acs, L\'aszl\'o and D\'evai, Rich\'ard and Ferenc, Rudolf and Gyim\'othy, Tibor},
    title     = {Developer Support for Understanding Preprocessor Macro Expansions},
    booktitle = {Proceedings of the 2012 International Conference on Advanced Software Engineering \& Its Applications (ASEA 2012)},
    year      = {2012},
    volume    = {340},
    series    = {Communications in Computer and Information Science (CCIS)},
    pages     = {121--130},
    address   = {Jeju Island, Korea},
    month     = nov,
    publisher = {Springer-Verlag},
    doi       = {10.1007/978-3-642-35267-6_16},
    url       = {https://link.springer.com/chapter/10.1007%2F978-3-642-35267-6_16},
}