 |
|
 |
RENESAS TOOL NEWS [September 16, 2003: RSO-M3T-NC308WA-030916D]
A Note on Using C Compilers M3T-NC308WA and M3T-NC30WA
|
Please take note of the following problem in using the M3T-NC308WA and
M3T-NC30WA C compilers (with an assembler and integrated development
environment):
- On using the link option "-U"
- Products and Versions Concerned
- M3T-NC308WA V.5.10 Release 1
- for the M32C/80 and M16C/80 series MCUs
- M3T-NC30WA V.5.10 Release 1 and V.5.20 Release 1
- for the M16C/60, M16C/30, M16C/20, M16C/10, and R8C/Tiny
series MCUs
- Description
When a local function is called using a pointer to the function,
the linker may dispatch the warning message saying "Local function
'xxx' is never used".
- Conditions
This problem occurs if the following three conditions are satisfied:
| (1) | The source file is specified in the full path name at compilation. |
| (2) | Local functions are defined as an element of the array. |
| (3) | The -U link option is used. |
- 3.1 Example
D:\src\samp.c:
-----------------------------------
static void func1(void);
static void func2(void);
void (*FuncTbl[])(void)={func1,func2}; /* Condition (2) */
void main()
{
int i;
void (*p)();
for( i=0; i<2; i++ ){
p = FuncTbl[i];
(*p)();
}
}
void func1()
{
}
void func2()
{
}
-----------------------------------
-
- At compilation:
- D:\> nc30 src\samp.c -finfo -ln30 -u Conditions (1) and (3)
- Warning messages dispatched in the above example:
- src/samp.c 18 Warning (ln30): Local function 'func1'is never used
- src/samp.c 22 Warning (ln30): Local function 'func2'is never used
- Workaround
Change local functions to global functions if possible. If not, neglect the warnings; the source file will successfully be compiled.
- Schedule of Fixing the Problem
We plan to fix this problem in our next release of the products.
|
 |