Skip to content

Commit 39633ef

Browse files
committed
Add more interfaces to posix.cfg
1 parent 9541141 commit 39633ef

3 files changed

Lines changed: 70 additions & 7 deletions

File tree

cfg/gnu.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<!-- char ** backtrace_symbols (void *const *buffer, int size) -->
3939
<function name="backtrace_symbols">
4040
<noreturn>false</noreturn>
41+
<use-retval/>
4142
<arg nr="1">
4243
<not-null/>
4344
<not-uninit/>
@@ -108,6 +109,7 @@
108109
<!-- int ecvt_r (double value, int ndigit, int *decpt, int *neg, char *buf, size_t len); -->
109110
<function name="ecvt_r">
110111
<noreturn>false</noreturn>
112+
<pure/>
111113
<arg nr="1">
112114
<not-uninit/>
113115
</arg>
@@ -128,6 +130,7 @@
128130
<!-- int fcvt_r (double value, int ndigit, int *decpt, int *neg, char *buf, size_t len); -->
129131
<function name="fcvt_r">
130132
<noreturn>false</noreturn>
133+
<pure/>
131134
<arg nr="1">
132135
<not-uninit/>
133136
</arg>
@@ -148,6 +151,7 @@
148151
<!-- int qecvt_r (long double value, int ndigit, int *decpt, int *neg, char *buf, size_t len); -->
149152
<function name="qecvt_r">
150153
<noreturn>false</noreturn>
154+
<pure/>
151155
<arg nr="1">
152156
<not-uninit/>
153157
</arg>
@@ -168,6 +172,7 @@
168172
<!-- int qfcvt_r (long double value, int ndigit, int *decpt, int *neg, char *buf, size_t len); -->
169173
<function name="qfcvt_r">
170174
<noreturn>false</noreturn>
175+
<pure/>
171176
<arg nr="1">
172177
<not-uninit/>
173178
</arg>
@@ -191,6 +196,7 @@
191196
<use-retval/>
192197
<noreturn>false</noreturn>
193198
<leak-ignore/>
199+
<pure/>
194200
<arg nr="1">
195201
<not-null/>
196202
<not-uninit/>

cfg/posix.cfg

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,18 @@
349349
</arg>
350350
<leak-ignore/>
351351
</function>
352+
<!-- void seekdir(DIR *dirp, long loc); -->
353+
<function name="seekdir">
354+
<noreturn>false</noreturn>
355+
<arg nr="1">
356+
<not-null/>
357+
<not-uninit/>
358+
</arg>
359+
<arg nr="2">
360+
<not-uninit/>
361+
</arg>
362+
<leak-ignore/>
363+
</function>
352364
<function name="rand_r">
353365
<noreturn>false</noreturn>
354366
<leak-ignore/>
@@ -666,6 +678,45 @@
666678
<not-uninit/>
667679
</arg>
668680
</function>
681+
<!-- int setpgid(pid_t pid, pid_t pgid); -->
682+
<function name="setpgid">
683+
<noreturn>false</noreturn>
684+
<arg nr="1">
685+
<not-uninit/>
686+
</arg>
687+
<arg nr="2">
688+
<not-uninit/>
689+
</arg>
690+
</function>
691+
<!-- pid_t setpgrp(void); -->
692+
<function name="setpgrp">
693+
<noreturn>false</noreturn>
694+
</function>
695+
<!-- int setregid(gid_t rgid, gid_t egid); -->
696+
<function name="setregid">
697+
<noreturn>false</noreturn>
698+
<arg nr="1">
699+
<not-uninit/>
700+
</arg>
701+
<arg nr="2">
702+
<not-uninit/>
703+
</arg>
704+
</function>
705+
<!-- int setreuid(uid_t ruid, uid_t euid); -->
706+
<function name="setreuid">
707+
<noreturn>false</noreturn>
708+
<arg nr="1">
709+
<not-uninit/>
710+
</arg>
711+
<arg nr="2">
712+
<not-uninit/>
713+
</arg>
714+
</function>
715+
<!-- pid_t setsid(void); -->
716+
<function name="setsid">
717+
<noreturn>false</noreturn>
718+
<use-retval/>
719+
</function>
669720
<memory>
670721
<dealloc>free</dealloc>
671722
<alloc init="true">strdup</alloc>
@@ -1045,4 +1096,12 @@
10451096
<not-null/>
10461097
</arg>
10471098
</function>
1099+
<!-- void setkey(const char *key); -->
1100+
<function name="setkey">
1101+
<noreturn>false</noreturn>
1102+
<arg nr="1">
1103+
<not-uninit/>
1104+
<not-null/>
1105+
</arg>
1106+
</function>
10481107
</def>

cli/cppcheckexecutor.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,6 @@ static const char *signal_name(int signo)
245245
return "";
246246
}
247247

248-
249-
// 32 vs. 64bit
250-
#define ADDRESSDISPLAYLENGTH ((sizeof(long)==8)?12:8)
251-
252248
/*
253249
* Try to print the callstack.
254250
* That is very sensitive to the operating system, hardware, compiler and runtime!
@@ -257,14 +253,15 @@ static const char *signal_name(int signo)
257253
static void print_stacktrace(FILE* f, bool demangling, int maxdepth)
258254
{
259255
#if defined(USE_UNIX_BACKTRACE_SUPPORT)
256+
// 32 vs. 64bit
257+
#define ADDRESSDISPLAYLENGTH ((sizeof(long)==8)?12:8)
260258
void *array[32]= {0}; // the less resources the better...
261259
const int depth = backtrace(array, (int)GetArrayLength(array));
262260
const int offset=3; // the first two entries are simply within our own exception handling code, third is within libc
263261
if (maxdepth<0)
264262
maxdepth=depth+offset;
265263
else
266264
maxdepth+=offset;
267-
printf("maxdepth=%d\n", maxdepth);
268265
char **symbolstrings = backtrace_symbols(array, depth);
269266
if (symbolstrings) {
270267
fputs("Callstack:\n", f);
@@ -308,6 +305,7 @@ static void print_stacktrace(FILE* f, bool demangling, int maxdepth)
308305
} else {
309306
fputs("Callstack could not be obtained\n", f);
310307
}
308+
#undef ADDRESSDISPLAYLENGTH
311309
#endif
312310
}
313311

@@ -617,7 +615,7 @@ static void writeMemoryErrorDetails(FILE* f, PEXCEPTION_POINTERS ex, const char*
617615
}
618616

619617
/*
620-
* Any evaluation of the information about the exception needs to be done here!
618+
* Any evaluation of the exception needs to be done here!
621619
*/
622620
static int filterException(int code, PEXCEPTION_POINTERS ex)
623621
{
@@ -714,7 +712,7 @@ int CppCheckExecutor::check_wrapper(CppCheck& cppcheck, int argc, const char* co
714712
__try {
715713
return check_internal(cppcheck, argc, argv);
716714
} __except (filterException(GetExceptionCode(), GetExceptionInformation())) {
717-
// reporting to stdout may not be helpful within a GUI application..
715+
// reporting to stdout may not be helpful within a GUI application...
718716
fputs("Please report this to the cppcheck developers!\n", f);
719717
return -1;
720718
}

0 commit comments

Comments
 (0)