Browse Prior Art Database

A Mechanism to Allow Orderless Processing of Pragmas in a C++ Program Disclosure Number: IPCOM000012959D
Original Publication Date: 1999-Oct-01
Included in the Prior Art Database: 2003-Jun-11

Publishing Venue


Related People

Allen Chan David Streeter


Some modern compilers can process C++ constructs in an orderless fashion and also provide for incremental compilation. However, during incremental compilation, orderless processing of pragmas (also known as compiler directives) can result in a large number of unnecessary change propagations. The main reason is that many pragmas are order dependent and are sensitive to their locations in a source file. This disclosure describes a mechanism to correctly process pragmas to allow rapid incremental recompilation of C++ programs containing pragmas in an orderless compilation environment. There are many different kinds of pragmas some of which are sensitive to their locations in a source file (order dependent). In general, these kind of pragmas will only affect declarations/definitions that appear after them, and their effective value may depend on pragmas that appear before them. One example is #pragma pack, which also supports "stack" operations. For example, #pragma pack(push, 1) will set the current packing alignment value to 1, while #pragma pack(pop) will reset the current packing alignment value to the previous setting. In the orderless processing environment of the present disclosure, if a component (i.e. a set of C++ instructions) asks for the value of a C++ pragma, a dependency relationship will be created between the component and the pragma with the component being a dependent of the pragma. Accordingly, if the pragma is ever changed, all its dependent components would be reprocessed by virtue of the dependency relationship. Take the following C++ program as an example: