Programming Languages

TypeChef: Toward Type Checking #ifdef Variability in C

by Andy Kenner, Christian Kästner, Steffen Haase, and Thomas Leich

In Proceedings of the Second Workshop on Feature-Oriented Software Development (FOSD), pages 25–32. ACM Press, 2010.

Abstract

Software product lines have gained momentum as an approach to generate many variants of a program, each tailored to a specific use case, from a common code base. However, the implementation of product lines raises new challenges, as potentially millions of program variants are developed in parallel. In prior work, we and others have developed product-line–aware type systems to detect type errors in a product line, without generating all variants. With \emphTypeChef, we build a similar type checker for product lines written in C that implements variability with \emph#ifdef directives of the C preprocessor. However, a product-line–aware type system for C is more difficult than expected due to several peculiarities of the preprocessor, including lexical macros and unrestricted use of \emph#ifdef directives. In this paper, we describe the problems faced and our progress to solve them with \emphTypeChef. Although \emphTypeChef is still under development and cannot yet process arbitrary C code, we demonstrate its capabilities so far with a case study: By type checking the open-source web server \emphBoa with potentially 2^110 variants, we found type errors in several variants.