Product Documentation
Cadence SKILL IDE User Guide
Product Version IC23.1, August 2023

C


SKILL Lint Rules

SKILL IDE provides a mechanism for you to write your own rules to output SKILL Lint messages.

Rule Structure - SK_RULE Macro

The SK_RULE macro is the main entry point for writing a rule:

SK_RULE( sl_functions g_test g_statement ...)

The components of a SK_RULE call are as follows:

sl_functions

Name of the function to which the rule applies. Rules in SKILL Lint always apply to a particular function. For example, there is a rule associated with the setq function (the assignment operator) which says that the first argument must be a symbol. The first argument to SK_RULE may be a single function name or it may be a parenthesized list of function names if the same rule is to be applied to multiple functions.

g_test

SKILL statement known as the test statement. The rules work by applying a series of commands whenever a call to the function(s) named is found in the code under analysis. The test function is evaluated first, and the rest of the commands are carried out only if the test function evaluates to non-nil.

g_statement

One or more rules commands (SKILL statements) that are executed whenever a call to the named function(s) is found, providing that the test statement evaluates to non-nil.

While the rule command statements are being evaluated, a number of macros are available for accessing the SKILL code being checked and for reporting any problems found. The simplest macro is SK_ARGS which takes no arguments and returns the list of arguments to the function call being tested.

The macros you can use to write rules begin with SK_ and have all capital letters.

For example, the following rule applies to the ggTestData function which has two required arguments and an optional third. If, in the next release, the third argument becomes mandatory, this rule will find all calls with only two arguments:

SK_RULE( ggTestData
length(SK_ARGS()) == 2
warn(“Found call to ggTestData with only 2 arguments.\n”)
)

Related Topics

Rule Access Macros

Rule Reporting Macros

Adding a New Required Argument to a Function


Return to top
 ⠀
X