std.cfg: Add asctime_s function configuration with tests (#1191)
* std.cfg: Add asctime_s function configuration with tests * std.cfg: Remove redundant/not needed not-bool attributes.
This commit is contained in:
parent
1a9e8c158d
commit
6208ee4af1
20
cfg/std.cfg
20
cfg/std.cfg
|
@ -175,6 +175,26 @@
|
||||||
</arg>
|
</arg>
|
||||||
<warn severity="style" cstd="c99" alternatives="strftime" reason="Obsolete"/>
|
<warn severity="style" cstd="c99" alternatives="strftime" reason="Obsolete"/>
|
||||||
</function>
|
</function>
|
||||||
|
<!-- errno_t asctime_s(char *buf, rsize_t bufsz, const struct tm *time_ptr); // since C11 -->
|
||||||
|
<function name="asctime_s,std::asctime_s">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<returnValue type="errno_t"/>
|
||||||
|
<leak-ignore/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-null/>
|
||||||
|
<minsize type="argvalue" arg="2"/>
|
||||||
|
</arg>
|
||||||
|
<arg nr="2">
|
||||||
|
<not-uninit/>
|
||||||
|
<valid>26:</valid>
|
||||||
|
</arg>
|
||||||
|
<arg nr="3">
|
||||||
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
|
<not-bool/>
|
||||||
|
</arg>
|
||||||
|
<warn severity="style" alternatives="strftime" reason="Obsolete"/>
|
||||||
|
</function>
|
||||||
<!-- void assert(int expression) -->
|
<!-- void assert(int expression) -->
|
||||||
<function name="assert">
|
<function name="assert">
|
||||||
<returnValue type="void"/>
|
<returnValue type="void"/>
|
||||||
|
|
|
@ -504,6 +504,15 @@ void uninitvar_asctime(void)
|
||||||
(void)asctime(tm);
|
(void)asctime(tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uninitvar_asctime_s(void)
|
||||||
|
{
|
||||||
|
const struct tm *tm;
|
||||||
|
char buf[26];
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
// cppcheck-suppress asctime_sCalled
|
||||||
|
asctime_s(buf, sizeof(buf), tm);
|
||||||
|
}
|
||||||
|
|
||||||
void uninitvar_assert(void)
|
void uninitvar_assert(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -3695,6 +3704,10 @@ void invalidFunctionArgBool_abs(bool b, double x, double y)
|
||||||
|
|
||||||
void invalidFunctionArg(char c)
|
void invalidFunctionArg(char c)
|
||||||
{
|
{
|
||||||
|
// cppcheck-suppress asctime_sCalled
|
||||||
|
// cppcheck-suppress invalidFunctionArg
|
||||||
|
asctime_s(1, 24, 1);
|
||||||
|
|
||||||
/* cppcheck-suppress invalidFunctionArg */
|
/* cppcheck-suppress invalidFunctionArg */
|
||||||
(void)isalnum(256);
|
(void)isalnum(256);
|
||||||
/* cppcheck-suppress invalidFunctionArg */
|
/* cppcheck-suppress invalidFunctionArg */
|
||||||
|
@ -3841,6 +3854,18 @@ void nullPointer_asctime(void)
|
||||||
(void)asctime(0);
|
(void)asctime(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nullPointer_asctime_s(void)
|
||||||
|
{
|
||||||
|
struct tm *tm = 0;
|
||||||
|
char * buf = NULL;
|
||||||
|
// cppcheck-suppress asctime_sCalled
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
asctime_s(buf, 26, 1);
|
||||||
|
// cppcheck-suppress asctime_sCalled
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
asctime_s(1, 26, tm);
|
||||||
|
}
|
||||||
|
|
||||||
void nullPointer_wcsftime(size_t maxsize)
|
void nullPointer_wcsftime(size_t maxsize)
|
||||||
{
|
{
|
||||||
wchar_t* ptr = 0;
|
wchar_t* ptr = 0;
|
||||||
|
|
Loading…
Reference in New Issue