Matt S Trout > Rakudo-Star-2012.08_001 > config/auto/warnings.pm

Download:
Rakudo-Star-2012.08_001.tar.gz

Annotate this POD

Source  

NAME ^

config/auto/warnings.pm - Warning flags probing.

DESCRIPTION ^

Given a list of potential warnings available for a certain type of compiler, probe to see which of those are valid for this particular version.

_init

Declare potential warnings for various compilers. Note that the compiler key used here doesn't really exist in a unified way in Configure - would be nice if it did so we could simplify our checks in runstep().

We create a data structure here that breaks out the warnings by compiler, using this structure:

warnings: gcc: basic: - -Warning1 - -Warning2 cage: - -Warning3 - -Warning4 only: - -Warning5: - foo.c - bar.c never: - -Warning6: - baz.c - frob.c todo: - -Warning7: - cow.c - pig.c g++: ...

'basic' warnings are always used.

'cage' warnings are added only if --cage is specified during Configure. This can be used to hold warnings that aren't ready to be added to the default run yet.

'only' should be used as we add new warnings to the build, it will let us insure that files we know are clean for a new warning stay clean.

'never' should be used when a particular file contains generated code (e.g. imcc) and we cannot update it to conform to the standards.

'todo' functions just like never does, but it indicates that these files are expected to eventually be free of this warning.

Note that there is no actual requirement that the 'file' be a full path to a .c file; the file could be "PMCS" or "OPS" or some other identifier; whatever the value, it will generate a Config entry prefixed with ccwarn::, which will probably be used via @@ expansion in a makefile.

It is tempting to put this into a config file, but having it in perl gives us the ability to dynamically setup certain warnings based on any criteria already discovered via Config.

Order is important - some warnings are invalid unless they are specified after other warnings.

valid_warning

Try a given warning to see if it is supported by the compiler. The compiler is determined by the cc value of the Parrot::Configure object passed in as the first argument to the method (not counting $self. The warning to be checked is passed in as the second argument to the method.

Returns true if the warning flag is recognized by the compiler and undef otherwise.

Use the running set of known valid options, since some options may depend on previous options.

syntax highlighting: