The second compiler warning is missing the nearly anywhere else included file/line reference.
C:\SW_TOOLS-trunk\compilers\c6000_7_4_2\bin\cl6x.exe file.c --check_misra=required,advisory,-1-5,-7-11,-12.4,-12.5,-12.6,-12.13,-13-20 "file.c", line 35: warning: (MISRA-C:2004 6.2/R) signed and unsigned char type shall be used only for the storage and use of numeric values Warning: (MISRA-C:2004 12.2/R) The value of an expression shall be the same under any order of evaluation that the standard permits
file.c:
typedef unsigned int size_t;
static char * strncpy(
register char * dest,
register const char * src,
register size_t n)
{
if (n)
{
register char *d = dest;
register const char *s = src;
while ((*d++ = *s++) && --n); /* COPY STRING */ /* ### this is line #35 ### */
if (n-- > 1) do *d++ = '\0'; while (--n); /* TERMINATION PADDING */
}
return dest;
}
void a(void)
{
char d[8] = "";
char s[8] = "1234";
strncpy (d, s, 4);
}
source of the above example is partially c6000_7_4_2\include\string.h