diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-01-16 10:24:39 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-01-16 10:24:39 -0500 |
commit | 17c63ff9f64c9f678f566bca70497992f5d4d04d (patch) | |
tree | 6e6749afcedceb85e693738cc219e585ba3904a0 /src | |
parent | 4025cbada6ab01247275faec8dd32ae857ef0fd5 (diff) | |
parent | 77246dc0d8b90e99bb411475da1911919799dae8 (diff) | |
download | tor-17c63ff9f64c9f678f566bca70497992f5d4d04d.tar.gz tor-17c63ff9f64c9f678f566bca70497992f5d4d04d.zip |
Merge remote-tracking branch 'tor-github/pr/1663'
Diffstat (limited to 'src')
-rw-r--r-- | src/app/main/main.c | 2 | ||||
-rw-r--r-- | src/lib/cc/compat_compiler.h | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/app/main/main.c b/src/app/main/main.c index 36f85c6a40..b533406eaa 100644 --- a/src/app/main/main.c +++ b/src/app/main/main.c @@ -1240,7 +1240,7 @@ tor_run_main(const tor_main_configuration_t *tor_cfg) int done = 0; result = nt_service_parse_options(argc, argv, &done); - if (done) + if (POSSIBLE(done)) goto done; pubsub_install(); diff --git a/src/lib/cc/compat_compiler.h b/src/lib/cc/compat_compiler.h index 47782fda08..907622f942 100644 --- a/src/lib/cc/compat_compiler.h +++ b/src/lib/cc/compat_compiler.h @@ -227,4 +227,17 @@ #define EAT_SEMICOLON \ struct dummy_semicolon_eater__ +/** + * Tell our static analysis tool to believe that (clang's scan-build or + * coverity scan) that an expression might be true. We use this to suppress + * dead-code warnings. + **/ +#if defined(__COVERITY__) || defined(__clang_analyzer__) +/* By calling getenv, we force the analyzer not to conclude that 'expr' is + * false. */ +#define POSSIBLE(expr) ((expr) || getenv("STATIC_ANALYZER_DEADCODE_DUMMY_")) +#else +#define POSSIBLE(expr) (expr) +#endif + #endif /* !defined(TOR_COMPAT_COMPILER_H) */ |