On Jul 11, 2024, David Malcolm <dmalc...@redhat.com> wrote: > I intended that particular test as an integration test, to try to make > sure that -fanalyzer is silent on the result of a minimal "flex" > script. So if we're actually getting warnings, that's undesirable, and > I'm not sure the approach in your patch is the right one.
Understood, thanks, patch withdrawn. > Given that the testcase includes various C headers, there's going to be > some variability with different configurations. Are you able to share > the preprocessed sources with me? I'm not sure, but I don't think that will be needed. Just replacing the includes with standard declarations and definitions used in the program was enough to trigger the warning. > Maybe we should eliminate those #includes from that test and convert > it to something that's more config-independent? Here's what I got. I tried some __builtin_-prefixing, particularly on exit, hoping that it would bring some noreturn into effect, but that didn't get rid of the warning, so I left it at that. diff --git a/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c b/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c index c6ecb25d25d59..41ad3359370ee 100644 --- a/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c +++ b/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c @@ -14,10 +14,31 @@ /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <stdlib.h> +/* #include <stdio.h> */ +#define EOF -1 +typedef __SIZE_TYPE__ size_t; +typedef struct FILE FILE; +extern FILE *stdin, *stdout, *stderr; +int getc(FILE *); +int ferror(FILE *); +size_t fread (void *, size_t, size_t, FILE *); +size_t fwrite (void *, size_t, size_t, FILE *); +void clearerr(FILE *); +int fileno(FILE *); +int fprintf(FILE *, const char *, ...); +/* #include <string.h> */ +void *memset(void *, int, size_t); +size_t strlen(const char *); +/* #include <errno.h> */ +extern int *__get_errno (void); +#define errno (*__get_errno ()) +#define EINTR 42 +/* #include <stdlib.h> */ +#define NULL 0 +void exit(int); +void *malloc(size_t); +void *realloc(void *, size_t); +void free(void *); /* end standard C headers. */ -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive