Files
codeql/cpp/ql/test/library-tests/syntax-zoo/ms_assume.cpp
Jeroen Ketema f649def3f8 C++: Silence a number of bogus consistency errors in syntax zoo
These were due to several functions occurring that would have the same TRAP
key. By making the functions static the TRAP keys will differ from each other.
2023-03-03 11:16:19 +01:00

35 lines
577 B
C++

// semmle-extractor-options: --microsoft
char *Xstrdup(const char *string);
void abort();
struct FILE;
char *fgets(char *str, int num, FILE *stream);
int ignore_return_value();
#define IGNORE_RETURN_VALUE() ignore_return_value()
void myIgnoreReturnValue();
static int f(int argc, char *argv[])
{
char *s1 = Xstrdup("Hello, world!");
char *s2 = Xstrdup(0);
if (argc == 0)
{
abort();
} else if (argc == 1) {
__assume(0);
}
{
char buffer[256];
char *result;
FILE *s;
result = fgets(buffer, 256, s);
}
IGNORE_RETURN_VALUE();
myIgnoreReturnValue();
}