Un-preprocessing: Extended CPP that works with your tools

Yufeng Cheng, Meng Wang, Yingfei Xiong, Zhengkai Wu, Yiming Wu, Lu Zhang

Research output: Chapter in Book/Report/Conference proceedingConference Contribution (Conference Proceeding)

183 Downloads (Pure)


Many tools directly change programs, such as bug-fixing tools, program migration tools, etc. We call them program-modification tools. On the other hand, many programming languages use the C preprocessor, such as C, C++, and Objective-C. Because of the complexity of preprocessors, many program-modification tools either fail to produce sound results under the presence of preprocessor directives, or give up completely and deal only with preprocessed code.

In this paper we propose a lightweight approach that enables program-modification tools to work with the C preprocessor for free. The idea is that program-modification tools now simply target the preprocessed code, and our system, acting as a bidirectional C preprocessor, automatically propagates the changes on the preprocessed code back to the un-preprocessed code. The resulting source code is guaranteed to be correct and is kept similar to the original source as much as possible. We have evaluated our approach on Linux kernel with a set of generated changes. The evaluation results show the feasibility and effectiveness of our approach.
Original languageEnglish
Title of host publicationInternetware '17
Subtitle of host publicationProceedings of the 9th Asia-Pacific Symposium on Internetware
PublisherAssociation for Computing Machinery (ACM)
Number of pages10
ISBN (Print)9781450353137
Publication statusPublished - 23 Sep 2017

Structured keywords

  • Programming Languages

Fingerprint Dive into the research topics of 'Un-preprocessing: Extended CPP that works with your tools'. Together they form a unique fingerprint.

Cite this