Compiler Pragmas

## 6.8 Compiler Pragmas

Compiler pragmas are compiler directives which instruct the compiler to emit a particular code type. Their syntax is similar to directives:

>     :- pragma(Option).

It is not possible to have several pragmas grouped together and separated by commas like goals, every pragma must be specified separately. Option can be one of the following:

- debug - generate code which can be inspected with the debugger. This overrides the global setting of the `debug_compile` flag.
- nodebug - generate optimized code with no debugger support. This overrides the global setting of the `debug_compile` flag.
- silent_debug - generate code which cannot be inspected by the debugger, but which allows to debug predicates called by it. This is similar to setting the `leash` flag of all subgoals in the following clauses to `notrace`. This option is useful e.g. for library predicates which call other Prolog predicates: the user wants to see in the debugger the call to the library predicate and to the invoked predicate, but no internal calls in the library predicates.
- expand - do in-line expansion of some subgoals, like =/2, is/2 and others. This code can still be inspected with the debugger but the expanded subgoals look differently than in the normal debugged code, or their arguments cannot be seen. This pragma overrides the global setting of the `goal_expansion` flag.
- noexpand - inhibit the in-line goal expansion. This pragma overrides the global setting of the `goal_expansion` flag.
- skip - set the `skip` flag of all following predicates to `on`.
- noskip - set the `skip` flag of all following predicates to `off`.
- system - set the `type` flag of all following predicates to `built_in`. Moreover, all following predicates will have unspecified `source_file` and `source_line` flags.

By default, the compiler works as if the pragmas debug, expand and noskip were specified.
The pragma is active from its specification in the file until the file end or until it is disabled by another pragma. Recursive compilations or calls to other compiling predicates are not affected by the pragma. Pragmas which have the same effect as global flags override the global flags if they specify more optimized code. For instance, the pragma debug has no effect if the global flag `debug_compile` is `off`, but the pragma nodebug overrides the global flag `debug_compile` being `on`.
The pragmas are useful mainly for libraries and other programs that should be always compiled in a particular mode independently of the global flags setting.