perform Configuration File Directive

The perform directive limits the scope of variables to blocks of directives. By default, variables are accessible from the line where they are introduced in a configuration file until the end of the configuration file. However, subdirectives of a perform directive cannot use variables that were defined before the perform directive, unless access to the variables is given explicitly. Variables introduced inside a perform block are not available after the block. Inside a perform block, variables are defined and assigned a type on their first occurrence.

This directive is often used with the include directive to eliminate potential name conflicts.

This diagram shows the syntax of the perform directive:

The perform directive has the following parameters:

directive_block
This parameter contains the list of directives to which the perform applies. The directives must be enclosed between braces, { and }, so that they are subdirectives of the perform directive.

local_variable_list
This optional parameter is a list of variables for the using clause. All variables that are listed in a using clause must be defined before the perform directive, and can be accessed by subdirectives of the perform directive. If a variable that is made visible in a using clause is modified in a perform block, the variable retains the value assigned to it inside the block after the perform is complete.

The subdirectives of the perform directive can access only variables that are defined inside the perform block or listed in the using clause. In the following example, two option groups are defined before the perform directive, RTL and optimize. Only the variable named RTL is listed in the using clause. The directives in the perform block can use RTL, but not the option group named optimize. The option group named debug is introduced by a subdirective of the perform directive. The scope of debug extends from the directive that defines it to the end of the perform block.

option RTL = link(linkWithSharedLib, no)
option optimize = opt(optimize), opt(size)
perform using RTL {  
   option debug = gen(debug)
   option debug, RTL {
      target myprog { source myprog.c }
   }
}

A variable that is defined inside a perform block can have the same name as a variable defined outside of the block and whose scope excludes the block. For example, in the following excerpt from a configuration file, the source directive lists only the files named b1.cpp and b2.cpp, and allfiles contains a1.cpp, a2.cpp, b1.cpp, and b2.cpp.

afiles = "a1.cpp", "a2.cpp"
bfiles = null
perform using bfiles {
   bfiles = "b1.cpp", "b2.cpp" // reset bfiles from outside 
   afiles = null               // define new local afiles   
   source afiles, bfiles
}
allfiles = afiles, bfiles



Configuration Files
How Configuration Files Are Processed


Change a Build Setup
Build


Configuration File Directives
Build Options