metaonly module xdc.Warnings

Conditional warnings manager

Configuration settings sourced in xdc/Warnings.xdc
var Warnings = xdc.useModule('xdc.Warnings');
module-wide constants & types
 
        obj.id = Int  ...
        obj.msg = String  ...
 
        obj.warning = Warnings.Warning  ...
        obj.args = String[]  ...
module-wide functions
 
NODOC
This module declares all warnings generated by the packages in the xdc.* name space. Each warning is identified with an ID, a positive integer number. A warning message allows conversion specifiers that can be replaced with actual strings at the time a warning message is generated. The purpose of IDs is to let users find warning documentation in this module and also to allow warnings to be disabled based on their IDs.
 
const Warnings.LOGID

Multiple Log events with the same ID

Configuration settings
const Warnings.LOGID = {
 
DETAILS
If two Log events share a message, they are automatically assigned the same ID because IDs also serve as pointers to an array that holds a compact representation of message strings. To avoid duplication of strings, if a string already exists in the array, the ID of the existing copy is used.
This warning can be useful for package producers who unintentionally declare two events with the same message, which could be combined into one common Log event.
 
struct Warnings.Warning

Warning descriptor

Configuration settings
var obj = new Warnings.Warning;
 
    obj.id = Int  ...
    obj.msg = String  ...
 
DETAILS
Warnings are defined as instances of this structure, and also that's how the warnings are kept internally.
 
struct Warnings.WarningParams

Structure passed to $logWarning

Configuration settings
var obj = new Warnings.WarningParams;
 
    obj.warning = Warnings.Warning  ...
    obj.args = String[]  ...
 
DETAILS
Currently, the only parameter assigned to a warning is an array of strings to replace conversion specifiers in Warnings. In the future, a caller can identify a module where the warning is defined, which will allow any package to introduce new warnings.
 
Warnings.disable()  // module-wide

Internal function that disables warnings

Configuration settings
Warnings.disable(String[] ids) returns Void
 
ARGUMENTS
ids — array of IDs
 
Warnings.getMessage()  // module-wide

Internal function that creates an actual output message

Configuration settings
Warnings.getMessage(Warnings.WarningParams prms) returns String
 
ARGUMENTS
prms — WarningParams structure passed by the warning generation code
generated on Wed, 09 Apr 2014 00:37:36 GMT