Tutorial part 5: warnings

So far we’ve only emitted errors, but other kinds of diagnostic are possible, such as warnings.

We can select different kinds of diagnostic via diagnostic_level when calling diagnostic_begin():

On compiling and running the program, we should get output similar to:

test-warning.c:17:11: warning: this is a warning
17 | #include <foo.h>
   |           ^~~~~

Various severities are possible, see diagnostic_level for more information.

In the next section of the tutorial we’ll look at adding fix-it hints to diagnostics.