|
|
There are various ways to log information in the sac2c compiler.
|
|
|
|
|
|
There are kinds of ways to log information during compilation.
|
|
|
`src/libsac2c/support/debug.h` and `src/libsac2c/global/ctinfo.h`
|
|
|
|
|
|
|
|
|
|
|
|
1. `debug.h` is for compiler debugging for the compiler developers.
|
|
|
2. The functions in `ctinfo.h` which are used to actually give feedback to the caller of the compiler.
|
|
|
|
|
|
|
|
|
# debug.h
|
|
|
|
|
|
A modified version of the `debug.h` file by `Fred Fish`.
|
|
|
Modify a lot by the sac team.
|
|
|
|
|
|
These macros are for compiler debugging for the compiler developers.
|
|
|
Only present in a DEBUG build of the compiler.
|
|
|
|
|
|
This system allows you to print debug information to the console at different levels and for different tags.
|
|
|
|
|
|
You can get these debug messages for the entire compiler by using the `-#d` flag.
|
|
|
If you want to only get messages for a certain compiler phase you can specify the debug prefix of the messages you want to see `-#d,EX` for a traversal with `#define DBUG_PREFIX "EX"`.
|
|
|
This is possible because the `debug.h` file allows you to only print messages with a certain prefix if you want.
|
|
|
|
|
|
You set the prefix by doing `#define DBUG_PREFIX "TSM"` at the top of the file you want to debug.
|
|
|
|
|
|
# ctinfo functions
|
|
|
|
|
|
These functions actually provide feedback to the caller of the compiler.
|
|
|
This messages are present in both debug builds and release builds of the compiler.
|
|
|
|
|
|
The logging follows different levels of verbosity.
|
|
|
The caller sets the verbosity levels by using the `-v` flag.
|
|
|
This info is from the top of the `ctinfo.c` file:
|
|
|
|
|
|
```
|
|
|
* Verbose level 0:
|
|
|
*
|
|
|
* Only error messages are printed.
|
|
|
*
|
|
|
* Verbose level 1:
|
|
|
*
|
|
|
* Error messages and warnings are printed.
|
|
|
*
|
|
|
* Verbose level 2:
|
|
|
*
|
|
|
* Error messages, warnings and basic compile time information, e.g. compiler
|
|
|
* phases, are printed.
|
|
|
*
|
|
|
* Verbose level 3:
|
|
|
*
|
|
|
* Error messages, warnings and full compile time information are printed.
|
|
|
*
|
|
|
* Verbose level 4+:
|
|
|
*
|
|
|
* Additional compile time information is provided that typically is only
|
|
|
* of interest in certain situation.
|
|
|
*
|
|
|
* Default values are 1 for the product version and 3 for the developer version.
|
|
|
```
|
|
|
|
|
|
However `ctinfo.c` holds more logging functions like `InternalCompilerErrorBreak` which produces the `OOOOOOOPS, your program crashed the compiler 8-((` message.
|
|
|
Or for instance `CTIerror` which is used to print an error messages or `CTIwarn` to show warnings etc.
|
|
|
|
|
|
|