Commit Graph

33968 Commits

Author SHA1 Message Date
Nick Mathewson
0b862a7616 threads.h: coccinelle cannot understand a macro. 2019-10-22 09:32:13 -04:00
Nick Mathewson
4346e5569e ctassert.h: fix CTASSERT_DECL so coccinelle can parse it. 2019-10-22 09:32:13 -04:00
Nick Mathewson
189375fb5d ratelim.h: use COCCI to hide an initializer. 2019-10-22 09:32:13 -04:00
Nick Mathewson
c77f57d37b util_bug.h: Coccinelle does not understand IF_BUG_ONCE or #nodef. 2019-10-22 09:32:13 -04:00
Nick Mathewson
fb4b6b6436 weakrng.h: use COCCI to hide a macro coccinelle cannot parse. 2019-10-22 09:32:13 -04:00
Nick Mathewson
d1cdb1a24e Use STMT_BEGIN/END in parse_int.c so coccinelle can handle it. 2019-10-22 09:32:13 -04:00
Nick Mathewson
41f44d8760 smartlist.h: use COCCI to hide SMARTLIST_FOREACH_JOIN from Coccinelle 2019-10-22 09:32:13 -04:00
Nick Mathewson
514c61e406 namemap_st.h: Use COCCI to hide an initializer. 2019-10-22 09:32:13 -04:00
Nick Mathewson
2695f7e68c timeval.h: Coccinelle cannot understand timercmp. 2019-10-22 09:32:13 -04:00
Nick Mathewson
9f50a92a7e Fix a macro in address.c so coccinelle can understand it 2019-10-22 09:32:13 -04:00
Nick Mathewson
0abe89519b timers.c: define TIMEOUT_PUBLIC to no tokens when using COCCI. 2019-10-22 09:32:13 -04:00
Nick Mathewson
9453746b5e dispatch_naming.c: when COCCI is defined, disable unparseable macros. 2019-10-22 09:32:13 -04:00
Nick Mathewson
04a74d4aa7 conftesting.h: when COCCI is defined, disable unhandled macros 2019-10-22 09:32:13 -04:00
Nick Mathewson
3e41459dff confmacros.h: fix coccinelle parsing. 2019-10-22 09:32:13 -04:00
Nick Mathewson
54c5366aa1 feature/control: wrap some problem macros in COCCI 2019-10-22 09:32:13 -04:00
Nick Mathewson
d6ce8527f8 tor-coccinelle.h: add a definition for EXTERN 2019-10-22 09:32:13 -04:00
Nick Mathewson
ef5d1e6b65 consdiff disable a macro when running with COCCI 2019-10-22 09:32:13 -04:00
Nick Mathewson
d9bad0203b Disable a couple of iterator macros when COCCI is defined. 2019-10-22 09:32:13 -04:00
Nick Mathewson
67247fa9ac Use various COCCI tests to get mainloop.c to parse. 2019-10-22 09:32:13 -04:00
Nick Mathewson
4fad456148 test: Hide some test-declaration macro definitions to COCCI.
(These ones cause parsing failures.)
2019-10-22 09:32:13 -04:00
Nick Mathewson
6696a5bbae tor-coccinelle.h: add HANDLE_{DECL,IMPL} 2019-10-22 09:32:13 -04:00
Nick Mathewson
d129b503c0 tor-coccinelle.h: add EAT_SEMICOLON 2019-10-22 09:32:13 -04:00
Nick Mathewson
c1e8e5bb32 Apparently coccinelle can't handle multiline #errors. 2019-10-22 09:32:13 -04:00
Nick Mathewson
b03c8c74ce COCCI: Disable some buffers.c macros that coccinelle can't handle. 2019-10-22 09:32:13 -04:00
Nick Mathewson
2e64dfea95 tor-coccinelle.h: add CHECK_SCANF 2019-10-22 09:32:13 -04:00
Nick Mathewson
b867e97ce6 With COCCI defined, avoid PERIODIC_EVENT.
Coccinelle doesn't understand the particular pattern of token
pasting we have going on here.
2019-10-22 09:32:05 -04:00
Nick Mathewson
48be922160 COCCI: disable DOWLOAD_SCHEDULE macro 2019-10-22 09:31:31 -04:00
Nick Mathewson
7798c53c98 tor-coccinelle.h: add MOCK_DECL 2019-10-22 09:24:25 -04:00
Nick Mathewson
18f1624bbe tor-coccinelle.h: handle SLIST and LIST. 2019-10-22 09:24:25 -04:00
Nick Mathewson
630d8c7a1a With coccinelle, avoid includes in the middle of an expression. 2019-10-22 09:24:25 -04:00
Nick Mathewson
a2bb66c355 Add a "COCCI" macro that we tell coccinelle is always defined.
This will let us give specific in-file equivalents to given macros
or preprocessor directives, to make things parse.
2019-10-22 09:24:25 -04:00
Nick Mathewson
ea47e53252 tor-coccinelle.h: handle NS and NS_DECL. 2019-10-22 09:24:25 -04:00
Nick Mathewson
017c62000c tor-coccinelle: handle SIMPLEQ and TAILQ better. 2019-10-22 09:24:25 -04:00
Nick Mathewson
c13c0c8999 tor-coccinelle.h: Add {EN,DIS}ABLE_GCC_WARNING. 2019-10-22 09:24:25 -04:00
Nick Mathewson
eb1260e346 tor-coccinelle: expect parentheses after HT_INITIALIZER 2019-10-22 09:24:25 -04:00
Nick Mathewson
9871fcbcd9 Use #warning instead of #warn: one is C and one isn't. 2019-10-22 09:24:25 -04:00
Nick Mathewson
51c2097586 try_parse.sh: add a verbose mode and a meaningful exit code. 2019-10-22 09:24:25 -04:00
Nick Mathewson
9ab96550da document test-operator-cleanup 2019-10-22 09:24:25 -04:00
Nick Mathewson
2d013bbe5c Merge remote-tracking branch 'tor-github/pr/1417' 2019-10-22 08:36:32 -04:00
Nick Mathewson
4413b030f2 Simplify CHECK_DEFAULT() logic a little further.
Since each of these tests only applies to testing networks, put them
all into a single block that checks for testing networks.

(I recommend reviewing with the "diff -b" option, since the change
is mostly indentation.)
2019-10-22 08:32:33 -04:00
Nick Mathewson
8d84e10e87 Make options_validate() no longer use its "defaults" argument.
It can just look at what the defaults are.

Closes ticket 32185.
2019-10-22 08:30:00 -04:00
Nick Mathewson
a1d5341374 Merge branch 'bug32175' 2019-10-22 07:51:30 -04:00
Nick Mathewson
65e80ce646 Merge branch 'from_setconf_removal_squashed' 2019-10-22 07:50:42 -04:00
Nick Mathewson
0bb2e77283 changes file for 31999 2019-10-22 07:50:13 -04:00
Nick Mathewson
6d15fab2dc Extract log-granularity code into its own function.
This pleases practracker.
2019-10-22 07:50:13 -04:00
Nick Mathewson
9ac2c71cbd Add tests for options_init_logs() 2019-10-22 07:50:13 -04:00
Nick Mathewson
f4fc633937 Make a pair of add_*_log() functions mockable. 2019-10-22 07:50:13 -04:00
Nick Mathewson
ac3136a6fb Make options_init_logs STATIC for testing. 2019-10-22 07:50:13 -04:00
Nick Mathewson
98c3b3bb4c Update tests to handle new interpretation of quiet_level.
Two things needed to be changed.  First, we used to set quiet_level
to the default (QUIET_NONE) when running tests, since we would not
call anything that acted based upon it.  But since we sometimes call
options_init_logs(), we need to pre-set quiet_level to QUIET_SILENT
in the logs so that we don't add the default logs.  This did not
cause test failure: just unwanted logs.

Second, we had a test that checked whether options_validate was
messing with options->Logs correctly.  Since options_validate no
longer messes with the logs, we no longer want a test for this.
2019-10-22 07:50:13 -04:00
Nick Mathewson
e07b19d305 Rationalize handling of quiet_level in config.c
Formerly, we would use quiet_level as an excuse to rewrite the log
configuration, adding a default log line if none existed, and if
RunAsDaemon was not set, and if we were not being invoked via
setconf (!).

This is against our best practices for several reasons:
  * We should not be changing configured options except when the
    user tells us to do so.
  * We should especially not be changing options in the options_validate
    function.
  * Distinguishing whether we are being called from setconf adds a
    risky special-case.

Instead, this patch take a simpler approach: it changes the
interpretation of having no logging lines set to mean: If there is a
stdout, add a default log based on quiet_level.

Solves ticket 31999.
2019-10-22 07:50:13 -04:00