PUMA Library Reference Manual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Configuration Options

Several aspects of the functionality of PUMA can be configured using command line options or a configuration file.

The following configuration options are understood by the library.

File Handling Options

Option Description
-p, –path PATH Add a project source directory
-d, –dest PATH Add a destination folder for modified sources
-w, –write-protected PATH Add a write protected project directory
-e, –extension STRING Set the extension for source files
-s, –suffix STRING Set the suffix for output files
–config FILE Load configuration options from a file
–system-config FILE Load low precedence configuration options from a file
–save-new-suffix Append new suffix on existing files when saving
–save-overwrite Overwrite existing files when saving
–save-rename-old Rename existing files when saving

Preprocessor Options

Option Description
-A PREDICATE(ANSWER) Assert a preprocessor predicate, e.g. -Asystem(linux)
-D NAME[=BODY] Define a preprocessor macro, e.g. -DSYSTEM=linux or -D DEBUG
-U NAME Undefine a preprocessor macro, e.g. -U SYSTEM
-I PATH Add a non-system include directory
–isystem PATH Add a system include directory
–include FILE Include the given file at the beginning of each source file
–lock-macro NAME[=BODY] Define an immutable preprocessor macro
–inhibit-macro NAME Add the name of a macro whose definition will be ignored

General Parser Options

Option Description
–lang-c Set input language to C
–lang-ec++ Set input language to Embedded C++
–lang-c++ Set input language to C++
–size-type TYPE Set the internal type for size_t
–ptrdiff-type TYPE Set the internal type for ptrdiff_t
–target TRIPLE Set target triple which determines sizes and alignments for built-in types
–builtin-type-traits Enable built-in type traits
–verbose-errors Enable verbose error messages
–match-expr Enable match expression language extensions

Extended Parser Options

Option Description
–skip-bodies-all Don't parse function bodies
–skip-bodies-tpl Don't parse function bodies of templates
–skip-bodies-non-prj Don't parse function bodies in non-project files
–skip-bodies-non-prim Don't parse function bodies in non-primary files
–pseudo-instances Simplified template instantiation scheme (deprecated)
–inst-fct-bodies Enable function template body instantiation
–template-depth DEPTH Set the maximum instantiation depth for templates

VisualC++ Extension Options

Option Description
–vc Enable VisualC++ language extensions
–import-handler FILE Set a handler for resolving #import directives

GNU C/C++ Extension Options

Option Description
–gnu [VERSION] Enable all GNU C/C++ language extensions (optionally version dependent)
–gnu-nested-fct Enable GNU C/C++ nested functions
–gnu-condition-scope Enable GNU C/C++ condition scope
–gnu-param-decl Enable GNU C/C++ parameter declarator
–gnu-fct-decl Enable GNU C/C++ function declarator
–gnu-param-scope Enable GNU C/C++ function parameter scope
–gnu-default-args Enable GNU C/C++ function default arguments
–gnu-extended-asm Enable GNU C/C++ extended asm syntax
–gnu-extended-expr Enable GNU C/C++ extended expressions
–gnu-long-long Enable GNU C/C++ long long type
–gnu-int128 Enable GNU type __int128 extension
–gnu-name-scope Enable GNU C/C++ name scope
–gnu-implicit-int Enable GNU implicit int extension
–gnu-fct-attribute Enable GNU C/C++ function attributes
–gnu-if-then-expr Enable GNU C/C++ if-then expression syntax
–gnu-std-hack Enable GNU C/C++ implicit namespace std hack
–gnu-friend-injection Enable GNU friend injection extension
–gnu-pic24 Enable GNU PIC24 and dsPIC extension

C++1x Extension Options

Option Description
–c++1x Enable all C++1x language extensions
–c++1x-static-assert Enable C++1x static assertions

Configuration Files

All command line options can also be specified in a configuration file. Each option in the configuration file has to start on a new line.

1 -D i386
2 -D linux
3 -I /usr/include

Lines beginning with # are interpreted as comments and will be ignored.

1 ### defines
2 -D i386
3 -D linux
4 ### includes
5 -I /usr/include
6 -I /usr/local/include

Arguments of options containing spaces have to be enclosed in double-quotes. Double-quotes in the argument have to be escaped.

1 -D __PTRDIFF_TYPE__=int
2 -D "__SIZE_TYPE__=unsigned int"
3 -D "__VERSION__=\"4.1.0 (Linux)\""

All occurrences of ${Name} in the configuration file are interpreted as environment variables and replaced by their values, or by nothing if the variable is not defined. To avoid variable replacement, $ has to be escaped.

1 -I ${LIBDIR}/include
2 -D OS_STR=\"${OSTYPE}\"
3 ### same as: #define OS_STR "linux"
4 -D OS_VAR=\"\${OSTYPE}\"
5 ### same as: #define OS_VAR "${OSTYPE}"

The default PUMA configuration file location is /etc/puma.config. It can be overwritten by setting the environment variable PUMA_CONFIG like this:

1 export PUMA_CONFIG=/usr/local/lib/Puma/puma.config

Use class Puma::Config to load the configuration in the correct order from the command line or a configuration file.