Fix false positives ignoredReturnValue about some posix interfaces. Remove redundant strsignal() output from signal handler
This commit is contained in:
parent
9876cf2312
commit
bacc5ac1cc
|
@ -1695,7 +1695,6 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- char *asctime_r(const struct tm *tm, char *buf); -->
|
<!-- char *asctime_r(const struct tm *tm, char *buf); -->
|
||||||
<function name="asctime_r">
|
<function name="asctime_r">
|
||||||
<use-retval/>
|
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
@ -1708,7 +1707,6 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- char *ctime_r(const time_t *timep, char *buf); -->
|
<!-- char *ctime_r(const time_t *timep, char *buf); -->
|
||||||
<function name="ctime_r">
|
<function name="ctime_r">
|
||||||
<use-retval/>
|
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
@ -1721,7 +1719,6 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- struct tm *gmtime_r(const time_t *timep, struct tm *result); -->
|
<!-- struct tm *gmtime_r(const time_t *timep, struct tm *result); -->
|
||||||
<function name="gmtime_r">
|
<function name="gmtime_r">
|
||||||
<use-retval/>
|
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
|
|
@ -346,14 +346,11 @@ static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
const char * const signame = signal_name(signo);
|
const char * const signame = signal_name(signo);
|
||||||
const char * const sigtext = strsignal(signo);
|
|
||||||
bool bPrintCallstack=true;
|
bool bPrintCallstack=true;
|
||||||
const bool isaddressonstack = isAddressOnStack(info->si_addr);
|
const bool isaddressonstack = isAddressOnStack(info->si_addr);
|
||||||
FILE* f = (CppCheckExecutor::getExceptionOutput()=="stderr") ? stderr : stdout;
|
FILE* f = (CppCheckExecutor::getExceptionOutput()=="stderr") ? stderr : stdout;
|
||||||
fputs("Internal error: cppcheck received signal ", f);
|
fputs("Internal error: cppcheck received signal ", f);
|
||||||
fputs(signame, f);
|
fputs(signame, f);
|
||||||
fputs(", ", f);
|
|
||||||
fputs(sigtext, f);
|
|
||||||
switch (signo) {
|
switch (signo) {
|
||||||
case SIGBUS:
|
case SIGBUS:
|
||||||
switch (info->si_code) {
|
switch (info->si_code) {
|
||||||
|
|
|
@ -182,4 +182,8 @@ void timet_h() {
|
||||||
struct timespec* ptp;
|
struct timespec* ptp;
|
||||||
// cppcheck-suppress uninitvar
|
// cppcheck-suppress uninitvar
|
||||||
clock_settime(CLOCK_REALTIME, ptp);
|
clock_settime(CLOCK_REALTIME, ptp);
|
||||||
|
|
||||||
|
time_t clock = time(0);
|
||||||
|
char buf[26];
|
||||||
|
ctime_r(&clock, buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue