PCp3: A C Front End for Preprocessor Analysis and Transformation

Simple C program

What...

Outline

Common approaches

How pervasive is C preprocessor use?

The PCp3 Approach

Visualizing the mapping

The PCp3 Infrastructure

Event hooks

Backcalls

Example PCp3 analysis

C++ Language Features to replace uses of Cpp

Replacing macros with language-proper constants

PCp3 analysis will notice

Transformed code

How PCp3 compares

Future work

Summary

Extra slides.....

The C Preprocessor

Most definitions are simple

Difficult macros are used more than simple ones

Syntactic macros hinder lexical tools

Expansion mechanism

Nested macro expansion

Intentional programming groupís approach (MS)

Griswold & Atkinsonís approach for TAWK

Multiple translation units

Details of processing entire source

Processing all the source code