From 444233c15ec34b78bba0b03547f0ae70b8e2b918 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 12 Mar 2021 11:40:48 -0500 Subject: [PATCH] Run "make autostyle" in advance of new series. --- src/app/config/config.c | 4 ++-- src/app/config/resolve_addr.c | 2 +- src/app/config/resolve_addr.h | 4 ++-- src/app/main/main.c | 4 ++-- src/app/main/risky_options.h | 2 +- src/core/or/channeltls.c | 2 +- src/core/or/protover.c | 2 +- src/core/or/trace_probes_circuit.c | 4 ++-- src/core/or/trace_probes_circuit.h | 2 +- src/feature/control/control_cmd.c | 2 +- src/feature/dircache/consdiffmgr.c | 4 ++-- src/feature/hs/hs_metrics_entry.h | 2 +- src/feature/relay/relay_config.h | 2 +- src/feature/relay/relay_find_addr.h | 2 +- src/feature/stats/bwhist.h | 2 +- src/feature/stats/rephist.h | 2 +- src/lib/crypt_ops/crypto_openssl_mgt.c | 2 +- src/lib/fs/path.c | 4 ++-- src/lib/log/util_bug.h | 2 +- src/lib/metrics/metrics_store_entry.h | 2 +- src/lib/sandbox/sandbox.c | 6 +++--- src/lib/tls/tortls_st.h | 2 +- src/lib/trace/debug.h | 2 +- src/lib/trace/trace.h | 2 +- src/test/test_config.c | 10 +++++----- src/test/test_protover.c | 2 +- src/test/test_util.c | 24 ++++++++++++------------ 27 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/app/config/config.c b/src/app/config/config.c index fa976d911d..f9f09dcd63 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -4958,9 +4958,9 @@ options_init_logs(const or_options_t *old_options, const or_options_t *options, if (!validate_only) { add_syslog_log(severity, options->SyslogIdentityTag); } -#else +#else /* !defined(HAVE_SYSLOG_H) */ log_warn(LD_CONFIG, "The android logging API is no longer supported."); -#endif +#endif /* defined(HAVE_SYSLOG_H) */ goto cleanup; } } diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c index 5e096f328f..43a3eb39de 100644 --- a/src/app/config/resolve_addr.c +++ b/src/app/config/resolve_addr.c @@ -852,4 +852,4 @@ resolve_addr_reset_suggested(int family) tor_addr_make_unspec(&last_suggested_addrs[af_to_idx(family)]); } -#endif /* TOR_UNIT_TESTS */ +#endif /* defined(TOR_UNIT_TESTS) */ diff --git a/src/app/config/resolve_addr.h b/src/app/config/resolve_addr.h index 9c9fee50a6..9a3846dfcb 100644 --- a/src/app/config/resolve_addr.h +++ b/src/app/config/resolve_addr.h @@ -61,7 +61,7 @@ void resolve_addr_reset_suggested(int family); #endif /* TOR_UNIT_TESTS */ -#endif /* RESOLVE_ADDR_PRIVATE */ +#endif /* defined(RESOLVE_ADDR_PRIVATE) */ -#endif /* TOR_CONFIG_RESOLVE_ADDR_H */ +#endif /* !defined(TOR_CONFIG_RESOLVE_ADDR_H) */ diff --git a/src/app/main/main.c b/src/app/main/main.c index 5417bbd486..c113e0183d 100644 --- a/src/app/main/main.c +++ b/src/app/main/main.c @@ -309,7 +309,7 @@ process_win32_console_ctrl(DWORD ctrl_type) activate_signal(SIGINT); return TRUE; } -#endif +#endif /* defined(_WIN32) */ /** * Write current memory usage information to the log. @@ -514,7 +514,7 @@ handle_signals(void) * to handle control signals like Ctrl+C in the console, we can use this to * simulate the SIGINT signal */ if (enabled) SetConsoleCtrlHandler(process_win32_console_ctrl, TRUE); -#endif +#endif /* defined(_WIN32) */ } /* Cause the signal handler for signal_num to be called in the event loop. */ diff --git a/src/app/main/risky_options.h b/src/app/main/risky_options.h index 244c1f5715..f94dd15faa 100644 --- a/src/app/main/risky_options.h +++ b/src/app/main/risky_options.h @@ -14,4 +14,4 @@ extern const char risky_option_list[]; -#endif +#endif /* !defined(TOR_RISKY_OPTIONS_H) */ diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c index 21850d0fb6..481dafef91 100644 --- a/src/core/or/channeltls.c +++ b/src/core/or/channeltls.c @@ -72,7 +72,7 @@ #include "core/or/or_handshake_state_st.h" #include "feature/nodelist/routerinfo_st.h" #include "core/or/var_cell_st.h" -#include "src/feature/relay/relay_find_addr.h" +#include "feature/relay/relay_find_addr.h" #include "lib/tls/tortls.h" #include "lib/tls/x509.h" diff --git a/src/core/or/protover.c b/src/core/or/protover.c index b4760a42fe..87348e0e7d 100644 --- a/src/core/or/protover.c +++ b/src/core/or/protover.c @@ -445,7 +445,7 @@ trailing_zeros(uint64_t x) x>>=1; } return i; -#endif +#endif /* defined(__GNUC__) */ } /** diff --git a/src/core/or/trace_probes_circuit.c b/src/core/or/trace_probes_circuit.c index 46296cfdb7..4ee5a97dff 100644 --- a/src/core/or/trace_probes_circuit.c +++ b/src/core/or/trace_probes_circuit.c @@ -25,6 +25,6 @@ #define TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES -#include "trace_probes_circuit.h" +#include "core/or/trace_probes_circuit.h" -#endif /* USE_TRACING_INSTRUMENTATION_LTTNG */ +#endif /* defined(USE_TRACING_INSTRUMENTATION_LTTNG) */ diff --git a/src/core/or/trace_probes_circuit.h b/src/core/or/trace_probes_circuit.h index 888c257078..4ddc46365f 100644 --- a/src/core/or/trace_probes_circuit.h +++ b/src/core/or/trace_probes_circuit.h @@ -19,4 +19,4 @@ #endif /* USE_TRACING_INSTRUMENTATION_LTTNG */ -#endif /* TOR_TRACE_PROBES_CIRCUIT_H */ +#endif /* !defined(TOR_TRACE_PROBES_CIRCUIT_H) */ diff --git a/src/feature/control/control_cmd.c b/src/feature/control/control_cmd.c index 4f8b66e5f6..b1dc271c4a 100644 --- a/src/feature/control/control_cmd.c +++ b/src/feature/control/control_cmd.c @@ -52,7 +52,7 @@ #include "feature/nodelist/node_st.h" #include "feature/nodelist/routerinfo_st.h" -#include "src/app/config/statefile.h" +#include "app/config/statefile.h" static int control_setconf_helper(control_connection_t *conn, const control_cmd_args_t *args, diff --git a/src/feature/dircache/consdiffmgr.c b/src/feature/dircache/consdiffmgr.c index 768a487fd1..9a3d4db560 100644 --- a/src/feature/dircache/consdiffmgr.c +++ b/src/feature/dircache/consdiffmgr.c @@ -183,9 +183,9 @@ static HT_HEAD(cdm_diff_ht, cdm_diff_t) cdm_diff_ht = HT_INITIALIZER(); // diff manager becomes larger than 64. To see if the issue goes away, we // hardcode this value to 64 now while we investigate a better solution. # define CACHE_MAX_NUM 64 -#else +#else /* !defined(_WIN32) */ # define CACHE_MAX_NUM 128 -#endif +#endif /* defined(_WIN32) */ /** * Configuration for this module diff --git a/src/feature/hs/hs_metrics_entry.h b/src/feature/hs/hs_metrics_entry.h index dc8e7d165e..b9786ac6f7 100644 --- a/src/feature/hs/hs_metrics_entry.h +++ b/src/feature/hs/hs_metrics_entry.h @@ -46,6 +46,6 @@ typedef struct hs_metrics_entry_t { extern const hs_metrics_entry_t base_metrics[]; extern const size_t base_metrics_size; -#endif /* HS_METRICS_ENTRY_PRIVATE */ +#endif /* defined(HS_METRICS_ENTRY_PRIVATE) */ #endif /* !defined(TOR_FEATURE_HS_METRICS_ENTRY_H) */ diff --git a/src/feature/relay/relay_config.h b/src/feature/relay/relay_config.h index eb4c3ccfae..cb08531782 100644 --- a/src/feature/relay/relay_config.h +++ b/src/feature/relay/relay_config.h @@ -93,7 +93,7 @@ STATIC int have_enough_mem_for_dircache(const struct or_options_t *options, struct port_cfg_t; STATIC const char *describe_relay_port(const struct port_cfg_t *port); -#endif /* TOR_UNIT_TESTS */ +#endif /* defined(TOR_UNIT_TESTS) */ #endif /* defined(RELAY_CONFIG_PRIVATE) */ diff --git a/src/feature/relay/relay_find_addr.h b/src/feature/relay/relay_find_addr.h index 82f4f68974..5bb7f8736e 100644 --- a/src/feature/relay/relay_find_addr.h +++ b/src/feature/relay/relay_find_addr.h @@ -28,5 +28,5 @@ void relay_addr_learn_from_dirauth(void); #endif /* RELAY_FIND_ADDR_PRIVATE */ -#endif /* TOR_RELAY_FIND_ADDR_H */ +#endif /* !defined(TOR_RELAY_FIND_ADDR_H) */ diff --git a/src/feature/stats/bwhist.h b/src/feature/stats/bwhist.h index dc46a7665a..e7fc60fdee 100644 --- a/src/feature/stats/bwhist.h +++ b/src/feature/stats/bwhist.h @@ -38,7 +38,7 @@ STATIC void add_obs(bw_array_t *b, time_t when, uint64_t n); STATIC void bw_array_free_(bw_array_t *b); STATIC size_t bwhist_fill_bandwidth_history(char *buf, size_t len, const bw_array_t *b); -#endif /* defined(REPHIST_PRIVATE) */ +#endif /* defined(BWHIST_PRIVATE) */ #ifdef TOR_UNIT_TESTS extern struct bw_array_t *write_array; diff --git a/src/feature/stats/rephist.h b/src/feature/stats/rephist.h index 14ab3e7666..26fb207d6f 100644 --- a/src/feature/stats/rephist.h +++ b/src/feature/stats/rephist.h @@ -145,6 +145,6 @@ struct hs_v2_stats_t; const struct hs_v2_stats_t *rep_hist_get_hs_v2_stats(void); struct hs_v3_stats_t; const struct hs_v3_stats_t *rep_hist_get_hs_v3_stats(void); -#endif +#endif /* defined(TOR_UNIT_TESTS) */ #endif /* !defined(TOR_REPHIST_H) */ diff --git a/src/lib/crypt_ops/crypto_openssl_mgt.c b/src/lib/crypt_ops/crypto_openssl_mgt.c index c3e01e9bba..6c01cb6aa8 100644 --- a/src/lib/crypt_ops/crypto_openssl_mgt.c +++ b/src/lib/crypt_ops/crypto_openssl_mgt.c @@ -106,7 +106,7 @@ crypto_openssl_get_version_str(void) #else /* This old name was changed around OpenSSL 1.1.0 */ const int query = SSLEAY_VERSION; -#endif +#endif /* defined(OPENSSL_VERSION) */ if (crypto_openssl_version_str == NULL) { const char *raw_version = OpenSSL_version(query); diff --git a/src/lib/fs/path.c b/src/lib/fs/path.c index ced794ba8b..8c4b08f50a 100644 --- a/src/lib/fs/path.c +++ b/src/lib/fs/path.c @@ -571,7 +571,7 @@ wrap_closedir(void *arg) { closedir(arg); } -#endif /* defined(HAVE_GLOB) */ +#endif /* defined(_WIN32) || ... */ /** Return a new list containing the paths that match the pattern * pattern. Return NULL on error. On POSIX systems, errno is set by the @@ -636,7 +636,7 @@ tor_glob(const char *pattern) #else (void)pattern; return result; -#endif /* !defined(HAVE_GLOB) */ +#endif /* defined(_WIN32) || ... */ return result; } diff --git a/src/lib/log/util_bug.h b/src/lib/log/util_bug.h index 6b3e19b977..dd82981e08 100644 --- a/src/lib/log/util_bug.h +++ b/src/lib/log/util_bug.h @@ -258,7 +258,7 @@ abort() #else #define FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL FALLTHROUGH -#endif +#endif /* defined(ALL_BUGS_ARE_FATAL) */ /** In older code, we used tor_fragile_assert() to mark optional failure * points. At these points, we could make some debug builds fail. diff --git a/src/lib/metrics/metrics_store_entry.h b/src/lib/metrics/metrics_store_entry.h index 196ee5c99f..e4dc7a8b9a 100644 --- a/src/lib/metrics/metrics_store_entry.h +++ b/src/lib/metrics/metrics_store_entry.h @@ -40,7 +40,7 @@ struct metrics_store_entry_t { } u; }; -#endif /* METRICS_STORE_ENTRY_PRIVATE */ +#endif /* defined(METRICS_STORE_ENTRY_PRIVATE) */ typedef struct metrics_store_entry_t metrics_store_entry_t; diff --git a/src/lib/sandbox/sandbox.c b/src/lib/sandbox/sandbox.c index 816f76959e..6ee90b8ff2 100644 --- a/src/lib/sandbox/sandbox.c +++ b/src/lib/sandbox/sandbox.c @@ -734,7 +734,7 @@ sb_socket(scmp_filter_ctx ctx, sandbox_cfg_t *filter) SCMP_CMP(2, SCMP_CMP_EQ, IPPROTO_IP)); if (rc) return rc; -#endif +#endif /* defined(ENABLE_NSS) */ rc = seccomp_rule_add_3(ctx, SCMP_ACT_ALLOW, SCMP_SYS(socket), SCMP_CMP(0, SCMP_CMP_EQ, PF_UNIX), @@ -1691,7 +1691,7 @@ get_syscall_from_ucontext(const ucontext_t *ctx) { return (int) ctx->uc_mcontext.M_SYSCALL; } -#else +#else /* !defined(SYSCALL_NAME_DEBUGGING) */ static const char * get_syscall_name(int syscall_num) { @@ -1704,7 +1704,7 @@ get_syscall_from_ucontext(const ucontext_t *ctx) (void) ctx; return -1; } -#endif +#endif /* defined(SYSCALL_NAME_DEBUGGING) */ #ifdef USE_BACKTRACE #define MAX_DEPTH 256 diff --git a/src/lib/tls/tortls_st.h b/src/lib/tls/tortls_st.h index 0998887903..b27e73b15f 100644 --- a/src/lib/tls/tortls_st.h +++ b/src/lib/tls/tortls_st.h @@ -80,7 +80,7 @@ struct tor_tls_t { uint64_t last_write_count; uint64_t last_read_count; long last_error; -#endif +#endif /* defined(ENABLE_NSS) */ }; #endif /* !defined(TOR_TORTLS_ST_H) */ diff --git a/src/lib/trace/debug.h b/src/lib/trace/debug.h index 218625dac8..f9d536b301 100644 --- a/src/lib/trace/debug.h +++ b/src/lib/trace/debug.h @@ -28,7 +28,7 @@ log_debug(LD_GENERAL, "Tracepoint \"" XSTR(event_name) "\" from " \ "subsystem \"" XSTR(subsystem) "\" hit.") -#else /* defined(USE_TRACING_INSTRUMENTATION_LOG_DEBUG) */ +#else /* !defined(USE_TRACING_INSTRUMENTATION_LOG_DEBUG) */ /* NOP the debug event. */ #define TOR_TRACE_LOG_DEBUG(subsystem, name, ...) diff --git a/src/lib/trace/trace.h b/src/lib/trace/trace.h index d4cd5b68f9..b94600a383 100644 --- a/src/lib/trace/trace.h +++ b/src/lib/trace/trace.h @@ -26,7 +26,7 @@ tracing_log_warning(void) "purpose, your tor is NOT safe to run."); } -#else +#else /* !defined(HAVE_TRACING) */ /* NOP it. */ #define tracing_log_warning() diff --git a/src/test/test_config.c b/src/test/test_config.c index 3921274462..e364857175 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -1215,7 +1215,7 @@ get_interface_address6_replacement(int severity, sa_family_t family, return 0; } -#endif +#endif /* 0 */ static int n_get_interface_address6_failure = 0; @@ -6041,7 +6041,7 @@ test_config_include_wildcards(void *data) tt_ptr_op(result, OP_EQ, NULL); tt_int_op(include_used, OP_EQ, 1); config_free_lines(result); -#endif +#endif /* !defined(_WIN32) */ // test pattern *.conf tor_snprintf(torrc_contents, sizeof(torrc_contents), @@ -6181,9 +6181,9 @@ test_config_include_hidden(void *data) len++; } tt_int_op(len, OP_EQ, 1); -#else +#else /* !defined(_WIN32) */ tt_ptr_op(result, OP_EQ, NULL); -#endif +#endif /* defined(_WIN32) */ config_free_lines(result); // test wildcards match hidden folders when explicitly in the pattern @@ -6993,7 +6993,7 @@ test_config_multifamily_port(void *arg) #define CONFIG_TEST_SETUP(suffix, name, flags, setup, setup_data) \ { #name#suffix, test_config_ ## name, flags, setup, setup_data } -#endif +#endif /* !defined(COCCI) */ struct testcase_t config_tests[] = { CONFIG_TEST(adding_trusted_dir_server, TT_FORK), diff --git a/src/test/test_protover.c b/src/test/test_protover.c index 696f7a7061..2f77db185f 100644 --- a/src/test/test_protover.c +++ b/src/test/test_protover.c @@ -650,7 +650,7 @@ test_protover_vote_roundtrip_ours(void *args) */ #define PROTOVER(proto_string, version_macro) \ (proto_string "=" STR(version_macro)) -#endif +#endif /* defined(COCCI) */ #define DEBUG_PROTOVER(flags) \ STMT_BEGIN \ diff --git a/src/test/test_util.c b/src/test/test_util.c index ad762d2725..b8766ae9e0 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -4532,7 +4532,7 @@ test_util_glob(void *ptr) #else const char *results_test3[] = {"dir1", "dir2", "file1", "file2", "forbidden"}; -#endif +#endif /* defined(_WIN32) */ TEST("*i*"); EXPECT(results_test3); @@ -4570,7 +4570,7 @@ test_util_glob(void *ptr) const char *results_test10[] = {"file1"}; TEST("file1"PATH_SEPARATOR); EXPECT(results_test10); -#endif +#endif /* defined(__APPLE__) || defined(__darwin__) || ... */ // test path separator at end - with wildcards and linux path separator const char *results_test11[] = {"dir1", "dir2", "forbidden"}; @@ -4584,7 +4584,7 @@ test_util_glob(void *ptr) #else const char *results_test12[] = {"dir1", "dir2", "empty", "file1", "file2", "forbidden"}; -#endif +#endif /* defined(_WIN32) */ TEST("*"); EXPECT(results_test12); @@ -4631,7 +4631,7 @@ test_util_glob(void *ptr) tor_free(pattern); tt_assert(!results); } -#endif +#endif /* !defined(_WIN32) */ #undef TEST #undef EXPECT @@ -4643,7 +4643,7 @@ test_util_glob(void *ptr) (void) chmod(dir1_forbidden, 0700); (void) chmod(dir2_forbidden, 0700); (void) chmod(forbidden_forbidden, 0700); -#endif +#endif /* !defined(_WIN32) */ tor_free(dir1); tor_free(dir2); tor_free(forbidden); @@ -4657,11 +4657,11 @@ test_util_glob(void *ptr) SMARTLIST_FOREACH(results, char *, f, tor_free(f)); smartlist_free(results); } -#else +#else /* !defined(HAVE_GLOB) */ tt_skip(); done: return; -#endif +#endif /* defined(HAVE_GLOB) */ } static void @@ -4769,7 +4769,7 @@ test_util_get_glob_opened_files(void *ptr) // dot files are not special on windows const char *results_test3[] = {"", ".test-hidden", "dir1", "dir2", "empty", "file1", "file2", "forbidden"}; -#endif +#endif /* !defined(_WIN32) */ TEST("*"PATH_SEPARATOR"*"); EXPECT(results_test3); @@ -4781,7 +4781,7 @@ test_util_get_glob_opened_files(void *ptr) // dot files are not special on windows const char *results_test4[] = {"", ".test-hidden", "dir1", "dir2", "empty", "file1", "file2", "forbidden"}; -#endif +#endif /* !defined(_WIN32) */ TEST("*"PATH_SEPARATOR"*"PATH_SEPARATOR); EXPECT(results_test4); @@ -4846,7 +4846,7 @@ test_util_get_glob_opened_files(void *ptr) TT_FAIL(("unable to chmod a file on cleanup: %s", strerror(errno))); } } -#endif +#endif /* !defined(_WIN32) */ tor_free(dir1); tor_free(dir2); tor_free(forbidden); @@ -4860,11 +4860,11 @@ test_util_get_glob_opened_files(void *ptr) SMARTLIST_FOREACH(results, char *, f, tor_free(f)); smartlist_free(results); } -#else +#else /* !defined(HAVE_GLOB) */ tt_skip(); done: return; -#endif +#endif /* defined(HAVE_GLOB) */ } static void