gnu.cfg: Added nullpointer tests for getopt_long().

This commit is contained in:
orbitcowboy 2022-12-21 17:06:08 +01:00
parent b380fd2589
commit 521f0ce720
1 changed files with 13 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#endif #endif
#include <strings.h> #include <strings.h>
#include <error.h> #include <error.h>
#include <getopt.h>
void unreachableCode_error(void) // #11197 void unreachableCode_error(void) // #11197
{ {
@ -33,6 +34,18 @@ void unreachableCode_error(void) // #11197
int i; int i;
} }
int nullPointer_getopt_long(int argc, char **argv, const char *optstring,
const struct option *longopts, int *longindex)
{
// cppcheck-suppress nullPointer
(void) getopt_long(argc, argv, NULL, longopts, longindex);
// cppcheck-suppress nullPointer
(void) getopt_long(argc, argv, optstring, NULL, longindex);
// cppcheck-suppress nullPointer
(void) getopt_long(argc, NULL, optstring, longopts, longindex);
return getopt_long(argc, argv, optstring, longopts, longindex);
}
int nullPointer_getservent_r(struct servent *restrict result_buf, char *restrict buf, size_t buflen, struct servent **restrict result) int nullPointer_getservent_r(struct servent *restrict result_buf, char *restrict buf, size_t buflen, struct servent **restrict result)
{ {
// cppcheck-suppress nullPointer // cppcheck-suppress nullPointer