diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2020-02-15 15:24:42 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2020-02-15 15:24:42 +0300 |
commit | e59ed5784b5aef7df7a36f435eb7dd0de2ea00b1 (patch) | |
tree | 1c0476ecf725eba071be0629b78486294baaeaa6 /tools | |
parent | 2fd48a92b8bff3afb64b3528ad78b63f033f0436 (diff) | |
download | bdwgc-e59ed5784b5aef7df7a36f435eb7dd0de2ea00b1.tar.gz |
Workaround 'condition x==2 is always false' cppcheck FP in setjmp_t
Computation of x local variable (stored in a register) in setjmp_t.c
is more disguised now.
* tools/setjmp_t.c (a_str): New global variable (initialized to "a").
* tools/setjmp_t.c (main): Pass a_str (instead of "a") to strlen().
Diffstat (limited to 'tools')
-rw-r--r-- | tools/setjmp_t.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/setjmp_t.c b/tools/setjmp_t.c index 33f10603..fc9b7c82 100644 --- a/tools/setjmp_t.c +++ b/tools/setjmp_t.c @@ -76,12 +76,14 @@ word (*volatile nested_sp_fn)(void) = nested_sp; int g(int x); +char *a_str = "a"; + int main(void) { volatile word sp; unsigned ps = GETPAGESIZE(); JMP_BUF b; - register int x = (int)strlen("a"); /* 1, slightly disguised */ + register int x = (int)strlen(a_str); /* 1, slightly disguised */ static volatile int y = 0; sp = (word)(&sp); |