From 60213a3621c5fa354fd7b3f3feb1a2a336d5c9ce Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 5 Jun 2019 09:33:35 -0400 Subject: [PATCH] Run "make autostyle." --- src/app/config/config.c | 8 +++---- src/app/config/or_options_st.h | 2 +- src/app/config/or_state_st.h | 2 +- src/app/config/statefile.h | 2 +- src/app/main/subsysmgr.h | 2 +- src/core/crypto/onion_crypto.h | 2 +- src/core/mainloop/connection.c | 10 ++++---- src/core/mainloop/mainloop.c | 4 ++-- src/core/mainloop/mainloop.h | 6 ++--- src/core/mainloop/mainloop_pubsub.c | 6 ++--- src/core/mainloop/mainloop_pubsub.h | 2 +- src/core/mainloop/mainloop_sys.h | 2 +- src/core/mainloop/netstatus.h | 2 +- src/core/or/addr_policy_st.h | 2 +- src/core/or/address_set.h | 2 +- src/core/or/cell_queue_st.h | 2 +- src/core/or/cell_st.h | 2 +- src/core/or/circuit_st.h | 2 +- src/core/or/circuitpadding.c | 4 ++-- src/core/or/circuitpadding.h | 6 ++--- src/core/or/circuitpadding_machines.h | 4 ++-- src/core/or/connection_st.h | 2 +- src/core/or/cpath_build_state_st.h | 2 +- src/core/or/crypt_path.h | 2 +- src/core/or/crypt_path_reference_st.h | 2 +- src/core/or/crypt_path_st.h | 4 ++-- src/core/or/destroy_cell_queue_st.h | 2 +- src/core/or/dos.h | 4 ++-- src/core/or/edge_connection_st.h | 2 +- src/core/or/entry_connection_st.h | 2 +- src/core/or/entry_port_cfg_st.h | 2 +- src/core/or/extend_info_st.h | 2 +- src/core/or/half_edge_st.h | 2 +- src/core/or/listener_connection_st.h | 2 +- src/core/or/ocirc_event.h | 2 +- src/core/or/ocirc_event_sys.h | 2 +- src/core/or/or_circuit_st.h | 2 +- src/core/or/or_connection_st.h | 2 +- src/core/or/or_handshake_certs_st.h | 2 +- src/core/or/or_handshake_state_st.h | 2 +- src/core/or/or_periodic.c | 2 +- src/core/or/orconn_event.h | 2 +- src/core/or/orconn_event_sys.h | 2 +- src/core/or/origin_circuit_st.h | 2 +- src/core/or/port_cfg_st.h | 2 +- src/core/or/relay_crypto_st.h | 2 +- src/core/or/sendme.h | 4 ++-- src/core/or/server_port_cfg_st.h | 2 +- src/core/or/socks_request_st.h | 2 +- src/core/or/tor_version_st.h | 2 +- src/core/or/var_cell_st.h | 2 +- src/feature/api/tor_api.c | 4 ++-- src/feature/api/tor_api.h | 2 +- src/feature/control/btrack_circuit.h | 2 +- src/feature/control/btrack_orconn.h | 4 ++-- src/feature/control/btrack_orconn_cevent.h | 2 +- src/feature/control/btrack_orconn_maps.h | 2 +- src/feature/control/btrack_sys.h | 2 +- src/feature/control/control_connection_st.h | 2 +- src/feature/control/control_getinfo.h | 2 +- src/feature/control/fmt_serverstatus.h | 2 +- src/feature/control/getinfo_geoip.h | 2 +- src/feature/dirauth/authmode.h | 6 ++--- src/feature/dirauth/bridgeauth.h | 2 +- src/feature/dirauth/bwauth.h | 2 +- src/feature/dirauth/dirauth_periodic.h | 6 ++--- src/feature/dirauth/dirauth_sys.h | 2 +- src/feature/dirauth/dirvote.h | 4 ++-- src/feature/dirauth/dsigs_parse.h | 2 +- src/feature/dirauth/guardfraction.h | 2 +- .../dirauth/ns_detached_signatures_st.h | 2 +- src/feature/dirauth/process_descs.h | 2 +- src/feature/dirauth/reachability.h | 2 +- src/feature/dirauth/recommend_pkg.h | 4 ++-- src/feature/dirauth/shared_random.h | 4 ++-- src/feature/dirauth/vote_microdesc_hash_st.h | 2 +- src/feature/dirauth/voteflags.h | 6 ++--- src/feature/dircache/cached_dir_st.h | 2 +- src/feature/dircache/consdiffmgr.c | 2 +- src/feature/dircache/dircache.h | 2 +- src/feature/dirclient/dir_server_st.h | 2 +- src/feature/dirclient/dirclient.h | 2 +- src/feature/dirclient/dlstatus.h | 2 +- src/feature/dirclient/download_status_st.h | 2 +- src/feature/dircommon/dir_connection_st.h | 2 +- src/feature/dircommon/vote_timing_st.h | 2 +- src/feature/dircommon/voting_schedule.h | 2 +- src/feature/dirparse/microdesc_parse.h | 2 +- src/feature/dirparse/ns_parse.h | 4 ++-- src/feature/dirparse/sigcommon.h | 2 +- src/feature/dirparse/signing.h | 2 +- src/feature/dirparse/unparseable.h | 2 +- src/feature/hibernate/hibernate.c | 4 ++-- src/feature/hs/hs_service.h | 2 +- src/feature/hs/hs_stats.h | 2 +- src/feature/hs/hsdir_index_st.h | 2 +- src/feature/hs_common/shared_random_client.h | 2 +- src/feature/keymgt/loadkey.h | 2 +- src/feature/nodelist/authcert.h | 2 +- src/feature/nodelist/authority_cert_st.h | 2 +- src/feature/nodelist/desc_store_st.h | 2 +- src/feature/nodelist/describe.h | 2 +- src/feature/nodelist/dirlist.h | 2 +- src/feature/nodelist/document_signature_st.h | 2 +- src/feature/nodelist/extrainfo_st.h | 2 +- src/feature/nodelist/microdesc_st.h | 2 +- src/feature/nodelist/networkstatus.c | 2 +- .../nodelist/networkstatus_sr_info_st.h | 2 +- src/feature/nodelist/networkstatus_st.h | 2 +- .../nodelist/networkstatus_voter_info_st.h | 2 +- src/feature/nodelist/nickname.h | 2 +- src/feature/nodelist/node_select.h | 4 ++-- src/feature/nodelist/node_st.h | 2 +- src/feature/nodelist/nodefamily.h | 2 +- src/feature/nodelist/nodefamily_st.h | 2 +- src/feature/nodelist/routerinfo.h | 2 +- src/feature/nodelist/routerinfo_st.h | 2 +- src/feature/nodelist/routerlist_st.h | 2 +- src/feature/nodelist/routerstatus_st.h | 2 +- src/feature/nodelist/signed_descriptor_st.h | 2 +- src/feature/nodelist/vote_routerstatus_st.h | 2 +- src/feature/relay/dns.c | 2 +- src/feature/relay/onion_queue.h | 2 +- src/feature/relay/relay_periodic.c | 2 +- src/feature/relay/router.c | 2 +- src/feature/relay/selftest.h | 2 +- src/feature/rend/rend_authorized_client_st.h | 2 +- .../rend_encoded_v2_service_descriptor_st.h | 2 +- src/feature/rend/rend_intro_point_st.h | 2 +- src/feature/rend/rend_service_descriptor_st.h | 2 +- src/feature/rend/rendparse.h | 2 +- src/feature/stats/predict_ports.h | 2 +- src/feature/stats/rephist.h | 2 +- src/lib/arch/bytes.h | 6 ++--- src/lib/cc/compat_compiler.h | 2 +- src/lib/cc/ctassert.h | 6 ++--- src/lib/cc/torint.h | 8 +++---- src/lib/compress/compress_zstd.c | 16 ++++++------- src/lib/container/bitarray.h | 2 +- src/lib/container/map.h | 2 +- src/lib/container/namemap.h | 2 +- src/lib/container/namemap_st.h | 2 +- src/lib/container/order.h | 2 +- src/lib/container/smartlist.h | 2 +- src/lib/crypt_ops/crypto_cipher.h | 2 +- src/lib/crypt_ops/crypto_dh_openssl.c | 8 +++---- src/lib/crypt_ops/crypto_digest.c | 16 ++++++------- src/lib/crypt_ops/crypto_digest_openssl.c | 24 +++++++++---------- src/lib/crypt_ops/crypto_hkdf.c | 10 ++++---- src/lib/crypt_ops/crypto_init.c | 2 +- src/lib/crypt_ops/crypto_init.h | 2 +- src/lib/crypt_ops/crypto_nss_mgt.h | 4 ++-- src/lib/crypt_ops/crypto_ope.c | 4 ++-- src/lib/crypt_ops/crypto_ope.h | 4 ++-- src/lib/crypt_ops/crypto_openssl_mgt.c | 4 ++-- src/lib/crypt_ops/crypto_openssl_mgt.h | 2 +- src/lib/crypt_ops/crypto_rand.c | 12 +++++----- src/lib/crypt_ops/crypto_rand.h | 4 ++-- src/lib/crypt_ops/crypto_rand_fast.c | 12 +++++----- src/lib/crypt_ops/crypto_rsa.c | 2 +- src/lib/crypt_ops/crypto_rsa.h | 8 +++---- src/lib/crypt_ops/crypto_rsa_nss.c | 2 +- src/lib/crypt_ops/crypto_s2k.c | 4 ++-- src/lib/crypt_ops/crypto_util.c | 2 +- src/lib/crypt_ops/digestset.h | 2 +- src/lib/defs/dh_sizes.h | 2 +- src/lib/defs/digest_sizes.h | 2 +- src/lib/defs/time.h | 2 +- src/lib/defs/x25519_sizes.h | 2 +- src/lib/dispatch/dispatch.h | 2 +- src/lib/dispatch/dispatch_cfg.h | 2 +- src/lib/dispatch/dispatch_cfg_st.h | 2 +- src/lib/dispatch/dispatch_naming.h | 2 +- src/lib/dispatch/dispatch_st.h | 4 ++-- src/lib/dispatch/msgtypes.h | 2 +- src/lib/encoding/binascii.h | 2 +- src/lib/encoding/keyval.h | 2 +- src/lib/encoding/pem.h | 2 +- src/lib/encoding/qstring.h | 2 +- src/lib/encoding/time_fmt.h | 2 +- src/lib/err/torerr.h | 2 +- src/lib/evloop/token_bucket.h | 4 ++-- src/lib/fs/conffile.h | 2 +- src/lib/fs/dir.h | 2 +- src/lib/fs/files.h | 14 +++++------ src/lib/fs/lockfile.h | 2 +- src/lib/fs/mmap.c | 2 +- src/lib/fs/mmap.h | 2 +- src/lib/fs/path.h | 2 +- src/lib/fs/userdb.h | 4 ++-- src/lib/fs/winlib.h | 4 ++-- src/lib/geoip/country.h | 2 +- src/lib/intmath/addsub.h | 2 +- src/lib/intmath/logic.h | 2 +- src/lib/intmath/weakrng.h | 2 +- src/lib/lock/compat_mutex.h | 2 +- src/lib/log/escape.h | 2 +- src/lib/log/log.c | 4 ++-- src/lib/log/log.h | 2 +- src/lib/log/ratelim.h | 2 +- src/lib/log/util_bug.h | 6 ++--- src/lib/log/win32err.h | 2 +- src/lib/malloc/malloc.h | 4 ++-- src/lib/malloc/map_anon.c | 18 +++++++------- src/lib/malloc/map_anon.h | 2 +- src/lib/math/fp.h | 2 +- src/lib/math/laplace.h | 2 +- src/lib/math/prob_distr.h | 6 ++--- src/lib/meminfo/meminfo.h | 2 +- src/lib/net/alertsock.h | 2 +- src/lib/net/buffers_net.h | 2 +- src/lib/net/gethostname.h | 2 +- src/lib/net/inaddr.h | 2 +- src/lib/net/inaddr_st.h | 2 +- src/lib/net/nettypes.h | 2 +- src/lib/net/resolve.c | 4 ++-- src/lib/net/resolve.h | 2 +- src/lib/net/socket.c | 8 +++---- src/lib/net/socket.h | 2 +- src/lib/net/socketpair.c | 4 ++-- src/lib/net/socketpair.h | 2 +- src/lib/net/socks5_status.h | 2 +- src/lib/osinfo/uname.h | 2 +- src/lib/process/daemon.h | 2 +- src/lib/process/env.h | 2 +- src/lib/process/pidfile.h | 2 +- src/lib/process/process.c | 10 ++++---- src/lib/process/process.h | 6 ++--- src/lib/process/process_unix.c | 2 +- src/lib/process/process_unix.h | 6 ++--- src/lib/process/process_win32.c | 4 ++-- src/lib/process/process_win32.h | 6 ++--- src/lib/process/setuid.h | 2 +- src/lib/process/winprocess_sys.c | 2 +- src/lib/pubsub/pub_binding_st.h | 2 +- src/lib/pubsub/pubsub.h | 2 +- src/lib/pubsub/pubsub_build.h | 2 +- src/lib/pubsub/pubsub_builder_st.h | 4 ++-- src/lib/pubsub/pubsub_connect.h | 2 +- src/lib/pubsub/pubsub_flags.h | 2 +- src/lib/pubsub/pubsub_macros.h | 2 +- src/lib/pubsub/pubsub_publish.h | 2 +- src/lib/smartlist_core/smartlist_core.h | 2 +- src/lib/smartlist_core/smartlist_split.h | 2 +- src/lib/string/compat_string.h | 8 +++---- src/lib/string/parse_int.h | 2 +- src/lib/string/printf.h | 2 +- src/lib/string/scanf.h | 2 +- src/lib/subsys/subsys.h | 2 +- src/lib/term/getpass.h | 2 +- src/lib/testsupport/testsupport.h | 2 +- src/lib/thread/numcpus.h | 2 +- src/lib/time/compat_time.c | 10 ++++---- src/lib/time/compat_time.h | 2 +- src/lib/time/tvdiff.h | 2 +- src/lib/tls/nss_countbytes.h | 2 +- src/lib/tls/tortls.h | 10 ++++---- src/lib/tls/tortls_internal.h | 6 ++--- src/lib/tls/tortls_openssl.c | 14 +++++------ src/lib/tls/tortls_st.h | 4 ++-- src/lib/tls/x509.h | 6 ++--- src/lib/tls/x509_internal.h | 2 +- src/lib/tls/x509_nss.c | 8 +++---- src/lib/tls/x509_openssl.c | 4 ++-- src/lib/trace/debug.h | 2 +- src/lib/trace/events.h | 6 ++--- src/lib/trace/trace.h | 2 +- src/lib/wallclock/approx_time.h | 2 +- src/lib/wallclock/time_to_tm.h | 2 +- src/lib/wallclock/timeval.h | 4 ++-- src/lib/wallclock/tor_gettimeofday.h | 2 +- src/test/bench.c | 4 ++-- src/test/fuzz/fuzzing.h | 2 +- src/test/fuzz/fuzzing_common.c | 4 ++-- src/test/ptr_helpers.c | 2 +- src/test/ptr_helpers.h | 2 +- src/test/test-memwipe.c | 2 +- src/test/test_circuitpadding.c | 4 ++-- src/test/test_config.c | 6 ++--- src/test/test_connection.h | 2 +- src/test/test_crypto.c | 10 ++++---- src/test/test_dir_common.h | 2 +- src/test/test_dns.c | 4 ++-- src/test/test_dos.c | 2 +- src/test/test_link_handshake.c | 4 ++-- src/test/test_periodic_event.c | 2 +- src/test/test_process.c | 4 ++-- src/test/test_process_slow.c | 2 +- src/test/test_protover.c | 10 ++++---- src/test/test_rng.c | 2 +- src/test/test_shared_random.c | 2 +- src/test/test_tortls.c | 6 ++--- src/test/test_tortls.h | 2 +- src/test/test_tortls_openssl.c | 4 ++-- src/test/test_util.c | 10 ++++---- src/tools/tor-gencert.c | 2 +- 296 files changed, 480 insertions(+), 480 deletions(-) diff --git a/src/app/config/config.c b/src/app/config/config.c index d1b9d06bb3..4cbe81026c 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -3551,7 +3551,7 @@ options_validate(or_options_t *old_options, or_options_t *options, tor_free(t); t = format_recommended_version_list(options->RecommendedServerVersions, 1); tor_free(t); -#endif +#endif /* defined(HAVE_MODULE_DIRAUTH) */ if (options->UseEntryGuards) { log_info(LD_CONFIG, "Authoritative directory servers can't set " @@ -3577,7 +3577,7 @@ options_validate(or_options_t *old_options, or_options_t *options, if (options->GuardfractionFile && !old_options) { dirserv_read_guardfraction_file(options->GuardfractionFile, NULL); } -#endif +#endif /* defined(HAVE_MODULE_DIRAUTH) */ } if (options->AuthoritativeDir && !options->DirPort_set) @@ -4605,7 +4605,7 @@ compute_real_max_mem_in_queues(const uint64_t val, int log_guess) #else /* On a 32-bit platform, we can't have 8GB of ram. */ #define RAM_IS_VERY_LARGE(x) (0) -#endif +#endif /* SIZEOF_SIZE_T > 4 */ if (RAM_IS_VERY_LARGE(ram)) { /* If we have 8 GB, or more, RAM available, we set the MaxMemInQueues @@ -5777,7 +5777,7 @@ options_init_logs(const or_options_t *old_options, or_options_t *options, #else log_warn(LD_CONFIG, "Android logging is not supported" " on this system. Sorry."); -#endif // HAVE_ANDROID_LOG_H. +#endif /* defined(HAVE_ANDROID_LOG_H) */ goto cleanup; } } diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h index 4e03bec7fa..2ee2d15674 100644 --- a/src/app/config/or_options_st.h +++ b/src/app/config/or_options_st.h @@ -1110,4 +1110,4 @@ struct or_options_t { int DormantCanceledByStartup; }; -#endif +#endif /* !defined(TOR_OR_OPTIONS_ST_H) */ diff --git a/src/app/config/or_state_st.h b/src/app/config/or_state_st.h index cdb9b38287..f45c6196cc 100644 --- a/src/app/config/or_state_st.h +++ b/src/app/config/or_state_st.h @@ -96,4 +96,4 @@ struct or_state_t { int Dormant; }; -#endif +#endif /* !defined(TOR_OR_STATE_ST_H) */ diff --git a/src/app/config/statefile.h b/src/app/config/statefile.h index 1950078450..515c90a52f 100644 --- a/src/app/config/statefile.h +++ b/src/app/config/statefile.h @@ -31,6 +31,6 @@ STATIC struct config_line_t *get_transport_in_state_by_name( STATIC void or_state_free_(or_state_t *state); #define or_state_free(st) FREE_AND_NULL(or_state_t, or_state_free_, (st)) STATIC or_state_t *or_state_new(void); -#endif +#endif /* defined(STATEFILE_PRIVATE) */ #endif /* !defined(TOR_STATEFILE_H) */ diff --git a/src/app/main/subsysmgr.h b/src/app/main/subsysmgr.h index 4ac44afca7..d4426614e3 100644 --- a/src/app/main/subsysmgr.h +++ b/src/app/main/subsysmgr.h @@ -26,4 +26,4 @@ void subsystems_prefork(void); void subsystems_postfork(void); void subsystems_thread_cleanup(void); -#endif +#endif /* !defined(TOR_SUBSYSMGR_T) */ diff --git a/src/core/crypto/onion_crypto.h b/src/core/crypto/onion_crypto.h index 1cddde3610..7abdd6538e 100644 --- a/src/core/crypto/onion_crypto.h +++ b/src/core/crypto/onion_crypto.h @@ -44,4 +44,4 @@ void server_onion_keys_free_(server_onion_keys_t *keys); #define server_onion_keys_free(keys) \ FREE_AND_NULL(server_onion_keys_t, server_onion_keys_free_, (keys)) -#endif +#endif /* !defined(TOR_ONION_CRYPTO_H) */ diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c index 487f6d4a55..127f08683f 100644 --- a/src/core/mainloop/connection.c +++ b/src/core/mainloop/connection.c @@ -1476,7 +1476,7 @@ connection_listener_new(const struct sockaddr *listensockaddr, goto err; } } -#endif /* __APPLE__ */ +#endif /* !defined(__APPLE__) */ #endif /* defined(HAVE_SYS_UN_H) */ } else { log_err(LD_BUG, "Got unexpected address family %d.", @@ -2856,7 +2856,7 @@ retry_listener_ports(smartlist_t *old_conns, SMARTLIST_DEL_CURRENT(old_conns, conn); break; } -#endif +#endif /* defined(ENABLE_LISTENER_REBIND) */ } } SMARTLIST_FOREACH_END(wanted); @@ -2958,7 +2958,7 @@ retry_all_listeners(smartlist_t *new_conns, int close_all_noncontrol) conn_type_to_string(old_conn->type), old_conn->address, old_conn->port, new_conn->address, new_conn->port); } SMARTLIST_FOREACH_END(r); -#endif +#endif /* defined(ENABLE_LISTENER_REBIND) */ /* Any members that were still in 'listeners' don't correspond to * any configured port. Kill 'em. */ @@ -3957,9 +3957,9 @@ update_send_buffer_size(tor_socket_t sock) &isb, sizeof(isb), &bytesReturned, NULL, NULL)) { setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (const char*)&isb, sizeof(isb)); } -#else +#else /* !(defined(_WIN32)) */ (void) sock; -#endif +#endif /* defined(_WIN32) */ } /** Try to flush more bytes onto conn-\>s. diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c index 82042e8498..c051b11566 100644 --- a/src/core/mainloop/mainloop.c +++ b/src/core/mainloop/mainloop.c @@ -754,7 +754,7 @@ tor_shutdown_event_loop_for_restart_cb( tor_event_free(tor_shutdown_event_loop_for_restart_event); tor_shutdown_event_loop_and_exit(0); } -#endif +#endif /* defined(ENABLE_RESTART_DEBUGGING) */ /** * After finishing the current callback (if any), shut down the main loop, @@ -2375,7 +2375,7 @@ do_main_loop(void) event_add(tor_shutdown_event_loop_for_restart_event, &restart_after); } } -#endif +#endif /* defined(ENABLE_RESTART_DEBUGGING) */ return run_main_loop_until_done(); } diff --git a/src/core/mainloop/mainloop.h b/src/core/mainloop/mainloop.h index cdc2bf8608..caef736c15 100644 --- a/src/core/mainloop/mainloop.h +++ b/src/core/mainloop/mainloop.h @@ -112,7 +112,7 @@ extern smartlist_t *connection_array; /* We need the periodic_event_item_t definition. */ #include "core/mainloop/periodic.h" extern periodic_event_item_t mainloop_periodic_events[]; -#endif -#endif /* defined(MAIN_PRIVATE) */ +#endif /* defined(TOR_UNIT_TESTS) */ +#endif /* defined(MAINLOOP_PRIVATE) */ -#endif +#endif /* !defined(TOR_MAINLOOP_H) */ diff --git a/src/core/mainloop/mainloop_pubsub.c b/src/core/mainloop/mainloop_pubsub.c index 724a3115c8..53275d8119 100644 --- a/src/core/mainloop/mainloop_pubsub.c +++ b/src/core/mainloop/mainloop_pubsub.c @@ -6,9 +6,9 @@ #include "orconfig.h" -#include "src/core/or/or.h" -#include "src/core/mainloop/mainloop.h" -#include "src/core/mainloop/mainloop_pubsub.h" +#include "core/or/or.h" +#include "core/mainloop/mainloop.h" +#include "core/mainloop/mainloop_pubsub.h" #include "lib/container/smartlist.h" #include "lib/dispatch/dispatch.h" diff --git a/src/core/mainloop/mainloop_pubsub.h b/src/core/mainloop/mainloop_pubsub.h index a31b2b4ba7..365a3dd565 100644 --- a/src/core/mainloop/mainloop_pubsub.h +++ b/src/core/mainloop/mainloop_pubsub.h @@ -21,4 +21,4 @@ int tor_mainloop_set_delivery_strategy(const char *msg_channel_name, deliv_strategy_t strategy); void tor_mainloop_disconnect_pubsub(void); -#endif +#endif /* !defined(TOR_MAINLOOP_PUBSUB_H) */ diff --git a/src/core/mainloop/mainloop_sys.h b/src/core/mainloop/mainloop_sys.h index 14c567278c..fa74fe5d4b 100644 --- a/src/core/mainloop/mainloop_sys.h +++ b/src/core/mainloop/mainloop_sys.h @@ -9,4 +9,4 @@ extern const struct subsys_fns_t sys_mainloop; -#endif +#endif /* !defined(MAINLOOP_SYS_H) */ diff --git a/src/core/mainloop/netstatus.h b/src/core/mainloop/netstatus.h index aba631e2fb..e8469ff558 100644 --- a/src/core/mainloop/netstatus.h +++ b/src/core/mainloop/netstatus.h @@ -21,4 +21,4 @@ void netstatus_flush_to_state(or_state_t *state, time_t now); void netstatus_load_from_state(const or_state_t *state, time_t now); void netstatus_note_clock_jumped(time_t seconds_diff); -#endif +#endif /* !defined(TOR_NETSTATUS_H) */ diff --git a/src/core/or/addr_policy_st.h b/src/core/or/addr_policy_st.h index a75f1a731d..11442d29b4 100644 --- a/src/core/or/addr_policy_st.h +++ b/src/core/or/addr_policy_st.h @@ -43,4 +43,4 @@ struct addr_policy_t { uint16_t prt_max; /**< Highest port number to accept/reject. */ }; -#endif +#endif /* !defined(TOR_ADDR_POLICY_ST_H) */ diff --git a/src/core/or/address_set.h b/src/core/or/address_set.h index 7a9e71628e..95608a9a53 100644 --- a/src/core/or/address_set.h +++ b/src/core/or/address_set.h @@ -28,4 +28,4 @@ void address_set_add_ipv4h(address_set_t *set, uint32_t addr); int address_set_probably_contains(const address_set_t *set, const struct tor_addr_t *addr); -#endif +#endif /* !defined(TOR_ADDRESS_SET_H) */ diff --git a/src/core/or/cell_queue_st.h b/src/core/or/cell_queue_st.h index 130b95a011..7ba339b965 100644 --- a/src/core/or/cell_queue_st.h +++ b/src/core/or/cell_queue_st.h @@ -26,4 +26,4 @@ struct cell_queue_t { int n; /**< The number of cells in the queue. */ }; -#endif +#endif /* !defined(PACKED_CELL_ST_H) */ diff --git a/src/core/or/cell_st.h b/src/core/or/cell_st.h index 7ab7eceb50..c4eec4f4b5 100644 --- a/src/core/or/cell_st.h +++ b/src/core/or/cell_st.h @@ -16,5 +16,5 @@ struct cell_t { uint8_t payload[CELL_PAYLOAD_SIZE]; /**< Cell body. */ }; -#endif +#endif /* !defined(CELL_ST_H) */ diff --git a/src/core/or/circuit_st.h b/src/core/or/circuit_st.h index 3c7b931614..eae3c908d5 100644 --- a/src/core/or/circuit_st.h +++ b/src/core/or/circuit_st.h @@ -229,4 +229,4 @@ struct circuit_t { struct circpad_machine_runtime_t *padding_info[CIRCPAD_MAX_MACHINES]; }; -#endif +#endif /* !defined(CIRCUIT_ST_H) */ diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c index b2315d822f..9210fa4e37 100644 --- a/src/core/or/circuitpadding.c +++ b/src/core/or/circuitpadding.c @@ -2595,7 +2595,7 @@ circpad_circ_responder_machine_init(void) circpad_register_padding_machine(circ_responder_machine, relay_padding_machines); } -#endif +#endif /* defined(TOR_UNIT_TESTS) */ /** * Initialize all of our padding machines. @@ -2977,4 +2977,4 @@ circpad_string_to_machine(const char *str) return NULL; } -#endif +#endif /* 0 */ diff --git a/src/core/or/circuitpadding.h b/src/core/or/circuitpadding.h index 0dc66246d9..3cf40e11db 100644 --- a/src/core/or/circuitpadding.h +++ b/src/core/or/circuitpadding.h @@ -10,7 +10,7 @@ #ifndef TOR_CIRCUITPADDING_H #define TOR_CIRCUITPADDING_H -#include "src/trunnel/circpad_negotiation.h" +#include "trunnel/circpad_negotiation.h" #include "lib/evloop/timers.h" struct circuit_t; @@ -803,6 +803,6 @@ extern smartlist_t *relay_padding_machines; #endif -#endif +#endif /* defined(CIRCUITPADDING_PRIVATE) */ -#endif +#endif /* !defined(TOR_CIRCUITPADDING_H) */ diff --git a/src/core/or/circuitpadding_machines.h b/src/core/or/circuitpadding_machines.h index c44a70f2cc..3c9798d42d 100644 --- a/src/core/or/circuitpadding_machines.h +++ b/src/core/or/circuitpadding_machines.h @@ -30,6 +30,6 @@ void circpad_machine_client_hide_rend_circuits(smartlist_t *machines_sl); * The actual value will be sampled between the min and max.*/ #define INTRO_MACHINE_MAXIMUM_PADDING 10 -#endif +#endif /* defined(CIRCUITPADDING_MACHINES_PRIVATE) */ -#endif +#endif /* !defined(TOR_CIRCUITPADDING_MACHINES_H) */ diff --git a/src/core/or/connection_st.h b/src/core/or/connection_st.h index d1430eda14..1c42a56d6b 100644 --- a/src/core/or/connection_st.h +++ b/src/core/or/connection_st.h @@ -146,4 +146,4 @@ struct connection_t { * directory connection. */ #define DIR_CONN_IS_SERVER(conn) ((conn)->purpose == DIR_PURPOSE_SERVER) -#endif +#endif /* !defined(CONNECTION_ST_H) */ diff --git a/src/core/or/cpath_build_state_st.h b/src/core/or/cpath_build_state_st.h index dbe596d851..4572a10430 100644 --- a/src/core/or/cpath_build_state_st.h +++ b/src/core/or/cpath_build_state_st.h @@ -34,5 +34,5 @@ struct cpath_build_state_t { time_t expiry_time; }; -#endif +#endif /* !defined(CIRCUIT_BUILD_STATE_ST_ST_H) */ diff --git a/src/core/or/crypt_path.h b/src/core/or/crypt_path.h index 9850610ef7..7a95fec2b4 100644 --- a/src/core/or/crypt_path.h +++ b/src/core/or/crypt_path.h @@ -43,4 +43,4 @@ uint8_t *cpath_get_sendme_digest(crypt_path_t *cpath); unsigned int cpath_get_n_hops(crypt_path_t **head_ptr); #endif /* defined(TOR_UNIT_TESTS) */ -#endif +#endif /* !defined(CRYPT_PATH_H) */ diff --git a/src/core/or/crypt_path_reference_st.h b/src/core/or/crypt_path_reference_st.h index 3d79f26c1c..1827022b4e 100644 --- a/src/core/or/crypt_path_reference_st.h +++ b/src/core/or/crypt_path_reference_st.h @@ -19,5 +19,5 @@ struct crypt_path_reference_t { crypt_path_t *cpath; }; -#endif +#endif /* !defined(CRYPT_PATH_REFERENCE_ST_H) */ diff --git a/src/core/or/crypt_path_st.h b/src/core/or/crypt_path_st.h index d18d23e939..249ac6aaa3 100644 --- a/src/core/or/crypt_path_st.h +++ b/src/core/or/crypt_path_st.h @@ -35,7 +35,7 @@ struct onion_handshake_state_t { /* Helper macro to access private members of a struct. */ #define pvt_crypto CRYPT_PATH_PRIV_FIELD(crypto) -#endif +#endif /* defined(CRYPT_PATH_PRIVATE) */ /** Holds accounting information for a single step in the layered encryption * performed by a circuit. Used only at the client edge of a circuit. */ @@ -82,4 +82,4 @@ struct crypt_path_t { relay_crypto_t CRYPT_PATH_PRIV_FIELD(crypto); }; -#endif +#endif /* !defined(CRYPT_PATH_ST_H) */ diff --git a/src/core/or/destroy_cell_queue_st.h b/src/core/or/destroy_cell_queue_st.h index 56630670ba..e917afc700 100644 --- a/src/core/or/destroy_cell_queue_st.h +++ b/src/core/or/destroy_cell_queue_st.h @@ -23,5 +23,5 @@ struct destroy_cell_queue_t { int n; /**< The number of cells in the queue. */ }; -#endif +#endif /* !defined(DESTROY_CELL_QUEUE_ST_H) */ diff --git a/src/core/or/dos.h b/src/core/or/dos.h index 95448d0530..b5154a7cd2 100644 --- a/src/core/or/dos.h +++ b/src/core/or/dos.h @@ -134,7 +134,7 @@ MOCK_DECL(STATIC unsigned int, get_param_cc_enabled, MOCK_DECL(STATIC unsigned int, get_param_conn_enabled, (const networkstatus_t *ns)); -#endif /* TOR_DOS_PRIVATE */ +#endif /* defined(DOS_PRIVATE) */ -#endif /* TOR_DOS_H */ +#endif /* !defined(TOR_DOS_H) */ diff --git a/src/core/or/edge_connection_st.h b/src/core/or/edge_connection_st.h index 1665b8589f..8922a3a9cf 100644 --- a/src/core/or/edge_connection_st.h +++ b/src/core/or/edge_connection_st.h @@ -73,5 +73,5 @@ struct edge_connection_t { uint64_t dirreq_id; }; -#endif +#endif /* !defined(EDGE_CONNECTION_ST_H) */ diff --git a/src/core/or/entry_connection_st.h b/src/core/or/entry_connection_st.h index 45621fadbf..e65c545d17 100644 --- a/src/core/or/entry_connection_st.h +++ b/src/core/or/entry_connection_st.h @@ -96,5 +96,5 @@ struct entry_connection_t { /** Cast a entry_connection_t subtype pointer to a edge_connection_t **/ #define ENTRY_TO_EDGE_CONN(c) (&(((c))->edge_)) -#endif +#endif /* !defined(ENTRY_CONNECTION_ST_H) */ diff --git a/src/core/or/entry_port_cfg_st.h b/src/core/or/entry_port_cfg_st.h index 87dfb331e5..b84838d44f 100644 --- a/src/core/or/entry_port_cfg_st.h +++ b/src/core/or/entry_port_cfg_st.h @@ -50,5 +50,5 @@ struct entry_port_cfg_t { }; -#endif +#endif /* !defined(ENTRY_PORT_CFG_ST_H) */ diff --git a/src/core/or/extend_info_st.h b/src/core/or/extend_info_st.h index bc7a77b1b2..7704ff16b5 100644 --- a/src/core/or/extend_info_st.h +++ b/src/core/or/extend_info_st.h @@ -27,4 +27,4 @@ struct extend_info_t { curve25519_public_key_t curve25519_onion_key; }; -#endif +#endif /* !defined(EXTEND_INFO_ST_H) */ diff --git a/src/core/or/half_edge_st.h b/src/core/or/half_edge_st.h index d4617be108..1fe47ad3f1 100644 --- a/src/core/or/half_edge_st.h +++ b/src/core/or/half_edge_st.h @@ -30,5 +30,5 @@ typedef struct half_edge_t { int connected_pending : 1; } half_edge_t; -#endif +#endif /* !defined(HALF_EDGE_ST_H) */ diff --git a/src/core/or/listener_connection_st.h b/src/core/or/listener_connection_st.h index 8989a39dc8..1250d9c9b4 100644 --- a/src/core/or/listener_connection_st.h +++ b/src/core/or/listener_connection_st.h @@ -21,5 +21,5 @@ struct listener_connection_t { }; -#endif +#endif /* !defined(LISTENER_CONNECTION_ST_H) */ diff --git a/src/core/or/ocirc_event.h b/src/core/or/ocirc_event.h index 0b125c2898..59ec9e27cb 100644 --- a/src/core/or/ocirc_event.h +++ b/src/core/or/ocirc_event.h @@ -86,4 +86,4 @@ void ocirc_event_subscribe(ocirc_event_rcvr_t fn); void ocirc_event_publish(const ocirc_event_msg_t *msg); #endif -#endif /* defined(TOR_OCIRC_EVENT_STATE_H) */ +#endif /* !defined(TOR_OCIRC_EVENT_H) */ diff --git a/src/core/or/ocirc_event_sys.h b/src/core/or/ocirc_event_sys.h index 9d4bfe5333..61180496da 100644 --- a/src/core/or/ocirc_event_sys.h +++ b/src/core/or/ocirc_event_sys.h @@ -10,4 +10,4 @@ extern const struct subsys_fns_t sys_ocirc_event; -#endif /* defined(TOR_OCIRC_EVENT_H) */ +#endif /* !defined(TOR_OCIRC_EVENT_SYS_H) */ diff --git a/src/core/or/or_circuit_st.h b/src/core/or/or_circuit_st.h index 062e4ac854..6789668224 100644 --- a/src/core/or/or_circuit_st.h +++ b/src/core/or/or_circuit_st.h @@ -71,5 +71,5 @@ struct or_circuit_t { uint64_t total_cell_waiting_time; }; -#endif +#endif /* !defined(OR_CIRCUIT_ST_H) */ diff --git a/src/core/or/or_connection_st.h b/src/core/or/or_connection_st.h index a5ce844bff..051fcd00d3 100644 --- a/src/core/or/or_connection_st.h +++ b/src/core/or/or_connection_st.h @@ -91,4 +91,4 @@ struct or_connection_t { uint64_t bytes_xmitted, bytes_xmitted_by_tls; }; -#endif +#endif /* !defined(OR_CONNECTION_ST_H) */ diff --git a/src/core/or/or_handshake_certs_st.h b/src/core/or/or_handshake_certs_st.h index a93b7104aa..9deb6d6d59 100644 --- a/src/core/or/or_handshake_certs_st.h +++ b/src/core/or/or_handshake_certs_st.h @@ -37,4 +37,4 @@ struct or_handshake_certs_t { size_t ed_rsa_crosscert_len; }; -#endif +#endif /* !defined(OR_HANDSHAKE_CERTS_ST) */ diff --git a/src/core/or/or_handshake_state_st.h b/src/core/or/or_handshake_state_st.h index 09a8a34179..472ce8a302 100644 --- a/src/core/or/or_handshake_state_st.h +++ b/src/core/or/or_handshake_state_st.h @@ -74,5 +74,5 @@ struct or_handshake_state_t { or_handshake_certs_t *certs; }; -#endif +#endif /* !defined(OR_HANDSHAKE_STATE_ST) */ diff --git a/src/core/or/or_periodic.c b/src/core/or/or_periodic.c index 93dfa8cf8b..fe28c99192 100644 --- a/src/core/or/or_periodic.c +++ b/src/core/or/or_periodic.c @@ -18,7 +18,7 @@ #include "core/or/circuituse.h" #include "core/or/or_periodic.h" -#include "src/feature/relay/routermode.h" +#include "feature/relay/routermode.h" #define DECLARE_EVENT(name, roles, flags) \ static periodic_event_item_t name ## _event = \ diff --git a/src/core/or/orconn_event.h b/src/core/or/orconn_event.h index 80289d53e6..d6635793db 100644 --- a/src/core/or/orconn_event.h +++ b/src/core/or/orconn_event.h @@ -117,4 +117,4 @@ void orconn_event_subscribe(orconn_event_rcvr_t); void orconn_event_publish(const orconn_event_msg_t *); #endif -#endif /* defined(TOR_ORCONN_EVENT_H) */ +#endif /* !defined(TOR_ORCONN_EVENT_H) */ diff --git a/src/core/or/orconn_event_sys.h b/src/core/or/orconn_event_sys.h index bfb0a3ac4a..9703b2e3d1 100644 --- a/src/core/or/orconn_event_sys.h +++ b/src/core/or/orconn_event_sys.h @@ -9,4 +9,4 @@ extern const struct subsys_fns_t sys_orconn_event; -#endif /* defined(TOR_ORCONN_SYS_H) */ +#endif /* !defined(TOR_ORCONN_EVENT_SYS_H) */ diff --git a/src/core/or/origin_circuit_st.h b/src/core/or/origin_circuit_st.h index daa5f41dad..01bbc84ae2 100644 --- a/src/core/or/origin_circuit_st.h +++ b/src/core/or/origin_circuit_st.h @@ -295,4 +295,4 @@ struct origin_circuit_t { }; -#endif +#endif /* !defined(ORIGIN_CIRCUIT_ST_H) */ diff --git a/src/core/or/port_cfg_st.h b/src/core/or/port_cfg_st.h index b67091ce32..e9e82bb1de 100644 --- a/src/core/or/port_cfg_st.h +++ b/src/core/or/port_cfg_st.h @@ -31,5 +31,5 @@ struct port_cfg_t { char unix_addr[FLEXIBLE_ARRAY_MEMBER]; }; -#endif +#endif /* !defined(PORT_CFG_ST_H) */ diff --git a/src/core/or/relay_crypto_st.h b/src/core/or/relay_crypto_st.h index 1f243ccdc8..83bbd329a6 100644 --- a/src/core/or/relay_crypto_st.h +++ b/src/core/or/relay_crypto_st.h @@ -30,4 +30,4 @@ struct relay_crypto_t { }; #undef crypto_cipher_t -#endif +#endif /* !defined(RELAY_CRYPTO_ST_H) */ diff --git a/src/core/or/sendme.h b/src/core/or/sendme.h index cdbdf55ac7..20477103fd 100644 --- a/src/core/or/sendme.h +++ b/src/core/or/sendme.h @@ -73,8 +73,8 @@ STATIC bool sendme_is_valid(const circuit_t *circ, const uint8_t *cell_payload, size_t cell_payload_len); -#endif /* TOR_UNIT_TESTS */ +#endif /* defined(TOR_UNIT_TESTS) */ -#endif /* SENDME_PRIVATE */ +#endif /* defined(SENDME_PRIVATE) */ #endif /* !defined(TOR_SENDME_H) */ diff --git a/src/core/or/server_port_cfg_st.h b/src/core/or/server_port_cfg_st.h index bd026af7ee..0738735c61 100644 --- a/src/core/or/server_port_cfg_st.h +++ b/src/core/or/server_port_cfg_st.h @@ -16,5 +16,5 @@ struct server_port_cfg_t { unsigned int bind_ipv6_only : 1; }; -#endif +#endif /* !defined(SERVER_PORT_CFG_ST_H) */ diff --git a/src/core/or/socks_request_st.h b/src/core/or/socks_request_st.h index 5922870c61..9fb941ff7e 100644 --- a/src/core/or/socks_request_st.h +++ b/src/core/or/socks_request_st.h @@ -74,4 +74,4 @@ struct socks_request_t { uint8_t socks5_atyp; /* SOCKS5 address type */ }; -#endif +#endif /* !defined(SOCKS_REQUEST_ST_H) */ diff --git a/src/core/or/tor_version_st.h b/src/core/or/tor_version_st.h index 716429bd32..c5bdcaf07b 100644 --- a/src/core/or/tor_version_st.h +++ b/src/core/or/tor_version_st.h @@ -28,5 +28,5 @@ struct tor_version_t { char git_tag[DIGEST_LEN]; }; -#endif +#endif /* !defined(TOR_VERSION_ST_H) */ diff --git a/src/core/or/var_cell_st.h b/src/core/or/var_cell_st.h index 4287c83f6d..607c0d6c83 100644 --- a/src/core/or/var_cell_st.h +++ b/src/core/or/var_cell_st.h @@ -19,5 +19,5 @@ struct var_cell_t { uint8_t payload[FLEXIBLE_ARRAY_MEMBER]; }; -#endif +#endif /* !defined(VAR_CELL_ST_H) */ diff --git a/src/feature/api/tor_api.c b/src/feature/api/tor_api.c index 697397d46b..fd9d241353 100644 --- a/src/feature/api/tor_api.c +++ b/src/feature/api/tor_api.c @@ -40,10 +40,10 @@ #define raw_socketpair tor_ersatz_socketpair #define raw_closesocket closesocket #define snprintf _snprintf -#else +#else /* !(defined(_WIN32)) */ #define raw_socketpair socketpair #define raw_closesocket close -#endif +#endif /* defined(_WIN32) */ #ifdef HAVE_UNISTD_H #include diff --git a/src/feature/api/tor_api.h b/src/feature/api/tor_api.h index 2bf130c376..cb84853a52 100644 --- a/src/feature/api/tor_api.h +++ b/src/feature/api/tor_api.h @@ -55,7 +55,7 @@ typedef SOCKET tor_control_socket_t; #else typedef int tor_control_socket_t; #define INVALID_TOR_CONTROL_SOCKET (-1) -#endif +#endif /* defined(_WIN32) */ /** DOCDOC */ tor_control_socket_t tor_main_configuration_setup_control_socket( diff --git a/src/feature/control/btrack_circuit.h b/src/feature/control/btrack_circuit.h index c40822f1f1..9e06fefb07 100644 --- a/src/feature/control/btrack_circuit.h +++ b/src/feature/control/btrack_circuit.h @@ -12,4 +12,4 @@ int btrack_circ_init(void); void btrack_circ_fini(void); -#endif /* defined(TOR_BTRACK_CIRCUIT_H) */ +#endif /* !defined(TOR_BTRACK_CIRCUIT_H) */ diff --git a/src/feature/control/btrack_orconn.h b/src/feature/control/btrack_orconn.h index 6ab4892a78..f8f5c1096c 100644 --- a/src/feature/control/btrack_orconn.h +++ b/src/feature/control/btrack_orconn.h @@ -30,9 +30,9 @@ typedef struct bt_orconn_t { bool is_onehop; /**< Is this for a one-hop circuit? */ } bt_orconn_t; -#endif /* defined(BTRACK_ORCONN_PRIVATE) */ +#endif /* defined(BTRACK_ORCONN_PRIVATE) */ int btrack_orconn_init(void); void btrack_orconn_fini(void); -#endif /* defined(TOR_BTRACK_ORCONN_H) */ +#endif /* !defined(TOR_BTRACK_ORCONN_H) */ diff --git a/src/feature/control/btrack_orconn_cevent.h b/src/feature/control/btrack_orconn_cevent.h index 954b452451..afec55581e 100644 --- a/src/feature/control/btrack_orconn_cevent.h +++ b/src/feature/control/btrack_orconn_cevent.h @@ -15,4 +15,4 @@ void bto_cevent_anyconn(const bt_orconn_t *); void bto_cevent_apconn(const bt_orconn_t *); void bto_cevent_reset(void); -#endif /* defined(TOR_BTRACK_ORCONN_CEVENT_H) */ +#endif /* !defined(TOR_BTRACK_ORCONN_CEVENT_H) */ diff --git a/src/feature/control/btrack_orconn_maps.h b/src/feature/control/btrack_orconn_maps.h index 2065eb61b2..c2043fa153 100644 --- a/src/feature/control/btrack_orconn_maps.h +++ b/src/feature/control/btrack_orconn_maps.h @@ -15,4 +15,4 @@ bt_orconn_t *bto_find_or_new(uint64_t, uint64_t); void bto_init_maps(void); void bto_clear_maps(void); -#endif /* defined(TOR_BTRACK_ORCONN_MAPS_H) */ +#endif /* !defined(TOR_BTRACK_ORCONN_MAPS_H) */ diff --git a/src/feature/control/btrack_sys.h b/src/feature/control/btrack_sys.h index fad35b41db..3f831d0640 100644 --- a/src/feature/control/btrack_sys.h +++ b/src/feature/control/btrack_sys.h @@ -11,4 +11,4 @@ extern const struct subsys_fns_t sys_btrack; -#endif /* defined(TOR_BTRACK_SYS_H) */ +#endif /* !defined(TOR_BTRACK_SYS_H) */ diff --git a/src/feature/control/control_connection_st.h b/src/feature/control/control_connection_st.h index cace6bb36f..c9164f03b3 100644 --- a/src/feature/control/control_connection_st.h +++ b/src/feature/control/control_connection_st.h @@ -44,4 +44,4 @@ struct control_connection_t { char *current_cmd; }; -#endif +#endif /* !defined(CONTROL_CONNECTION_ST_H) */ diff --git a/src/feature/control/control_getinfo.h b/src/feature/control/control_getinfo.h index 2d56586f6d..52978686d8 100644 --- a/src/feature/control/control_getinfo.h +++ b/src/feature/control/control_getinfo.h @@ -58,4 +58,4 @@ STATIC int getinfo_helper_current_time( const char **errmsg); #endif /* defined(CONTROL_GETINFO_PRIVATE) */ -#endif /* !defined(TOR_CONTROL_GETINFO) */ +#endif /* !defined(TOR_CONTROL_GETINFO_H) */ diff --git a/src/feature/control/fmt_serverstatus.h b/src/feature/control/fmt_serverstatus.h index 4b95e5b59f..d9190cb7e1 100644 --- a/src/feature/control/fmt_serverstatus.h +++ b/src/feature/control/fmt_serverstatus.h @@ -15,4 +15,4 @@ int list_server_status_v1(smartlist_t *routers, char **router_status_out, int for_controller); -#endif +#endif /* !defined(TOR_FMT_SERVERSTATUS_H) */ diff --git a/src/feature/control/getinfo_geoip.h b/src/feature/control/getinfo_geoip.h index fe22137859..94759d0d18 100644 --- a/src/feature/control/getinfo_geoip.h +++ b/src/feature/control/getinfo_geoip.h @@ -11,4 +11,4 @@ int getinfo_helper_geoip(control_connection_t *control_conn, const char *question, char **answer, const char **errmsg); -#endif +#endif /* !defined(TOR_GETINFO_GEOIP_H) */ diff --git a/src/feature/dirauth/authmode.h b/src/feature/dirauth/authmode.h index 876a1f947b..48afc3cdb4 100644 --- a/src/feature/dirauth/authmode.h +++ b/src/feature/dirauth/authmode.h @@ -29,7 +29,7 @@ authdir_mode_v3(const or_options_t *options) #define have_module_dirauth() (1) -#else /* HAVE_MODULE_DIRAUTH */ +#else /* !(defined(HAVE_MODULE_DIRAUTH)) */ #define authdir_mode(options) (((void)(options)),0) #define authdir_mode_handles_descs(options,purpose) \ @@ -41,6 +41,6 @@ authdir_mode_v3(const or_options_t *options) #define have_module_dirauth() (0) -#endif /* HAVE_MODULE_DIRAUTH */ +#endif /* defined(HAVE_MODULE_DIRAUTH) */ -#endif /* TOR_MODE_H */ +#endif /* !defined(TOR_DIRAUTH_MODE_H) */ diff --git a/src/feature/dirauth/bridgeauth.h b/src/feature/dirauth/bridgeauth.h index cc80fd6375..4905e9c3ee 100644 --- a/src/feature/dirauth/bridgeauth.h +++ b/src/feature/dirauth/bridgeauth.h @@ -9,4 +9,4 @@ void bridgeauth_dump_bridge_status_to_file(time_t now); -#endif +#endif /* !defined(TOR_DIRAUTH_BRIDGEAUTH_H) */ diff --git a/src/feature/dirauth/bwauth.h b/src/feature/dirauth/bwauth.h index 8b7acc4a1c..81c8affbd7 100644 --- a/src/feature/dirauth/bwauth.h +++ b/src/feature/dirauth/bwauth.h @@ -55,4 +55,4 @@ STATIC void dirserv_cache_measured_bw(const measured_bw_line_t *parsed_line, STATIC void dirserv_expire_measured_bw_cache(time_t now); #endif /* defined(BWAUTH_PRIVATE) */ -#endif +#endif /* !defined(TOR_BWAUTH_H) */ diff --git a/src/feature/dirauth/dirauth_periodic.h b/src/feature/dirauth/dirauth_periodic.h index de14cbb3c8..1124fae952 100644 --- a/src/feature/dirauth/dirauth_periodic.h +++ b/src/feature/dirauth/dirauth_periodic.h @@ -12,7 +12,7 @@ void dirauth_register_periodic_events(void); void reschedule_dirvote(const or_options_t *options); -#else +#else /* !(defined(HAVE_MODULE_DIRAUTH)) */ static inline void reschedule_dirvote(const or_options_t *options) @@ -20,6 +20,6 @@ reschedule_dirvote(const or_options_t *options) (void)options; } -#endif +#endif /* defined(HAVE_MODULE_DIRAUTH) */ -#endif +#endif /* !defined(DIRVOTE_PERIODIC_H) */ diff --git a/src/feature/dirauth/dirauth_sys.h b/src/feature/dirauth/dirauth_sys.h index e10f4c9589..4e9b6a2ab4 100644 --- a/src/feature/dirauth/dirauth_sys.h +++ b/src/feature/dirauth/dirauth_sys.h @@ -9,4 +9,4 @@ extern const struct subsys_fns_t sys_dirauth; -#endif +#endif /* !defined(DIRAUTH_SYS_H) */ diff --git a/src/feature/dirauth/dirvote.h b/src/feature/dirauth/dirvote.h index f9de5ebc41..a0cfe0a34c 100644 --- a/src/feature/dirauth/dirvote.h +++ b/src/feature/dirauth/dirvote.h @@ -128,7 +128,7 @@ struct config_line_t; char *format_recommended_version_list(const struct config_line_t *line, int warn); -#else /* HAVE_MODULE_DIRAUTH */ +#else /* !(defined(HAVE_MODULE_DIRAUTH)) */ static inline time_t dirvote_act(const or_options_t *options, time_t now) @@ -193,7 +193,7 @@ dirvote_add_signatures(const char *detached_signatures_body, return 0; } -#endif /* HAVE_MODULE_DIRAUTH */ +#endif /* defined(HAVE_MODULE_DIRAUTH) */ /* Item access */ MOCK_DECL(const char*, dirvote_get_pending_consensus, diff --git a/src/feature/dirauth/dsigs_parse.h b/src/feature/dirauth/dsigs_parse.h index fec51ba488..0cc53072f8 100644 --- a/src/feature/dirauth/dsigs_parse.h +++ b/src/feature/dirauth/dsigs_parse.h @@ -19,4 +19,4 @@ void ns_detached_signatures_free_(ns_detached_signatures_t *s); #define ns_detached_signatures_free(s) \ FREE_AND_NULL(ns_detached_signatures_t, ns_detached_signatures_free_, (s)) -#endif +#endif /* !defined(TOR_DSIGS_PARSE_H) */ diff --git a/src/feature/dirauth/guardfraction.h b/src/feature/dirauth/guardfraction.h index 72404907a4..9f01ded838 100644 --- a/src/feature/dirauth/guardfraction.h +++ b/src/feature/dirauth/guardfraction.h @@ -21,4 +21,4 @@ dirserv_read_guardfraction_file_from_str(const char *guardfraction_file_str, int dirserv_read_guardfraction_file(const char *fname, smartlist_t *vote_routerstatuses); -#endif +#endif /* !defined(TOR_GUARDFRACTION_H) */ diff --git a/src/feature/dirauth/ns_detached_signatures_st.h b/src/feature/dirauth/ns_detached_signatures_st.h index 0f92be2f0d..61d20b7525 100644 --- a/src/feature/dirauth/ns_detached_signatures_st.h +++ b/src/feature/dirauth/ns_detached_signatures_st.h @@ -18,5 +18,5 @@ struct ns_detached_signatures_t { * document_signature_t */ }; -#endif +#endif /* !defined(NS_DETACHED_SIGNATURES_ST_H) */ diff --git a/src/feature/dirauth/process_descs.h b/src/feature/dirauth/process_descs.h index 510e54f813..001c866eba 100644 --- a/src/feature/dirauth/process_descs.h +++ b/src/feature/dirauth/process_descs.h @@ -36,4 +36,4 @@ void dirserv_set_node_flags_from_authoritative_status(node_t *node, int dirserv_would_reject_router(const routerstatus_t *rs); -#endif +#endif /* !defined(TOR_RECV_UPLOADS_H) */ diff --git a/src/feature/dirauth/reachability.h b/src/feature/dirauth/reachability.h index 5a938673ff..873a3f9a23 100644 --- a/src/feature/dirauth/reachability.h +++ b/src/feature/dirauth/reachability.h @@ -33,4 +33,4 @@ int dirserv_should_launch_reachability_test(const routerinfo_t *ri, void dirserv_single_reachability_test(time_t now, routerinfo_t *router); void dirserv_test_reachability(time_t now); -#endif +#endif /* !defined(TOR_REACHABILITY_H) */ diff --git a/src/feature/dirauth/recommend_pkg.h b/src/feature/dirauth/recommend_pkg.h index 1f97d50177..af17e945e8 100644 --- a/src/feature/dirauth/recommend_pkg.h +++ b/src/feature/dirauth/recommend_pkg.h @@ -24,6 +24,6 @@ validate_recommended_package_line(const char *line) return 0; } -#endif +#endif /* defined(HAVE_MODULE_DIRAUTH) */ -#endif +#endif /* !defined(TOR_RECOMMEND_PKG_H) */ diff --git a/src/feature/dirauth/shared_random.h b/src/feature/dirauth/shared_random.h index 0b45ad1ed7..1d8fa89b0f 100644 --- a/src/feature/dirauth/shared_random.h +++ b/src/feature/dirauth/shared_random.h @@ -110,7 +110,7 @@ int sr_init(int save_to_disk); void sr_save_and_cleanup(void); void sr_act_post_consensus(const networkstatus_t *consensus); -#else /* HAVE_MODULE_DIRAUTH */ +#else /* !(defined(HAVE_MODULE_DIRAUTH)) */ static inline int sr_init(int save_to_disk) @@ -131,7 +131,7 @@ sr_act_post_consensus(const networkstatus_t *consensus) (void) consensus; } -#endif /* HAVE_MODULE_DIRAUTH */ +#endif /* defined(HAVE_MODULE_DIRAUTH) */ /* Public methods used only by dirauth code. */ diff --git a/src/feature/dirauth/vote_microdesc_hash_st.h b/src/feature/dirauth/vote_microdesc_hash_st.h index 92acdf1157..7869f92b4f 100644 --- a/src/feature/dirauth/vote_microdesc_hash_st.h +++ b/src/feature/dirauth/vote_microdesc_hash_st.h @@ -18,5 +18,5 @@ struct vote_microdesc_hash_t { char *microdesc_hash_line; }; -#endif +#endif /* !defined(VOTE_MICRODESC_HASH_ST_H) */ diff --git a/src/feature/dirauth/voteflags.h b/src/feature/dirauth/voteflags.h index ee809a290d..c4f36e7817 100644 --- a/src/feature/dirauth/voteflags.h +++ b/src/feature/dirauth/voteflags.h @@ -25,7 +25,7 @@ void dirauth_set_routerstatus_from_routerinfo(routerstatus_t *rs, int listbadexits); void dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil); -#endif +#endif /* defined(HAVE_MODULE_DIRAUTH) */ void dirserv_set_bridges_running(time_t now); @@ -34,6 +34,6 @@ void dirserv_set_bridges_running(time_t now); * StaleDesc flag. */ #define DESC_IS_STALE_INTERVAL (18*60*60) STATIC void dirserv_set_routerstatus_testing(routerstatus_t *rs); -#endif +#endif /* defined(VOTEFLAGS_PRIVATE) */ -#endif +#endif /* !defined(TOR_VOTEFLAGS_H) */ diff --git a/src/feature/dircache/cached_dir_st.h b/src/feature/dircache/cached_dir_st.h index 71dca8c3a2..a28802f905 100644 --- a/src/feature/dircache/cached_dir_st.h +++ b/src/feature/dircache/cached_dir_st.h @@ -21,5 +21,5 @@ struct cached_dir_t { int refcnt; /**< Reference count for this cached_dir_t. */ }; -#endif +#endif /* !defined(CACHED_DIR_ST_H) */ diff --git a/src/feature/dircache/consdiffmgr.c b/src/feature/dircache/consdiffmgr.c index 6b16307e3c..397efa0341 100644 --- a/src/feature/dircache/consdiffmgr.c +++ b/src/feature/dircache/consdiffmgr.c @@ -525,7 +525,7 @@ consdiffmgr_add_consensus_nulterm(const char *consensus, tor_free(ctmp); return r; } -#endif +#endif /* defined(TOR_UNIT_TESTS) */ /** * Given a buffer containing a networkstatus consensus, and the results of diff --git a/src/feature/dircache/dircache.h b/src/feature/dircache/dircache.h index 236ea649ef..de0d205f6a 100644 --- a/src/feature/dircache/dircache.h +++ b/src/feature/dircache/dircache.h @@ -38,6 +38,6 @@ STATIC int parse_hs_version_from_post(const char *url, const char *prefix, const char **end_pos); STATIC unsigned parse_accept_encoding_header(const char *h); -#endif +#endif /* defined(DIRCACHE_PRIVATE) */ #endif /* !defined(TOR_DIRCACHE_H) */ diff --git a/src/feature/dirclient/dir_server_st.h b/src/feature/dirclient/dir_server_st.h index 2f5706cdd9..8e35532435 100644 --- a/src/feature/dirclient/dir_server_st.h +++ b/src/feature/dirclient/dir_server_st.h @@ -51,4 +51,4 @@ struct dir_server_t { **/ }; -#endif +#endif /* !defined(DIR_SERVER_ST_H) */ diff --git a/src/feature/dirclient/dirclient.h b/src/feature/dirclient/dirclient.h index 1a93265dc3..be4374c7cf 100644 --- a/src/feature/dirclient/dirclient.h +++ b/src/feature/dirclient/dirclient.h @@ -167,6 +167,6 @@ STATIC int handle_response_fetch_consensus(dir_connection_t *conn, STATIC dirinfo_type_t dir_fetch_type(int dir_purpose, int router_purpose, const char *resource); -#endif +#endif /* defined(DIRCLIENT_PRIVATE) */ #endif /* !defined(TOR_DIRCLIENT_H) */ diff --git a/src/feature/dirclient/dlstatus.h b/src/feature/dirclient/dlstatus.h index 99e0d0225b..681712b059 100644 --- a/src/feature/dirclient/dlstatus.h +++ b/src/feature/dirclient/dlstatus.h @@ -53,6 +53,6 @@ STATIC void next_random_exponential_delay_range(int *low_bound_out, /* no more than triple the previous delay */ #define DIR_TEST_NET_RANDOM_MULTIPLIER (2) -#endif +#endif /* defined(DLSTATUS_PRIVATE) */ #endif /* !defined(TOR_DLSTATUS_H) */ diff --git a/src/feature/dirclient/download_status_st.h b/src/feature/dirclient/download_status_st.h index 11555a1dcc..39a5ad2860 100644 --- a/src/feature/dirclient/download_status_st.h +++ b/src/feature/dirclient/download_status_st.h @@ -61,5 +61,5 @@ struct download_status_t { * only updated if backoff == 1 */ }; -#endif +#endif /* !defined(DOWNLOAD_STATUS_ST_H) */ diff --git a/src/feature/dircommon/dir_connection_st.h b/src/feature/dircommon/dir_connection_st.h index 8c59cc7a46..a858560c29 100644 --- a/src/feature/dircommon/dir_connection_st.h +++ b/src/feature/dircommon/dir_connection_st.h @@ -64,4 +64,4 @@ struct dir_connection_t { #endif /* defined(MEASUREMENTS_21206) */ }; -#endif +#endif /* !defined(DIR_CONNECTION_ST_H) */ diff --git a/src/feature/dircommon/vote_timing_st.h b/src/feature/dircommon/vote_timing_st.h index 47b90ab009..814a325314 100644 --- a/src/feature/dircommon/vote_timing_st.h +++ b/src/feature/dircommon/vote_timing_st.h @@ -20,5 +20,5 @@ struct vote_timing_t { int dist_delay; }; -#endif +#endif /* !defined(VOTE_TIMING_ST_H) */ diff --git a/src/feature/dircommon/voting_schedule.h b/src/feature/dircommon/voting_schedule.h index bafd81184e..d78c7ee2da 100644 --- a/src/feature/dircommon/voting_schedule.h +++ b/src/feature/dircommon/voting_schedule.h @@ -61,5 +61,5 @@ time_t voting_schedule_get_start_of_next_interval(time_t now, int offset); time_t voting_schedule_get_next_valid_after_time(void); -#endif /* TOR_VOTING_SCHEDULE_H */ +#endif /* !defined(TOR_VOTING_SCHEDULE_H) */ diff --git a/src/feature/dirparse/microdesc_parse.h b/src/feature/dirparse/microdesc_parse.h index 23a90084b1..95af85544a 100644 --- a/src/feature/dirparse/microdesc_parse.h +++ b/src/feature/dirparse/microdesc_parse.h @@ -17,4 +17,4 @@ smartlist_t *microdescs_parse_from_string(const char *s, const char *eos, saved_location_t where, smartlist_t *invalid_digests_out); -#endif +#endif /* !defined(TOR_MICRODESC_PARSE_H) */ diff --git a/src/feature/dirparse/ns_parse.h b/src/feature/dirparse/ns_parse.h index dedfa6fc88..0cf2cc88d0 100644 --- a/src/feature/dirparse/ns_parse.h +++ b/src/feature/dirparse/ns_parse.h @@ -42,6 +42,6 @@ STATIC routerstatus_t *routerstatus_parse_entry_from_string( vote_routerstatus_t *vote_rs, int consensus_method, consensus_flavor_t flav); -#endif +#endif /* defined(NS_PARSE_PRIVATE) */ -#endif +#endif /* !defined(TOR_NS_PARSE_H) */ diff --git a/src/feature/dirparse/sigcommon.h b/src/feature/dirparse/sigcommon.h index fdd8e839a9..b6b34e8f62 100644 --- a/src/feature/dirparse/sigcommon.h +++ b/src/feature/dirparse/sigcommon.h @@ -43,6 +43,6 @@ MOCK_DECL(STATIC int, signed_digest_equals, MOCK_DECL(STATIC int, router_compute_hash_final,(char *digest, const char *start, size_t len, digest_algorithm_t alg)); -#endif +#endif /* defined(SIGCOMMON_PRIVATE) */ #endif /* !defined(TOR_SIGCOMMON_H) */ diff --git a/src/feature/dirparse/signing.h b/src/feature/dirparse/signing.h index 2e3699baf8..8b119b4eb2 100644 --- a/src/feature/dirparse/signing.h +++ b/src/feature/dirparse/signing.h @@ -20,4 +20,4 @@ int router_append_dirobj_signature(char *buf, size_t buf_len, const char *digest, size_t digest_len, crypto_pk_t *private_key); -#endif +#endif /* !defined(TOR_SIGNING_H) */ diff --git a/src/feature/dirparse/unparseable.h b/src/feature/dirparse/unparseable.h index 853fe8cb0f..49e047961f 100644 --- a/src/feature/dirparse/unparseable.h +++ b/src/feature/dirparse/unparseable.h @@ -51,6 +51,6 @@ EXTERN(struct smartlist_t *, descs_dumped) MOCK_DECL(STATIC dumped_desc_t *, dump_desc_populate_one_file, (const char *dirname, const char *f)); STATIC void dump_desc_populate_fifo_from_directory(const char *dirname); -#endif +#endif /* defined(UNPARSEABLE_PRIVATE) */ #endif /* !defined(TOR_UNPARSEABLE_H) */ diff --git a/src/feature/hibernate/hibernate.c b/src/feature/hibernate/hibernate.c index 7351e5e002..674fe3c813 100644 --- a/src/feature/hibernate/hibernate.c +++ b/src/feature/hibernate/hibernate.c @@ -57,7 +57,7 @@ hibernating, phase 2: * Coverity. Here's a kludge to unconfuse it. */ # define __INCLUDE_LEVEL__ 2 -# endif /* defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__) */ +#endif /* defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__) */ #include #endif /* defined(HAVE_SYSTEMD) */ @@ -893,7 +893,7 @@ hibernate_begin(hibernate_state_t new_state, time_t now) */ sd_notifyf(0, "EXTEND_TIMEOUT_USEC=%" PRIu64, ((uint64_t)(options->ShutdownWaitLength) + 30) * TOR_USEC_PER_SEC); -#endif +#endif /* defined(HAVE_SYSTEMD) */ } else { /* soft limit reached */ hibernate_end_time = interval_end_time; } diff --git a/src/feature/hs/hs_service.h b/src/feature/hs/hs_service.h index 8d7f773219..22aa00b2d7 100644 --- a/src/feature/hs/hs_service.h +++ b/src/feature/hs/hs_service.h @@ -361,7 +361,7 @@ STATIC hs_service_t *get_first_service(void); STATIC hs_service_intro_point_t *service_intro_point_find_by_ident( const hs_service_t *service, const hs_ident_circuit_t *ident); -#endif +#endif /* defined(TOR_UNIT_TESTS) */ /* Service accessors. */ STATIC hs_service_t *find_service(hs_service_ht *map, diff --git a/src/feature/hs/hs_stats.h b/src/feature/hs/hs_stats.h index ca048e2123..6700eca15b 100644 --- a/src/feature/hs/hs_stats.h +++ b/src/feature/hs/hs_stats.h @@ -15,4 +15,4 @@ uint32_t hs_stats_get_n_introduce2_v2_cells(void); void hs_stats_note_service_rendezvous_launch(void); uint32_t hs_stats_get_n_rendezvous_launches(void); -#endif +#endif /* !defined(TOR_HS_STATS_H) */ diff --git a/src/feature/hs/hsdir_index_st.h b/src/feature/hs/hsdir_index_st.h index 7d4116d8bb..6c86c02f47 100644 --- a/src/feature/hs/hsdir_index_st.h +++ b/src/feature/hs/hsdir_index_st.h @@ -20,5 +20,5 @@ struct hsdir_index_t { uint8_t store_second[DIGEST256_LEN]; }; -#endif +#endif /* !defined(HSDIR_INDEX_ST_H) */ diff --git a/src/feature/hs_common/shared_random_client.h b/src/feature/hs_common/shared_random_client.h index 95fe2c65ab..c90c52cfea 100644 --- a/src/feature/hs_common/shared_random_client.h +++ b/src/feature/hs_common/shared_random_client.h @@ -44,5 +44,5 @@ time_t get_start_time_of_current_round(void); #endif /* TOR_UNIT_TESTS */ -#endif /* TOR_SHARED_RANDOM_CLIENT_H */ +#endif /* !defined(TOR_SHARED_RANDOM_CLIENT_H) */ diff --git a/src/feature/keymgt/loadkey.h b/src/feature/keymgt/loadkey.h index 8beee57a20..0a5af0b804 100644 --- a/src/feature/keymgt/loadkey.h +++ b/src/feature/keymgt/loadkey.h @@ -52,4 +52,4 @@ int read_encrypted_secret_key(ed25519_secret_key_t *out, int write_encrypted_secret_key(const ed25519_secret_key_t *out, const char *fname); -#endif +#endif /* !defined(TOR_LOADKEY_H) */ diff --git a/src/feature/nodelist/authcert.h b/src/feature/nodelist/authcert.h index 2effdb06e6..071293f9ee 100644 --- a/src/feature/nodelist/authcert.h +++ b/src/feature/nodelist/authcert.h @@ -57,4 +57,4 @@ MOCK_DECL(download_status_t *, download_status_for_authority_id_and_sk, void authcert_free_all(void); -#endif +#endif /* !defined(TOR_AUTHCERT_H) */ diff --git a/src/feature/nodelist/authority_cert_st.h b/src/feature/nodelist/authority_cert_st.h index 68a84bc452..bf9b690c24 100644 --- a/src/feature/nodelist/authority_cert_st.h +++ b/src/feature/nodelist/authority_cert_st.h @@ -28,5 +28,5 @@ struct authority_cert_t { uint16_t dir_port; }; -#endif +#endif /* !defined(AUTHORITY_CERT_ST_H) */ diff --git a/src/feature/nodelist/desc_store_st.h b/src/feature/nodelist/desc_store_st.h index b04a1abc7d..4d1378cdfa 100644 --- a/src/feature/nodelist/desc_store_st.h +++ b/src/feature/nodelist/desc_store_st.h @@ -36,4 +36,4 @@ struct desc_store_t { size_t bytes_dropped; }; -#endif +#endif /* !defined(DESC_STORE_ST_H) */ diff --git a/src/feature/nodelist/describe.h b/src/feature/nodelist/describe.h index 018af6470e..d29192200e 100644 --- a/src/feature/nodelist/describe.h +++ b/src/feature/nodelist/describe.h @@ -22,4 +22,4 @@ const char *node_describe(const struct node_t *node); const char *router_describe(const struct routerinfo_t *ri); const char *routerstatus_describe(const struct routerstatus_t *ri); -#endif +#endif /* !defined(TOR_DESCRIBE_H) */ diff --git a/src/feature/nodelist/dirlist.h b/src/feature/nodelist/dirlist.h index 9fabd0a44a..b6dda32d85 100644 --- a/src/feature/nodelist/dirlist.h +++ b/src/feature/nodelist/dirlist.h @@ -44,4 +44,4 @@ void dir_server_add(dir_server_t *ent); void clear_dir_servers(void); void dirlist_free_all(void); -#endif +#endif /* !defined(TOR_DIRLIST_H) */ diff --git a/src/feature/nodelist/document_signature_st.h b/src/feature/nodelist/document_signature_st.h index 66e32c422f..ac2a803252 100644 --- a/src/feature/nodelist/document_signature_st.h +++ b/src/feature/nodelist/document_signature_st.h @@ -25,5 +25,5 @@ struct document_signature_t { * as good. */ }; -#endif +#endif /* !defined(DOCUMENT_SIGNATURE_ST_H) */ diff --git a/src/feature/nodelist/extrainfo_st.h b/src/feature/nodelist/extrainfo_st.h index c54277b05e..22c708f018 100644 --- a/src/feature/nodelist/extrainfo_st.h +++ b/src/feature/nodelist/extrainfo_st.h @@ -26,5 +26,5 @@ struct extrainfo_t { size_t pending_sig_len; }; -#endif +#endif /* !defined(EXTRAINFO_ST_H) */ diff --git a/src/feature/nodelist/microdesc_st.h b/src/feature/nodelist/microdesc_st.h index 367e6a3ef6..c8265cb778 100644 --- a/src/feature/nodelist/microdesc_st.h +++ b/src/feature/nodelist/microdesc_st.h @@ -78,4 +78,4 @@ struct microdesc_t { struct short_policy_t *ipv6_exit_policy; }; -#endif +#endif /* !defined(MICRODESC_ST_H) */ diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c index c7e337309e..2db293a8af 100644 --- a/src/feature/nodelist/networkstatus.c +++ b/src/feature/nodelist/networkstatus.c @@ -1772,7 +1772,7 @@ reload_consensus_from_file(const char *fname, flavor, flags, source_dir); tor_free(content); } -#endif +#endif /* defined(_WIN32) */ if (rv < -1) { log_warn(LD_GENERAL, "Couldn't set consensus from cache file %s", escaped(fname)); diff --git a/src/feature/nodelist/networkstatus_sr_info_st.h b/src/feature/nodelist/networkstatus_sr_info_st.h index 677d8ed811..420c3d61e4 100644 --- a/src/feature/nodelist/networkstatus_sr_info_st.h +++ b/src/feature/nodelist/networkstatus_sr_info_st.h @@ -19,5 +19,5 @@ struct networkstatus_sr_info_t { smartlist_t *commits; }; -#endif +#endif /* !defined(NETWORKSTATUS_SR_INFO_ST_H) */ diff --git a/src/feature/nodelist/networkstatus_st.h b/src/feature/nodelist/networkstatus_st.h index 5c1eea3259..6e84c170d6 100644 --- a/src/feature/nodelist/networkstatus_st.h +++ b/src/feature/nodelist/networkstatus_st.h @@ -104,4 +104,4 @@ struct networkstatus_t { uint8_t bw_file_digest256[DIGEST256_LEN]; }; -#endif +#endif /* !defined(NETWORKSTATUS_ST_H) */ diff --git a/src/feature/nodelist/networkstatus_voter_info_st.h b/src/feature/nodelist/networkstatus_voter_info_st.h index 4037fcdeca..66af82a8e3 100644 --- a/src/feature/nodelist/networkstatus_voter_info_st.h +++ b/src/feature/nodelist/networkstatus_voter_info_st.h @@ -27,4 +27,4 @@ struct networkstatus_voter_info_t { smartlist_t *sigs; }; -#endif +#endif /* !defined(NETWORKSTATUS_VOTER_INFO_ST_H) */ diff --git a/src/feature/nodelist/nickname.h b/src/feature/nodelist/nickname.h index 9bdc6b50e8..78db2a5f91 100644 --- a/src/feature/nodelist/nickname.h +++ b/src/feature/nodelist/nickname.h @@ -16,4 +16,4 @@ int is_legal_nickname(const char *s); int is_legal_nickname_or_hexdigest(const char *s); int is_legal_hexdigest(const char *s); -#endif +#endif /* !defined(TOR_NICKNAME_H) */ diff --git a/src/feature/nodelist/node_select.h b/src/feature/nodelist/node_select.h index ed7450b92c..d8b4aca5c1 100644 --- a/src/feature/nodelist/node_select.h +++ b/src/feature/nodelist/node_select.h @@ -97,6 +97,6 @@ STATIC const routerstatus_t *router_pick_directory_server_impl( int *n_busy_out); STATIC int router_is_already_dir_fetching(const tor_addr_port_t *ap, int serverdesc, int microdesc); -#endif +#endif /* defined(NODE_SELECT_PRIVATE) */ -#endif +#endif /* !defined(TOR_NODE_SELECT_H) */ diff --git a/src/feature/nodelist/node_st.h b/src/feature/nodelist/node_st.h index 53ffde29e4..c63a535a19 100644 --- a/src/feature/nodelist/node_st.h +++ b/src/feature/nodelist/node_st.h @@ -99,4 +99,4 @@ struct node_t { struct hsdir_index_t hsdir_index; }; -#endif +#endif /* !defined(NODE_ST_H) */ diff --git a/src/feature/nodelist/nodefamily.h b/src/feature/nodelist/nodefamily.h index bc5dafce03..31b71e77a0 100644 --- a/src/feature/nodelist/nodefamily.h +++ b/src/feature/nodelist/nodefamily.h @@ -47,4 +47,4 @@ char *nodefamily_canonicalize(const char *s, const uint8_t *rsa_id_self, void nodefamily_free_all(void); -#endif +#endif /* !defined(TOR_NODEFAMILY_H) */ diff --git a/src/feature/nodelist/nodefamily_st.h b/src/feature/nodelist/nodefamily_st.h index be533da824..20390c9308 100644 --- a/src/feature/nodelist/nodefamily_st.h +++ b/src/feature/nodelist/nodefamily_st.h @@ -45,4 +45,4 @@ struct nodefamily_t { #define NODEFAMILY_MEMBER_PTR(nf, i) \ (&((nf)->family_members[(i) * NODEFAMILY_MEMBER_LEN])) -#endif +#endif /* !defined(TOR_NODEFAMILY_ST_H) */ diff --git a/src/feature/nodelist/routerinfo.h b/src/feature/nodelist/routerinfo.h index bfa28c7754..ca66e660b3 100644 --- a/src/feature/nodelist/routerinfo.h +++ b/src/feature/nodelist/routerinfo.h @@ -24,4 +24,4 @@ smartlist_t *router_get_all_orports(const routerinfo_t *ri); const char *router_purpose_to_string(uint8_t p); uint8_t router_purpose_from_string(const char *s); -#endif +#endif /* !defined(TOR_ROUTERINFO_H) */ diff --git a/src/feature/nodelist/routerinfo_st.h b/src/feature/nodelist/routerinfo_st.h index 59656818c1..59fd56d0a0 100644 --- a/src/feature/nodelist/routerinfo_st.h +++ b/src/feature/nodelist/routerinfo_st.h @@ -112,4 +112,4 @@ struct routerinfo_t { uint8_t purpose; }; -#endif +#endif /* !defined(ROUTERINFO_ST_H) */ diff --git a/src/feature/nodelist/routerlist_st.h b/src/feature/nodelist/routerlist_st.h index 7446ead3cb..10b919a1bf 100644 --- a/src/feature/nodelist/routerlist_st.h +++ b/src/feature/nodelist/routerlist_st.h @@ -36,5 +36,5 @@ struct routerlist_t { desc_store_t extrainfo_store; }; -#endif +#endif /* !defined(ROUTERLIST_ST_H) */ diff --git a/src/feature/nodelist/routerstatus_st.h b/src/feature/nodelist/routerstatus_st.h index 8d91b45e11..46337c9e52 100644 --- a/src/feature/nodelist/routerstatus_st.h +++ b/src/feature/nodelist/routerstatus_st.h @@ -78,5 +78,5 @@ struct routerstatus_t { }; -#endif +#endif /* !defined(ROUTERSTATUS_ST_H) */ diff --git a/src/feature/nodelist/signed_descriptor_st.h b/src/feature/nodelist/signed_descriptor_st.h index bdcebf184a..64c28f7440 100644 --- a/src/feature/nodelist/signed_descriptor_st.h +++ b/src/feature/nodelist/signed_descriptor_st.h @@ -57,5 +57,5 @@ struct signed_descriptor_t { unsigned int send_unencrypted : 1; }; -#endif +#endif /* !defined(SIGNED_DESCRIPTOR_ST_H) */ diff --git a/src/feature/nodelist/vote_routerstatus_st.h b/src/feature/nodelist/vote_routerstatus_st.h index 366754c166..0d909da260 100644 --- a/src/feature/nodelist/vote_routerstatus_st.h +++ b/src/feature/nodelist/vote_routerstatus_st.h @@ -38,4 +38,4 @@ struct vote_routerstatus_t { uint8_t ed25519_id[ED25519_PUBKEY_LEN]; }; -#endif +#endif /* !defined(VOTE_ROUTERSTATUS_ST_H) */ diff --git a/src/feature/relay/dns.c b/src/feature/relay/dns.c index f68efc9096..05b97e0ae2 100644 --- a/src/feature/relay/dns.c +++ b/src/feature/relay/dns.c @@ -1394,7 +1394,7 @@ configured_nameserver_address(const size_t idx) return NULL; } -#endif +#endif /* defined(HAVE_EVDNS_BASE_GET_NAMESERVER_ADDR) */ /** Configure eventdns nameservers if force is true, or if the configuration * has changed since the last time we called this function, or if we failed on diff --git a/src/feature/relay/onion_queue.h b/src/feature/relay/onion_queue.h index 0df921e057..cf478bc1a0 100644 --- a/src/feature/relay/onion_queue.h +++ b/src/feature/relay/onion_queue.h @@ -20,4 +20,4 @@ int onion_num_pending(uint16_t handshake_type); void onion_pending_remove(or_circuit_t *circ); void clear_pending_onions(void); -#endif +#endif /* !defined(TOR_ONION_QUEUE_H) */ diff --git a/src/feature/relay/relay_periodic.c b/src/feature/relay/relay_periodic.c index 8908b57415..b48b495895 100644 --- a/src/feature/relay/relay_periodic.c +++ b/src/feature/relay/relay_periodic.c @@ -24,7 +24,7 @@ #include "feature/relay/routerkeys.h" #include "feature/relay/routermode.h" #include "feature/relay/selftest.h" -#include "src/feature/stats/predict_ports.h" +#include "feature/stats/predict_ports.h" #include "lib/crypt_ops/crypto_rand.h" diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c index 82dad3191d..e0daf34db2 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -353,7 +353,7 @@ set_server_identity_key_digest_testing(const uint8_t *digest) { memcpy(server_identitykey_digest, digest, DIGEST_LEN); } -#endif +#endif /* defined(TOR_UNIT_TESTS) */ /** Make sure that we have set up our identity keys to match or not match as * appropriate, and die with an assertion if we have not. */ diff --git a/src/feature/relay/selftest.h b/src/feature/relay/selftest.h index a80ec8936e..aea77ec791 100644 --- a/src/feature/relay/selftest.h +++ b/src/feature/relay/selftest.h @@ -21,4 +21,4 @@ void router_orport_found_reachable(void); void router_dirport_found_reachable(void); void router_perform_bandwidth_test(int num_circs, time_t now); -#endif +#endif /* !defined(TOR_SELFTEST_H) */ diff --git a/src/feature/rend/rend_authorized_client_st.h b/src/feature/rend/rend_authorized_client_st.h index 7bd4f2fe8c..51a1798fcb 100644 --- a/src/feature/rend/rend_authorized_client_st.h +++ b/src/feature/rend/rend_authorized_client_st.h @@ -14,5 +14,5 @@ struct rend_authorized_client_t { crypto_pk_t *client_key; }; -#endif +#endif /* !defined(REND_AUTHORIZED_CLIENT_ST_H) */ diff --git a/src/feature/rend/rend_encoded_v2_service_descriptor_st.h b/src/feature/rend/rend_encoded_v2_service_descriptor_st.h index 05ff145d53..bd8a60f0d9 100644 --- a/src/feature/rend/rend_encoded_v2_service_descriptor_st.h +++ b/src/feature/rend/rend_encoded_v2_service_descriptor_st.h @@ -13,5 +13,5 @@ struct rend_encoded_v2_service_descriptor_t { char *desc_str; /**< Descriptor string. */ }; -#endif +#endif /* !defined(REND_ENCODED_V2_SERVICE_DESCRIPTOR_ST_H) */ diff --git a/src/feature/rend/rend_intro_point_st.h b/src/feature/rend/rend_intro_point_st.h index de6987e569..4882b62752 100644 --- a/src/feature/rend/rend_intro_point_st.h +++ b/src/feature/rend/rend_intro_point_st.h @@ -73,4 +73,4 @@ struct rend_intro_point_t { unsigned int circuit_established:1; }; -#endif +#endif /* !defined(REND_INTRO_POINT_ST_H) */ diff --git a/src/feature/rend/rend_service_descriptor_st.h b/src/feature/rend/rend_service_descriptor_st.h index aeb3178064..ff7627ce96 100644 --- a/src/feature/rend/rend_service_descriptor_st.h +++ b/src/feature/rend/rend_service_descriptor_st.h @@ -30,5 +30,5 @@ struct rend_service_descriptor_t { smartlist_t *successful_uploads; }; -#endif +#endif /* !defined(REND_SERVICE_DESCRIPTOR_ST_H) */ diff --git a/src/feature/rend/rendparse.h b/src/feature/rend/rendparse.h index 0cef931e90..b1ccce9b6c 100644 --- a/src/feature/rend/rendparse.h +++ b/src/feature/rend/rendparse.h @@ -29,4 +29,4 @@ int rend_parse_introduction_points(rend_service_descriptor_t *parsed, size_t intro_points_encoded_size); int rend_parse_client_keys(strmap_t *parsed_clients, const char *str); -#endif +#endif /* !defined(TOR_REND_PARSE_H) */ diff --git a/src/feature/stats/predict_ports.h b/src/feature/stats/predict_ports.h index 272344da2f..45b206c23a 100644 --- a/src/feature/stats/predict_ports.h +++ b/src/feature/stats/predict_ports.h @@ -27,4 +27,4 @@ int rep_hist_circbuilding_dormant(time_t now); int predicted_ports_prediction_time_remaining(time_t now); void predicted_ports_free_all(void); -#endif +#endif /* !defined(TOR_PREDICT_PORTS_H) */ diff --git a/src/feature/stats/rephist.h b/src/feature/stats/rephist.h index 3accc8c610..0d72946382 100644 --- a/src/feature/stats/rephist.h +++ b/src/feature/stats/rephist.h @@ -103,7 +103,7 @@ typedef struct bw_array_t bw_array_t; STATIC uint64_t find_largest_max(bw_array_t *b); STATIC void commit_max(bw_array_t *b); STATIC void advance_obs(bw_array_t *b); -#endif +#endif /* defined(REPHIST_PRIVATE) */ /** * Represents the type of a cell for padding accounting diff --git a/src/lib/arch/bytes.h b/src/lib/arch/bytes.h index fa82241b28..b8b6288139 100644 --- a/src/lib/arch/bytes.h +++ b/src/lib/arch/bytes.h @@ -129,7 +129,7 @@ tor_ntohll(uint64_t a) { return a; } -#else +#else /* !(defined(WORDS_BIGENDIAN)) */ static inline uint16_t tor_htons(uint16_t a) { @@ -177,6 +177,6 @@ tor_ntohll(uint64_t a) { return tor_htonll(a); } -#endif +#endif /* defined(WORDS_BIGENDIAN) */ -#endif +#endif /* !defined(TOR_BYTES_H) */ diff --git a/src/lib/cc/compat_compiler.h b/src/lib/cc/compat_compiler.h index 18b76cc1a1..a8d1593214 100644 --- a/src/lib/cc/compat_compiler.h +++ b/src/lib/cc/compat_compiler.h @@ -229,4 +229,4 @@ #define EAT_SEMICOLON \ struct dummy_semicolon_eater__ -#endif /* !defined(TOR_COMPAT_H) */ +#endif /* !defined(TOR_COMPAT_COMPILER_H) */ diff --git a/src/lib/cc/ctassert.h b/src/lib/cc/ctassert.h index e42976360f..bedf0b83a6 100644 --- a/src/lib/cc/ctassert.h +++ b/src/lib/cc/ctassert.h @@ -22,7 +22,7 @@ /* If C11 is available, just use _Static_assert. */ #define CTASSERT(x) _Static_assert((x), #x) -#else +#else /* !(__STDC_VERSION__ >= 201112L) */ /* * If C11 is not available, expand __COUNTER__, or __INCLUDE_LEVEL__ @@ -42,12 +42,12 @@ #else /* hope it's unique enough */ #define CTASSERT(x) CTASSERT_EXPN((x), l, __LINE__) -#endif +#endif /* defined(__COUNTER__) || ... */ #define CTASSERT_EXPN(x, a, b) CTASSERT_DECL(x, a, b) #define CTASSERT_DECL(x, a, b) \ typedef char tor_ctassert_##a##_##b[(x) ? 1 : -1] ATTR_UNUSED -#endif +#endif /* __STDC_VERSION__ >= 201112L */ #endif /* !defined(TOR_CTASSERT_H) */ diff --git a/src/lib/cc/torint.h b/src/lib/cc/torint.h index 9a66aada18..523f378ed7 100644 --- a/src/lib/cc/torint.h +++ b/src/lib/cc/torint.h @@ -96,9 +96,9 @@ typedef int32_t ssize_t; # else # define TOR_PRIuSZ PRIu32 # endif -#else +#else /* !(defined(_WIN32)) */ # define TOR_PRIuSZ "zu" -#endif +#endif /* defined(_WIN32) */ #ifdef _WIN32 # ifdef _WIN64 @@ -106,9 +106,9 @@ typedef int32_t ssize_t; # else # define TOR_PRIdSZ PRId32 # endif -#else +#else /* !(defined(_WIN32)) */ # define TOR_PRIdSZ "zd" -#endif +#endif /* defined(_WIN32) */ #ifndef SSIZE_MAX #if (SIZEOF_SIZE_T == 4) diff --git a/src/lib/compress/compress_zstd.c b/src/lib/compress/compress_zstd.c index 45d0d4d602..a99ea67e0b 100644 --- a/src/lib/compress/compress_zstd.c +++ b/src/lib/compress/compress_zstd.c @@ -25,7 +25,7 @@ * all invocations of zstd's static-only functions in a check to make sure * that the compile-time version matches the run-time version. */ #define ZSTD_STATIC_LINKING_ONLY -#endif +#endif /* defined(ENABLE_ZSTD_ADVANCED_APIS) */ #ifdef HAVE_ZSTD #ifdef HAVE_CFLAG_WUNUSED_CONST_VARIABLE @@ -35,7 +35,7 @@ DISABLE_GCC_WARNING(unused-const-variable) #ifdef HAVE_CFLAG_WUNUSED_CONST_VARIABLE ENABLE_GCC_WARNING(unused-const-variable) #endif -#endif +#endif /* defined(HAVE_ZSTD) */ /** Total number of bytes allocated for Zstandard state. */ static atomic_counter_t total_zstd_allocation; @@ -77,7 +77,7 @@ tor_zstd_format_version(char *buf, size_t buflen, unsigned version_number) version_number / 100 % 100, version_number % 100); } -#endif +#endif /* defined(HAVE_ZSTD) */ #define VERSION_STR_MAX_LEN 16 /* more than enough space for 99.99.99 */ @@ -125,9 +125,9 @@ tor_zstd_can_use_static_apis(void) } #endif return (ZSTD_VERSION_NUMBER == ZSTD_versionNumber()); -#else +#else /* !(defined(ZSTD_STATIC_LINKING_ONLY) && defined(HAVE_ZSTD)) */ return 0; -#endif +#endif /* defined(ZSTD_STATIC_LINKING_ONLY) && defined(HAVE_ZSTD) */ } /** Internal Zstandard state for incremental compression/decompression. @@ -237,7 +237,7 @@ tor_zstd_state_size_precalc(int compress, int preset) #endif } } -#endif +#endif /* defined(ZSTD_STATIC_LINKING_ONLY) */ return tor_zstd_state_size_precalc_fake(compress, preset); } #endif /* defined(HAVE_ZSTD) */ @@ -527,7 +527,7 @@ tor_zstd_warn_if_version_mismatched(void) "For safety, we'll avoid using advanced zstd functionality.", header_version, runtime_version); } -#endif +#endif /* defined(HAVE_ZSTD) && defined(ENABLE_ZSTD_ADVANCED_APIS) */ } #ifdef TOR_UNIT_TESTS @@ -538,4 +538,4 @@ tor_zstd_set_static_apis_disabled_for_testing(int disabled) { static_apis_disable_for_testing = disabled; } -#endif +#endif /* defined(TOR_UNIT_TESTS) */ diff --git a/src/lib/container/bitarray.h b/src/lib/container/bitarray.h index 910d5fea65..45992796af 100644 --- a/src/lib/container/bitarray.h +++ b/src/lib/container/bitarray.h @@ -83,4 +83,4 @@ bitarray_is_set(bitarray_t *b, int bit) return b[bit >> BITARRAY_SHIFT] & (1u << (bit & BITARRAY_MASK)); } -#endif /* !defined(TOR_CONTAINER_H) */ +#endif /* !defined(TOR_BITARRAY_H) */ diff --git a/src/lib/container/map.h b/src/lib/container/map.h index d61b1ec18f..9da1d3072c 100644 --- a/src/lib/container/map.h +++ b/src/lib/container/map.h @@ -258,4 +258,4 @@ void* strmap_remove_lc(strmap_t *map, const char *key); return digestmap_iter_done((digestmap_iter_t*)iter); \ } -#endif /* !defined(TOR_CONTAINER_H) */ +#endif /* !defined(TOR_MAP_H) */ diff --git a/src/lib/container/namemap.h b/src/lib/container/namemap.h index 97792e13ba..b96bc13f3a 100644 --- a/src/lib/container/namemap.h +++ b/src/lib/container/namemap.h @@ -32,4 +32,4 @@ unsigned namemap_get_or_create_id(namemap_t *map, size_t namemap_get_size(const namemap_t *map); void namemap_clear(namemap_t *map); -#endif +#endif /* !defined(TOR_NAMEMAP_H) */ diff --git a/src/lib/container/namemap_st.h b/src/lib/container/namemap_st.h index 5717352fa2..5008fd5855 100644 --- a/src/lib/container/namemap_st.h +++ b/src/lib/container/namemap_st.h @@ -31,4 +31,4 @@ struct namemap_t { /** Macro to initialize a namemap. */ #define NAMEMAP_INIT() { HT_INITIALIZER(), NULL } -#endif +#endif /* !defined(NAMEMAP_ST_H) */ diff --git a/src/lib/container/order.h b/src/lib/container/order.h index a176d6d8a6..3f2fd054a0 100644 --- a/src/lib/container/order.h +++ b/src/lib/container/order.h @@ -57,4 +57,4 @@ third_quartile_uint32(uint32_t *array, int n_elements) return find_nth_uint32(array, n_elements, (n_elements*3)/4); } -#endif /* !defined(TOR_CONTAINER_H) */ +#endif /* !defined(TOR_ORDER_H) */ diff --git a/src/lib/container/smartlist.h b/src/lib/container/smartlist.h index 77682db03e..81b0151433 100644 --- a/src/lib/container/smartlist.h +++ b/src/lib/container/smartlist.h @@ -165,4 +165,4 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join, } \ STMT_END -#endif /* !defined(TOR_CONTAINER_H) */ +#endif /* !defined(TOR_SMARTLIST_H) */ diff --git a/src/lib/crypt_ops/crypto_cipher.h b/src/lib/crypt_ops/crypto_cipher.h index cc4fbf7a41..88d63c1df2 100644 --- a/src/lib/crypt_ops/crypto_cipher.h +++ b/src/lib/crypt_ops/crypto_cipher.h @@ -54,4 +54,4 @@ int crypto_cipher_decrypt_with_iv(const char *key, char *to, size_t tolen, const char *from, size_t fromlen); -#endif /* !defined(TOR_CRYPTO_H) */ +#endif /* !defined(TOR_CRYPTO_CIPHER_H) */ diff --git a/src/lib/crypt_ops/crypto_dh_openssl.c b/src/lib/crypt_ops/crypto_dh_openssl.c index 8c6388fd5d..75cee1b596 100644 --- a/src/lib/crypt_ops/crypto_dh_openssl.c +++ b/src/lib/crypt_ops/crypto_dh_openssl.c @@ -34,7 +34,7 @@ static int tor_check_dh_key(int severity, const BIGNUM *bn); struct crypto_dh_t { DH *dh; /**< The openssl DH object */ }; -#endif +#endif /* !defined(ENABLE_NSS) */ static DH *new_openssl_dh_from_params(BIGNUM *p, BIGNUM *g); @@ -100,7 +100,7 @@ crypto_validate_dh_params(const BIGNUM *p, const BIGNUM *g) DH_free(dh); return ret; } -#endif +#endif /* 0 */ /** * Helper: convert hex to a bignum, and return it. Assert that the @@ -202,7 +202,7 @@ crypto_dh_new(int dh_type) tor_free(res); // sets res to NULL. return res; } -#endif +#endif /* !defined(ENABLE_NSS) */ /** Create and return a new openssl DH from a given prime and generator. */ static DH * @@ -461,7 +461,7 @@ crypto_dh_free_(crypto_dh_t *dh) DH_free(dh->dh); tor_free(dh); } -#endif +#endif /* !defined(ENABLE_NSS) */ void crypto_dh_free_all_openssl(void) diff --git a/src/lib/crypt_ops/crypto_digest.c b/src/lib/crypt_ops/crypto_digest.c index 9da135e9c4..64a7d2d52c 100644 --- a/src/lib/crypt_ops/crypto_digest.c +++ b/src/lib/crypt_ops/crypto_digest.c @@ -149,9 +149,9 @@ struct crypto_xof_t { * outside the tests yet. */ EVP_MD_CTX *ctx; -#else +#else /* !(defined(OPENSSL_HAS_SHAKE3_EVP)) */ keccak_state s; -#endif +#endif /* defined(OPENSSL_HAS_SHAKE3_EVP) */ }; /** Allocate a new XOF object backed by SHAKE-256. The security level @@ -169,9 +169,9 @@ crypto_xof_new(void) tor_assert(xof->ctx); int r = EVP_DigestInit(xof->ctx, EVP_shake256()); tor_assert(r == 1); -#else +#else /* !(defined(OPENSSL_HAS_SHAKE256)) */ keccak_xof_init(&xof->s, 256); -#endif +#endif /* defined(OPENSSL_HAS_SHAKE256) */ return xof; } @@ -188,7 +188,7 @@ crypto_xof_add_bytes(crypto_xof_t *xof, const uint8_t *data, size_t len) #else int i = keccak_xof_absorb(&xof->s, data, len); tor_assert(i == 0); -#endif +#endif /* defined(OPENSSL_HAS_SHAKE256) */ } /** Squeeze bytes out of a XOF object. Calling this routine will render @@ -203,7 +203,7 @@ crypto_xof_squeeze_bytes(crypto_xof_t *xof, uint8_t *out, size_t len) #else int i = keccak_xof_squeeze(&xof->s, out, len); tor_assert(i == 0); -#endif +#endif /* defined(OPENSSL_HAS_SHAKE256) */ } /** Cleanse and deallocate a XOF object. */ @@ -236,10 +236,10 @@ crypto_xof(uint8_t *output, size_t output_len, r = EVP_DigestFinalXOF(ctx, output, output_len); tor_assert(r == 1); EVP_MD_CTX_free(ctx); -#else +#else /* !(defined(OPENSSL_HAS_SHA3)) */ crypto_xof_t *xof = crypto_xof_new(); crypto_xof_add_bytes(xof, input, input_len); crypto_xof_squeeze_bytes(xof, output, output_len); crypto_xof_free(xof); -#endif +#endif /* defined(OPENSSL_HAS_SHA3) */ } diff --git a/src/lib/crypt_ops/crypto_digest_openssl.c b/src/lib/crypt_ops/crypto_digest_openssl.c index a1c92351fc..c631b0eac0 100644 --- a/src/lib/crypt_ops/crypto_digest_openssl.c +++ b/src/lib/crypt_ops/crypto_digest_openssl.c @@ -70,7 +70,7 @@ crypto_digest256(char *digest, const char *m, size_t len, #else ret = (sha3_256((uint8_t *)digest, DIGEST256_LEN,(const uint8_t *)m, len) > -1); -#endif +#endif /* defined(OPENSSL_HAS_SHA3) */ } if (!ret) @@ -100,7 +100,7 @@ crypto_digest512(char *digest, const char *m, size_t len, #else ret = (sha3_512((uint8_t*)digest, DIGEST512_LEN, (const uint8_t*)m, len) > -1); -#endif +#endif /* defined(OPENSSL_HAS_SHA3) */ } if (!ret) @@ -167,7 +167,7 @@ crypto_digest_alloc_bytes(digest_algorithm_t alg) case DIGEST_SHA3_256: /* Fall through */ case DIGEST_SHA3_512: return END_OF_FIELD(d.sha3); -#endif +#endif /* defined(OPENSSL_HAS_SHA3) */ default: tor_assert(0); // LCOV_EXCL_LINE return 0; // LCOV_EXCL_LINE @@ -212,14 +212,14 @@ crypto_digest_new_internal(digest_algorithm_t algorithm) return NULL; } break; -#else +#else /* !(defined(OPENSSL_HAS_SHA3)) */ case DIGEST_SHA3_256: keccak_digest_init(&r->d.sha3, 256); break; case DIGEST_SHA3_512: keccak_digest_init(&r->d.sha3, 512); break; -#endif +#endif /* defined(OPENSSL_HAS_SHA3) */ default: tor_assert_unreached(); } @@ -271,7 +271,7 @@ crypto_digest_free_(crypto_digest_t *digest) EVP_MD_CTX_free(digest->d.md); } } -#endif +#endif /* defined(OPENSSL_HAS_SHA3) */ size_t bytes = crypto_digest_alloc_bytes(digest->algorithm); memwipe(digest, 0, bytes); tor_free(digest); @@ -310,12 +310,12 @@ crypto_digest_add_bytes(crypto_digest_t *digest, const char *data, tor_assert(r); } break; -#else +#else /* !(defined(OPENSSL_HAS_SHA3)) */ case DIGEST_SHA3_256: /* FALLSTHROUGH */ case DIGEST_SHA3_512: keccak_digest_update(&digest->d.sha3, (const uint8_t *)data, len); break; -#endif +#endif /* defined(OPENSSL_HAS_SHA3) */ default: /* LCOV_EXCL_START */ tor_fragile_assert(); @@ -354,12 +354,12 @@ crypto_digest_get_digest(crypto_digest_t *digest, EVP_MD_CTX_free(tmp); tor_assert(res == 1); goto done; -#else +#else /* !(defined(OPENSSL_HAS_SHA3)) */ /* Tiny-Keccak handles copying into a temporary ctx, and also can handle * short output buffers by truncating appropriately. */ keccak_digest_sum(&digest->d.sha3, (uint8_t *)out, out_len); return; -#endif +#endif /* defined(OPENSSL_HAS_SHA3) */ } const size_t alloc_bytes = crypto_digest_alloc_bytes(digest->algorithm); @@ -412,7 +412,7 @@ crypto_digest_dup(const crypto_digest_t *digest) result->d.md = EVP_MD_CTX_new(); EVP_MD_CTX_copy(result->d.md, digest->d.md); } -#endif +#endif /* defined(OPENSSL_HAS_SHA3) */ return result; } @@ -458,7 +458,7 @@ crypto_digest_assign(crypto_digest_t *into, EVP_MD_CTX_copy(into->d.md, from->d.md); return; } -#endif +#endif /* defined(OPENSSL_HAS_SHA3) */ memcpy(into,from,alloc_bytes); } diff --git a/src/lib/crypt_ops/crypto_hkdf.c b/src/lib/crypt_ops/crypto_hkdf.c index fd2e701651..e0f3d65ad1 100644 --- a/src/lib/crypt_ops/crypto_hkdf.c +++ b/src/lib/crypt_ops/crypto_hkdf.c @@ -25,7 +25,7 @@ #include #define HAVE_OPENSSL_HKDF 1 #endif -#endif +#endif /* defined(ENABLE_OPENSSL) */ #include @@ -109,7 +109,7 @@ crypto_expand_key_material_rfc5869_sha256_openssl( return 0; } -#else +#else /* !(defined(HAVE_OPENSSL_HKDF)) */ /** * Perform RFC5869 HKDF computation using our own legacy implementation. @@ -166,7 +166,7 @@ crypto_expand_key_material_rfc5869_sha256_legacy( memwipe(mac, 0, sizeof(mac)); return 0; } -#endif +#endif /* defined(HAVE_OPENSSL_HKDF) */ /** Expand some secret key material according to RFC5869, using SHA256 as the * underlying hash. The key_in_len bytes at key_in are the @@ -191,11 +191,11 @@ crypto_expand_key_material_rfc5869_sha256( salt_in_len, info_in, info_in_len, key_out, key_out_len); -#else +#else /* !(defined(HAVE_OPENSSL_HKDF)) */ return crypto_expand_key_material_rfc5869_sha256_legacy(key_in, key_in_len, salt_in, salt_in_len, info_in, info_in_len, key_out, key_out_len); -#endif +#endif /* defined(HAVE_OPENSSL_HKDF) */ } diff --git a/src/lib/crypt_ops/crypto_init.c b/src/lib/crypt_ops/crypto_init.c index 5c2780b2ca..a16bf4e11a 100644 --- a/src/lib/crypt_ops/crypto_init.c +++ b/src/lib/crypt_ops/crypto_init.c @@ -99,7 +99,7 @@ crypto_global_init(int useAccel, const char *accelName, const char *accelDir) (void)useAccel; (void)accelName; (void)accelDir; -#endif +#endif /* defined(ENABLE_OPENSSL) */ #ifdef ENABLE_NSS if (crypto_nss_late_init() < 0) return -1; diff --git a/src/lib/crypt_ops/crypto_init.h b/src/lib/crypt_ops/crypto_init.h index 540d08eb56..8de3eb03ed 100644 --- a/src/lib/crypt_ops/crypto_init.h +++ b/src/lib/crypt_ops/crypto_init.h @@ -33,4 +33,4 @@ const char *crypto_get_header_version_string(void); int tor_is_using_nss(void); -#endif /* !defined(TOR_CRYPTO_H) */ +#endif /* !defined(TOR_CRYPTO_INIT_H) */ diff --git a/src/lib/crypt_ops/crypto_nss_mgt.h b/src/lib/crypt_ops/crypto_nss_mgt.h index 72fd2a1229..4cfa9b42a4 100644 --- a/src/lib/crypt_ops/crypto_nss_mgt.h +++ b/src/lib/crypt_ops/crypto_nss_mgt.h @@ -29,6 +29,6 @@ void crypto_nss_global_cleanup(void); void crypto_nss_prefork(void); void crypto_nss_postfork(void); -#endif +#endif /* defined(ENABLE_NSS) */ -#endif /* !defined(TOR_CRYPTO_NSS_H) */ +#endif /* !defined(TOR_CRYPTO_NSS_MGT_H) */ diff --git a/src/lib/crypt_ops/crypto_ope.c b/src/lib/crypt_ops/crypto_ope.c index 2186d2a939..4bd4b35706 100644 --- a/src/lib/crypt_ops/crypto_ope.c +++ b/src/lib/crypt_ops/crypto_ope.c @@ -57,9 +57,9 @@ ope_val_from_le(ope_val_t x) ((x) >> 8) | (((x)&0xff) << 8); } -#else +#else /* !(defined(WORDS_BIGENDIAN)) */ #define ope_val_from_le(x) (x) -#endif +#endif /* defined(WORDS_BIGENDIAN) */ /** * Return a new AES256-CTR stream cipher object for ope, ready to yield diff --git a/src/lib/crypt_ops/crypto_ope.h b/src/lib/crypt_ops/crypto_ope.h index 610d956335..9778dfe0f0 100644 --- a/src/lib/crypt_ops/crypto_ope.h +++ b/src/lib/crypt_ops/crypto_ope.h @@ -41,6 +41,6 @@ struct aes_cnt_cipher; STATIC struct aes_cnt_cipher *ope_get_cipher(const crypto_ope_t *ope, uint32_t initial_idx); STATIC uint64_t sum_values_from_cipher(struct aes_cnt_cipher *c, size_t n); -#endif +#endif /* defined(CRYPTO_OPE_PRIVATE) */ -#endif +#endif /* !defined(CRYPTO_OPE_H) */ diff --git a/src/lib/crypt_ops/crypto_openssl_mgt.c b/src/lib/crypt_ops/crypto_openssl_mgt.c index c97815f9a4..9ec59e7c81 100644 --- a/src/lib/crypt_ops/crypto_openssl_mgt.c +++ b/src/lib/crypt_ops/crypto_openssl_mgt.c @@ -200,10 +200,10 @@ crypto_openssl_early_init(void) OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ADD_ALL_CIPHERS | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL); -#else +#else /* !(defined(OPENSSL_1_1_API)) */ ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); -#endif +#endif /* defined(OPENSSL_1_1_API) */ setup_openssl_threading(); diff --git a/src/lib/crypt_ops/crypto_openssl_mgt.h b/src/lib/crypt_ops/crypto_openssl_mgt.h index a3dd03aa04..111a2d12ed 100644 --- a/src/lib/crypt_ops/crypto_openssl_mgt.h +++ b/src/lib/crypt_ops/crypto_openssl_mgt.h @@ -84,6 +84,6 @@ int crypto_openssl_late_init(int useAccel, const char *accelName, void crypto_openssl_thread_cleanup(void); void crypto_openssl_global_cleanup(void); -#endif /* ENABLE_OPENSSL */ +#endif /* defined(ENABLE_OPENSSL) */ #endif /* !defined(TOR_CRYPTO_OPENSSL_H) */ diff --git a/src/lib/crypt_ops/crypto_rand.c b/src/lib/crypt_ops/crypto_rand.c index 79c8ed1eed..a80a98f267 100644 --- a/src/lib/crypt_ops/crypto_rand.c +++ b/src/lib/crypt_ops/crypto_rand.c @@ -47,7 +47,7 @@ DISABLE_GCC_WARNING(redundant-decls) #include #include ENABLE_GCC_WARNING(redundant-decls) -#endif +#endif /* defined(ENABLE_OPENSSL) */ #ifdef ENABLE_NSS #include @@ -419,7 +419,7 @@ crypto_seed_openssl_rng(void) else return -1; } -#endif +#endif /* defined(ENABLE_OPENSSL) */ #ifdef ENABLE_NSS /** @@ -442,7 +442,7 @@ crypto_seed_nss_rng(void) return load_entropy_ok ? 0 : -1; } -#endif +#endif /* defined(ENABLE_NSS) */ /** * Seed the RNG for any and all crypto libraries that we're using with bytes @@ -520,13 +520,13 @@ crypto_rand_unmocked(char *to, size_t n) #undef BUFLEN } -#else +#else /* !(defined(ENABLE_NSS)) */ int r = RAND_bytes((unsigned char*)to, (int)n); /* We consider a PRNG failure non-survivable. Let's assert so that we get a * stack trace about where it happened. */ tor_assert(r >= 0); -#endif +#endif /* defined(ENABLE_NSS) */ } /** @@ -627,6 +627,6 @@ crypto_force_rand_ssleay(void) RAND_set_rand_method(default_method); return 1; } -#endif +#endif /* defined(ENABLE_OPENSSL) */ return 0; } diff --git a/src/lib/crypt_ops/crypto_rand.h b/src/lib/crypt_ops/crypto_rand.h index 528f238fa5..a019287aa9 100644 --- a/src/lib/crypt_ops/crypto_rand.h +++ b/src/lib/crypt_ops/crypto_rand.h @@ -87,7 +87,7 @@ crypto_fast_rng_t *get_thread_fast_rng(void); void destroy_thread_fast_rng(void); void crypto_rand_fast_init(void); void crypto_rand_fast_shutdown(void); -#endif +#endif /* defined(CRYPTO_PRIVATE) */ #if defined(TOR_UNIT_TESTS) /* Used for white-box testing */ @@ -96,7 +96,7 @@ size_t crypto_fast_rng_get_bytes_used_per_stream(void); void crypto_fast_rng_disable_reseed(crypto_fast_rng_t *rng); /* To override the prng for testing. */ crypto_fast_rng_t *crypto_replace_thread_fast_rng(crypto_fast_rng_t *rng); -#endif +#endif /* defined(TOR_UNIT_TESTS) */ #ifdef CRYPTO_RAND_PRIVATE diff --git a/src/lib/crypt_ops/crypto_rand_fast.c b/src/lib/crypt_ops/crypto_rand_fast.c index b71ade81bd..c7f71a17c9 100644 --- a/src/lib/crypt_ops/crypto_rand_fast.c +++ b/src/lib/crypt_ops/crypto_rand_fast.c @@ -182,7 +182,7 @@ crypto_fast_rng_new_from_seed(const uint8_t *seed) /* We decided above that noinherit would always do _something_. Assert here * that we were correct. */ tor_assert(inherit != INHERIT_RES_KEEP); -#endif +#endif /* defined(CHECK_PID) || ... */ return result; } @@ -196,7 +196,7 @@ crypto_fast_rng_disable_reseed(crypto_fast_rng_t *rng) { rng->n_till_reseed = -1; } -#endif +#endif /* defined(TOR_UNIT_TESTS) */ /** * Helper: create a crypto_cipher_t object from SEED_LEN bytes of @@ -251,7 +251,7 @@ crypto_fast_rng_refill(crypto_fast_rng_t *rng) #else /* If testing is disabled, this shouldn't be able to become negative. */ tor_assert_unreached(); -#endif +#endif /* defined(TOR_UNIT_TESTS) */ } /* Now fill rng->buf with output from our stream cipher, initialized from * that seed value. */ @@ -302,7 +302,7 @@ crypto_fast_rng_getbytes_impl(crypto_fast_rng_t *rng, uint8_t *out, */ tor_assert(rng->owner == getpid()); } -#endif +#endif /* defined(CHECK_PID) */ size_t bytes_to_yield = n; @@ -356,7 +356,7 @@ crypto_fast_rng_get_bytes_used_per_stream(void) { return BUFLEN; } -#endif +#endif /* defined(TOR_UNIT_TESTS) */ /** * Thread-local instance for our fast RNG. @@ -409,7 +409,7 @@ crypto_replace_thread_fast_rng(crypto_fast_rng_t *rng) tor_threadlocal_set(&thread_rng, rng); return old_rng; } -#endif +#endif /* defined(TOR_UNIT_TESTS) */ /** * Initialize the global thread-local key that will be used to keep track diff --git a/src/lib/crypt_ops/crypto_rsa.c b/src/lib/crypt_ops/crypto_rsa.c index c9189b0dfc..c39d2e18d1 100644 --- a/src/lib/crypt_ops/crypto_rsa.c +++ b/src/lib/crypt_ops/crypto_rsa.c @@ -59,7 +59,7 @@ crypto_get_rsa_padding(int padding) default: tor_assert(0); return -1; // LCOV_EXCL_LINE } } -#endif +#endif /* defined(ENABLE_OPENSSL) */ /** Compare the public-key components of a and b. Return non-zero iff * a==b. A NULL key is considered to be distinct from all non-NULL diff --git a/src/lib/crypt_ops/crypto_rsa.h b/src/lib/crypt_ops/crypto_rsa.h index c1ea767f85..e9bfec2f85 100644 --- a/src/lib/crypt_ops/crypto_rsa.h +++ b/src/lib/crypt_ops/crypto_rsa.h @@ -119,7 +119,7 @@ struct rsa_st *crypto_pk_get_openssl_rsa_(crypto_pk_t *env); crypto_pk_t *crypto_new_pk_from_openssl_rsa_(struct rsa_st *rsa); MOCK_DECL(struct evp_pkey_st *, crypto_pk_get_openssl_evp_pkey_,( crypto_pk_t *env,int private)); -#endif +#endif /* defined(ENABLE_OPENSSL) */ #ifdef ENABLE_NSS struct SECKEYPublicKeyStr; @@ -129,7 +129,7 @@ const struct SECKEYPublicKeyStr *crypto_pk_get_nss_pubkey( const crypto_pk_t *key); const struct SECKEYPrivateKeyStr *crypto_pk_get_nss_privkey( const crypto_pk_t *key); -#endif +#endif /* defined(ENABLE_NSS) */ void crypto_pk_assign_public(crypto_pk_t *dest, const crypto_pk_t *src); void crypto_pk_assign_private(crypto_pk_t *dest, const crypto_pk_t *src); @@ -140,6 +140,6 @@ struct SECItemStr; STATIC int secitem_uint_cmp(const struct SECItemStr *a, const struct SECItemStr *b); #endif -#endif +#endif /* defined(TOR_UNIT_TESTS) */ -#endif +#endif /* !defined(TOR_CRYPTO_RSA_H) */ diff --git a/src/lib/crypt_ops/crypto_rsa_nss.c b/src/lib/crypt_ops/crypto_rsa_nss.c index ad2ad38b66..612b7a0e64 100644 --- a/src/lib/crypt_ops/crypto_rsa_nss.c +++ b/src/lib/crypt_ops/crypto_rsa_nss.c @@ -156,7 +156,7 @@ crypto_pk_get_openssl_evp_pkey_,(crypto_pk_t *pk, int private)) tor_free(buf); return result; } -#endif +#endif /* defined(ENABLE_OPENSSL) */ /** Allocate and return storage for a public key. The key itself will not yet * be set. diff --git a/src/lib/crypt_ops/crypto_s2k.c b/src/lib/crypt_ops/crypto_s2k.c index 42276597d4..5cf98e3e64 100644 --- a/src/lib/crypt_ops/crypto_s2k.c +++ b/src/lib/crypt_ops/crypto_s2k.c @@ -285,7 +285,7 @@ secret_to_key_compute_key(uint8_t *key_out, size_t key_out_len, if (rv < 0) return S2K_FAILED; return (int)key_out_len; -#else +#else /* !(defined(ENABLE_OPENSSL)) */ SECItem passItem = { .type = siBuffer, .data = (unsigned char *) secret, .len = (int)secret_len }; @@ -325,7 +325,7 @@ secret_to_key_compute_key(uint8_t *key_out, size_t key_out_len, if (alg) SECOID_DestroyAlgorithmID(alg, PR_TRUE); return rv; -#endif +#endif /* defined(ENABLE_OPENSSL) */ } case S2K_TYPE_SCRYPT: { diff --git a/src/lib/crypt_ops/crypto_util.c b/src/lib/crypt_ops/crypto_util.c index 67a1a9eb92..5e3f4a87a1 100644 --- a/src/lib/crypt_ops/crypto_util.c +++ b/src/lib/crypt_ops/crypto_util.c @@ -30,7 +30,7 @@ DISABLE_GCC_WARNING(redundant-decls) #include #include ENABLE_GCC_WARNING(redundant-decls) -#endif +#endif /* defined(ENABLE_OPENSSL) */ #include "lib/log/log.h" #include "lib/log/util_bug.h" diff --git a/src/lib/crypt_ops/digestset.h b/src/lib/crypt_ops/digestset.h index 91d53a0542..7d6d687342 100644 --- a/src/lib/crypt_ops/digestset.h +++ b/src/lib/crypt_ops/digestset.h @@ -26,4 +26,4 @@ void digestset_add(digestset_t *set, const char *addr); int digestset_probably_contains(const digestset_t *set, const char *addr); -#endif +#endif /* !defined(TOR_DIGESTSET_H) */ diff --git a/src/lib/defs/dh_sizes.h b/src/lib/defs/dh_sizes.h index a2ffbc51c2..b0d1eba0c5 100644 --- a/src/lib/defs/dh_sizes.h +++ b/src/lib/defs/dh_sizes.h @@ -19,4 +19,4 @@ /** Length of our legacy DH keys. */ #define DH1024_KEY_LEN (1024/8) -#endif +#endif /* !defined(TOR_DH_SIZES_H) */ diff --git a/src/lib/defs/digest_sizes.h b/src/lib/defs/digest_sizes.h index 525e5209d6..a0dd97a74d 100644 --- a/src/lib/defs/digest_sizes.h +++ b/src/lib/defs/digest_sizes.h @@ -24,4 +24,4 @@ /** Length of the output of our 64-bit optimized message digests (SHA512). */ #define DIGEST512_LEN 64 -#endif +#endif /* !defined(TOR_DIGEST_SIZES_H) */ diff --git a/src/lib/defs/time.h b/src/lib/defs/time.h index c25f5022c5..459afbf42d 100644 --- a/src/lib/defs/time.h +++ b/src/lib/defs/time.h @@ -20,4 +20,4 @@ /* How many nanoseconds per millisecond */ #define TOR_NSEC_PER_MSEC (1000*1000) -#endif +#endif /* !defined(TOR_TIME_DEFS_H) */ diff --git a/src/lib/defs/x25519_sizes.h b/src/lib/defs/x25519_sizes.h index 8933a8866b..6431f0a2dd 100644 --- a/src/lib/defs/x25519_sizes.h +++ b/src/lib/defs/x25519_sizes.h @@ -33,4 +33,4 @@ #define ED25519_BASE64_LEN 43 #define ED25519_SIG_BASE64_LEN 86 -#endif +#endif /* !defined(TOR_X25519_SIZES_H) */ diff --git a/src/lib/dispatch/dispatch.h b/src/lib/dispatch/dispatch.h index 8e62e8f168..a9e655409a 100644 --- a/src/lib/dispatch/dispatch.h +++ b/src/lib/dispatch/dispatch.h @@ -111,4 +111,4 @@ void dispatch_free_msg_(const dispatch_t *d, msg_t *msg); char *dispatch_fmt_msg_data(const dispatch_t *d, const msg_t *msg); -#endif +#endif /* !defined(TOR_DISPATCH_H) */ diff --git a/src/lib/dispatch/dispatch_cfg.h b/src/lib/dispatch/dispatch_cfg.h index 2c755e39bc..61fade7240 100644 --- a/src/lib/dispatch/dispatch_cfg.h +++ b/src/lib/dispatch/dispatch_cfg.h @@ -36,4 +36,4 @@ int dcfg_add_recv(dispatch_cfg_t *cfg, message_id_t msg, void dcfg_free_(dispatch_cfg_t *cfg); -#endif +#endif /* !defined(TOR_DISPATCH_CFG_H) */ diff --git a/src/lib/dispatch/dispatch_cfg_st.h b/src/lib/dispatch/dispatch_cfg_st.h index d004fe5934..57b6f0347f 100644 --- a/src/lib/dispatch/dispatch_cfg_st.h +++ b/src/lib/dispatch/dispatch_cfg_st.h @@ -22,4 +22,4 @@ struct dispatch_cfg_t { struct smartlist_t *recv_by_msg; }; -#endif +#endif /* !defined(TOR_DISPATCH_CFG_ST_H) */ diff --git a/src/lib/dispatch/dispatch_naming.h b/src/lib/dispatch/dispatch_naming.h index c116d2184d..fd6c83cc12 100644 --- a/src/lib/dispatch/dispatch_naming.h +++ b/src/lib/dispatch/dispatch_naming.h @@ -43,4 +43,4 @@ size_t get_num_msg_type_ids(void); void dispatch_naming_init(void); -#endif +#endif /* !defined(TOR_DISPATCH_NAMING_H) */ diff --git a/src/lib/dispatch/dispatch_st.h b/src/lib/dispatch/dispatch_st.h index 568107b700..ee42518b5a 100644 --- a/src/lib/dispatch/dispatch_st.h +++ b/src/lib/dispatch/dispatch_st.h @@ -103,6 +103,6 @@ struct dispatch_t { dispatch_typefns_t *typefns; }; -#endif +#endif /* defined(DISPATCH_PRIVATE) */ -#endif +#endif /* !defined(TOR_DISPATCH_ST_H) */ diff --git a/src/lib/dispatch/msgtypes.h b/src/lib/dispatch/msgtypes.h index 4e79e592a6..b4c4a10248 100644 --- a/src/lib/dispatch/msgtypes.h +++ b/src/lib/dispatch/msgtypes.h @@ -77,4 +77,4 @@ typedef struct dispatch_typefns_t { char *(*fmt_fn)(msg_aux_data_t); } dispatch_typefns_t; -#endif +#endif /* !defined(TOR_DISPATCH_MSGTYPES_H) */ diff --git a/src/lib/encoding/binascii.h b/src/lib/encoding/binascii.h index 44998bb85b..40c5593b11 100644 --- a/src/lib/encoding/binascii.h +++ b/src/lib/encoding/binascii.h @@ -58,4 +58,4 @@ size_t base32_encoded_size(size_t srclen); void base16_encode(char *dest, size_t destlen, const char *src, size_t srclen); int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen); -#endif /* !defined(TOR_UTIL_FORMAT_H) */ +#endif /* !defined(TOR_BINASCII_H) */ diff --git a/src/lib/encoding/keyval.h b/src/lib/encoding/keyval.h index cd327b7a82..dcddfa3396 100644 --- a/src/lib/encoding/keyval.h +++ b/src/lib/encoding/keyval.h @@ -14,4 +14,4 @@ int string_is_key_value(int severity, const char *string); -#endif +#endif /* !defined(TOR_KEYVAL_H) */ diff --git a/src/lib/encoding/pem.h b/src/lib/encoding/pem.h index 0bbb06a794..6b20350aa8 100644 --- a/src/lib/encoding/pem.h +++ b/src/lib/encoding/pem.h @@ -23,4 +23,4 @@ int pem_encode(char *dest, size_t destlen, const uint8_t *src, size_t srclen, int pem_decode(uint8_t *dest, size_t destlen, const char *src, size_t srclen, const char *objtype); -#endif +#endif /* !defined(TOR_PEM_H) */ diff --git a/src/lib/encoding/qstring.h b/src/lib/encoding/qstring.h index fe15b655f1..840e1044ce 100644 --- a/src/lib/encoding/qstring.h +++ b/src/lib/encoding/qstring.h @@ -15,4 +15,4 @@ const char *decode_qstring(const char *start, size_t in_len_max, char **out, size_t *out_len); -#endif +#endif /* !defined(TOR_ENCODING_QSTRING_H) */ diff --git a/src/lib/encoding/time_fmt.h b/src/lib/encoding/time_fmt.h index 0ddeca57fc..d14bc1f902 100644 --- a/src/lib/encoding/time_fmt.h +++ b/src/lib/encoding/time_fmt.h @@ -41,4 +41,4 @@ int parse_iso_time_nospace(const char *cp, time_t *t); int parse_http_time(const char *buf, struct tm *tm); int format_time_interval(char *out, size_t out_len, long interval); -#endif +#endif /* !defined(TOR_TIME_FMT_H) */ diff --git a/src/lib/err/torerr.h b/src/lib/err/torerr.h index 0badaf7c6d..c2da6697a9 100644 --- a/src/lib/err/torerr.h +++ b/src/lib/err/torerr.h @@ -45,4 +45,4 @@ void tor_log_sigsafe_err_set_granularity(int ms); int format_hex_number_sigsafe(unsigned long x, char *buf, int max_len); int format_dec_number_sigsafe(unsigned long x, char *buf, int max_len); -#endif /* !defined(TOR_TORLOG_H) */ +#endif /* !defined(TOR_TORERR_H) */ diff --git a/src/lib/evloop/token_bucket.h b/src/lib/evloop/token_bucket.h index 9398d2baa3..1ce6f1bf94 100644 --- a/src/lib/evloop/token_bucket.h +++ b/src/lib/evloop/token_bucket.h @@ -112,6 +112,6 @@ token_bucket_rw_get_write(const token_bucket_rw_t *bucket) STATIC uint32_t rate_per_sec_to_rate_per_step(uint32_t rate); -#endif +#endif /* defined(TOKEN_BUCKET_PRIVATE) */ -#endif /* TOR_TOKEN_BUCKET_H */ +#endif /* !defined(TOR_TOKEN_BUCKET_H) */ diff --git a/src/lib/fs/conffile.h b/src/lib/fs/conffile.h index 7af9119dbb..29115e1085 100644 --- a/src/lib/fs/conffile.h +++ b/src/lib/fs/conffile.h @@ -20,4 +20,4 @@ int config_get_lines_include(const char *string, struct config_line_t **result, int extended, int *has_include, struct smartlist_t *opened_lst); -#endif /* !defined(TOR_CONFLINE_H) */ +#endif /* !defined(TOR_CONFFILE_H) */ diff --git a/src/lib/fs/dir.h b/src/lib/fs/dir.h index 826bc2dfc5..9ff81faa42 100644 --- a/src/lib/fs/dir.h +++ b/src/lib/fs/dir.h @@ -30,4 +30,4 @@ MOCK_DECL(int, check_private_dir, (const char *dirname, cpd_check_t check, MOCK_DECL(struct smartlist_t *, tor_listdir, (const char *dirname)); -#endif +#endif /* !defined(TOR_DIR_H) */ diff --git a/src/lib/fs/files.h b/src/lib/fs/files.h index 52c94c914f..81dba8c140 100644 --- a/src/lib/fs/files.h +++ b/src/lib/fs/files.h @@ -27,7 +27,7 @@ #ifdef HAVE_SYS_STAT_H #include #endif -#endif +#endif /* defined(_WIN32) */ #ifndef O_BINARY #define O_BINARY 0 @@ -108,7 +108,7 @@ char *read_file_to_str_until_eof(int fd, size_t max_bytes_to_read, * Tor is built for unit tests, or when Tor is built on an operating system * without its own getdelim(). */ ssize_t compat_getdelim_(char **lineptr, size_t *n, int delim, FILE *stream); -#endif +#endif /* !defined(HAVE_GETDELIM) || defined(TOR_UNIT_TESTS) */ #ifdef HAVE_GETDELIM /** @@ -123,10 +123,10 @@ ssize_t compat_getdelim_(char **lineptr, size_t *n, int delim, FILE *stream); */ #define tor_getdelim(lineptr, n, delim, stream) \ getdelim((lineptr), (n), (delim), (stream)) -#else +#else /* !(defined(HAVE_GETDELIM)) */ #define tor_getdelim(lineptr, n, delim, stream) \ compat_getdelim_((lineptr), (n), (delim), (stream)) -#endif +#endif /* defined(HAVE_GETDELIM) */ #ifdef HAVE_GETLINE /** @@ -137,9 +137,9 @@ ssize_t compat_getdelim_(char **lineptr, size_t *n, int delim, FILE *stream); */ #define tor_getline(lineptr, n, stream) \ getline((lineptr), (n), (stream)) -#else +#else /* !(defined(HAVE_GETLINE)) */ #define tor_getline(lineptr, n, stream) \ tor_getdelim((lineptr), (n), '\n', (stream)) -#endif +#endif /* defined(HAVE_GETLINE) */ -#endif +#endif /* !defined(TOR_FS_H) */ diff --git a/src/lib/fs/lockfile.h b/src/lib/fs/lockfile.h index 8aeee4cc7f..fc0281e253 100644 --- a/src/lib/fs/lockfile.h +++ b/src/lib/fs/lockfile.h @@ -17,4 +17,4 @@ tor_lockfile_t *tor_lockfile_lock(const char *filename, int blocking, int *locked_out); void tor_lockfile_unlock(tor_lockfile_t *lockfile); -#endif +#endif /* !defined(TOR_LOCKFILE_H) */ diff --git a/src/lib/fs/mmap.c b/src/lib/fs/mmap.c index daaee1f9b1..f71c0cff7a 100644 --- a/src/lib/fs/mmap.c +++ b/src/lib/fs/mmap.c @@ -237,4 +237,4 @@ tor_munmap_file(tor_mmap_t *handle) } #else #error "cannot implement tor_mmap_file" -#endif /* defined(HAVE_MMAP) || ... || ... */ +#endif /* defined(HAVE_MMAP) || defined(RUNNING_DOXYGEN) || ... */ diff --git a/src/lib/fs/mmap.h b/src/lib/fs/mmap.h index 18fb18a13c..61aad544b2 100644 --- a/src/lib/fs/mmap.h +++ b/src/lib/fs/mmap.h @@ -38,4 +38,4 @@ typedef struct tor_mmap_t { tor_mmap_t *tor_mmap_file(const char *filename); int tor_munmap_file(tor_mmap_t *handle); -#endif +#endif /* !defined(TOR_MMAP_H) */ diff --git a/src/lib/fs/path.h b/src/lib/fs/path.h index 4675ac84e8..28a1838b88 100644 --- a/src/lib/fs/path.h +++ b/src/lib/fs/path.h @@ -27,4 +27,4 @@ void clean_fname_for_stat(char *name); int get_parent_directory(char *fname); char *make_path_absolute(char *fname); -#endif +#endif /* !defined(TOR_PATH_H) */ diff --git a/src/lib/fs/userdb.h b/src/lib/fs/userdb.h index 5c39794873..5e5ddb89a3 100644 --- a/src/lib/fs/userdb.h +++ b/src/lib/fs/userdb.h @@ -21,6 +21,6 @@ struct passwd; const struct passwd *tor_getpwnam(const char *username); const struct passwd *tor_getpwuid(uid_t uid); char *get_user_homedir(const char *username); -#endif +#endif /* !defined(_WIN32) */ -#endif +#endif /* !defined(TOR_USERDB_H) */ diff --git a/src/lib/fs/winlib.h b/src/lib/fs/winlib.h index 64a22439e5..7237226c76 100644 --- a/src/lib/fs/winlib.h +++ b/src/lib/fs/winlib.h @@ -17,6 +17,6 @@ #include HANDLE load_windows_system_library(const TCHAR *library_name); -#endif +#endif /* defined(_WIN32) */ -#endif +#endif /* !defined(TOR_WINLIB_H) */ diff --git a/src/lib/geoip/country.h b/src/lib/geoip/country.h index 9a8911d494..a24a1c4c0d 100644 --- a/src/lib/geoip/country.h +++ b/src/lib/geoip/country.h @@ -13,4 +13,4 @@ typedef int16_t country_t; #define COUNTRY_MAX INT16_MAX -#endif +#endif /* !defined(TOR_COUNTRY_H) */ diff --git a/src/lib/intmath/addsub.h b/src/lib/intmath/addsub.h index 83efa82919..3f745d457d 100644 --- a/src/lib/intmath/addsub.h +++ b/src/lib/intmath/addsub.h @@ -16,4 +16,4 @@ uint32_t tor_add_u32_nowrap(uint32_t a, uint32_t b); -#endif /* !defined(TOR_INTMATH_MULDIV_H) */ +#endif /* !defined(TOR_INTMATH_ADDSUB_H) */ diff --git a/src/lib/intmath/logic.h b/src/lib/intmath/logic.h index a4cecd69cc..b2f77462e1 100644 --- a/src/lib/intmath/logic.h +++ b/src/lib/intmath/logic.h @@ -17,4 +17,4 @@ /** Macro: true if two values have different boolean values. */ #define bool_neq(a,b) (!(a)!=!(b)) -#endif +#endif /* !defined(HAVE_TOR_LOGIC_H) */ diff --git a/src/lib/intmath/weakrng.h b/src/lib/intmath/weakrng.h index e26bf58cbb..40941e59b2 100644 --- a/src/lib/intmath/weakrng.h +++ b/src/lib/intmath/weakrng.h @@ -28,4 +28,4 @@ int32_t tor_weak_random_range(tor_weak_rng_t *rng, int32_t top); * n */ #define tor_weak_random_one_in_n(rng, n) (0==tor_weak_random_range((rng),(n))) -#endif +#endif /* !defined(TOR_WEAKRNG_H) */ diff --git a/src/lib/lock/compat_mutex.h b/src/lib/lock/compat_mutex.h index b63ce24024..e0c3d7cb78 100644 --- a/src/lib/lock/compat_mutex.h +++ b/src/lib/lock/compat_mutex.h @@ -48,7 +48,7 @@ typedef struct tor_mutex_t { #else /** No-threads only: Dummy variable so that tor_mutex_t takes up space. */ int _unused; -#endif /* defined(USE_WIN32_MUTEX) || ... */ +#endif /* defined(USE_WIN32_THREADS) || ... */ } tor_mutex_t; tor_mutex_t *tor_mutex_new(void); diff --git a/src/lib/log/escape.h b/src/lib/log/escape.h index 2f726186c5..0b9fc3406b 100644 --- a/src/lib/log/escape.h +++ b/src/lib/log/escape.h @@ -20,4 +20,4 @@ char *esc_for_log(const char *string) ATTR_MALLOC; char *esc_for_log_len(const char *chars, size_t n) ATTR_MALLOC; const char *escaped(const char *string); -#endif /* !defined(TOR_TORLOG_H) */ +#endif /* !defined(TOR_ESCAPE_H) */ diff --git a/src/lib/log/log.c b/src/lib/log/log.c index 84e3eafc27..c68f335da6 100644 --- a/src/lib/log/log.c +++ b/src/lib/log/log.c @@ -155,7 +155,7 @@ severity_to_android_log_priority(int severity) // LCOV_EXCL_STOP } } -#endif // HAVE_ANDROID_LOG_H. +#endif /* defined(HAVE_ANDROID_LOG_H) */ /** A mutex to guard changes to logfiles and logging. */ static tor_mutex_t log_mutex; @@ -1233,7 +1233,7 @@ add_android_log(const log_severity_list_t *severity, UNLOCK_LOGS(); return 0; } -#endif // HAVE_ANDROID_LOG_H. +#endif /* defined(HAVE_ANDROID_LOG_H) */ /** If level is a valid log severity, return the corresponding * numeric value. Otherwise, return -1. */ diff --git a/src/lib/log/log.h b/src/lib/log/log.h index 4a3ea0ad55..3db2169584 100644 --- a/src/lib/log/log.h +++ b/src/lib/log/log.h @@ -207,7 +207,7 @@ static inline bool debug_logging_enabled(void) { return PREDICT_UNLIKELY(log_global_min_severity_ == LOG_DEBUG); } -#endif +#endif /* defined(TOR_COVERAGE) */ void log_fn_(int severity, log_domain_mask_t domain, const char *funcname, const char *format, ...) diff --git a/src/lib/log/ratelim.h b/src/lib/log/ratelim.h index 48edd7c849..1db54ba726 100644 --- a/src/lib/log/ratelim.h +++ b/src/lib/log/ratelim.h @@ -50,4 +50,4 @@ typedef struct ratelim_t { char *rate_limit_log(ratelim_t *lim, time_t now); -#endif +#endif /* !defined(TOR_RATELIM_H) */ diff --git a/src/lib/log/util_bug.h b/src/lib/log/util_bug.h index fb223b35f4..546ae1e3ef 100644 --- a/src/lib/log/util_bug.h +++ b/src/lib/log/util_bug.h @@ -80,10 +80,10 @@ tor__assert_tmp_value__; \ } ) #define ASSERT_PREDICT_LIKELY_(e) ASSERT_PREDICT_UNLIKELY_(e) -#else +#else /* !(defined(TOR_UNIT_TESTS) && defined(__GNUC__)) */ #define ASSERT_PREDICT_UNLIKELY_(e) PREDICT_UNLIKELY(e) #define ASSERT_PREDICT_LIKELY_(e) PREDICT_LIKELY(e) -#endif +#endif /* defined(TOR_UNIT_TESTS) && defined(__GNUC__) */ /* Sometimes we don't want to use assertions during branch coverage tests; it * leads to tons of unreached branches which in reality are only assertions we @@ -96,7 +96,7 @@ (void)(a); \ (void)(fmt); \ STMT_END -#else +#else /* !(defined(TOR_UNIT_TESTS) && ... */ /** Like assert(3), but send assertion failures to the log as well as to * stderr. */ #define tor_assert(expr) tor_assertf(expr, NULL) diff --git a/src/lib/log/win32err.h b/src/lib/log/win32err.h index 33413dfd15..ecfa88792d 100644 --- a/src/lib/log/win32err.h +++ b/src/lib/log/win32err.h @@ -19,4 +19,4 @@ char *format_win32_error(DWORD err); #endif -#endif +#endif /* !defined(TOR_WIN32ERR_H) */ diff --git a/src/lib/malloc/malloc.h b/src/lib/malloc/malloc.h index ef6b509ca4..8c81d30dd5 100644 --- a/src/lib/malloc/malloc.h +++ b/src/lib/malloc/malloc.h @@ -48,12 +48,12 @@ void tor_free_(void *mem); raw_free(*tor_free__tmpvar); \ *tor_free__tmpvar=NULL; \ STMT_END -#else +#else /* !(defined(__GNUC__)) */ #define tor_free(p) STMT_BEGIN \ raw_free(p); \ (p)=NULL; \ STMT_END -#endif +#endif /* defined(__GNUC__) */ #define tor_malloc(size) tor_malloc_(size) #define tor_malloc_zero(size) tor_malloc_zero_(size) diff --git a/src/lib/malloc/map_anon.c b/src/lib/malloc/map_anon.c index e2c41ab9c3..219bd706cc 100644 --- a/src/lib/malloc/map_anon.c +++ b/src/lib/malloc/map_anon.c @@ -59,7 +59,7 @@ #define FLAG_NOINHERIT VM_INHERIT_NONE #elif defined(MAP_INHERIT_NONE) #define FLAG_NOINHERIT MAP_INHERIT_NONE -#endif +#endif /* defined(INHERIT_NONE) || ... */ #elif defined(HAVE_MADVISE) @@ -72,7 +72,7 @@ #define FLAG_NOINHERIT MADV_DONTFORK #endif -#endif +#endif /* defined(HAVE_MINHERIT) || ... */ /** * Helper: try to prevent the sz bytes at mem from being swapped @@ -91,7 +91,7 @@ lock_mem(void *mem, size_t sz) (void) sz; return 0; -#endif +#endif /* defined(_WIN32) || ... */ } /** @@ -108,7 +108,7 @@ nodump_mem(void *mem, size_t sz) (void) mem; (void) sz; return 0; -#endif +#endif /* defined(MADV_DONTDUMP) */ } /** @@ -130,19 +130,19 @@ noinherit_mem(void *mem, size_t sz, inherit_res_t *inherit_result_out) *inherit_result_out = INHERIT_RES_ZERO; return 0; } -#endif +#endif /* defined(FLAG_ZERO) */ #ifdef FLAG_NOINHERIT int r2 = MINHERIT(mem, sz, FLAG_NOINHERIT); if (r2 == 0) { *inherit_result_out = INHERIT_RES_DROP; } return r2; -#else +#else /* !(defined(FLAG_NOINHERIT)) */ (void)inherit_result_out; (void)mem; (void)sz; return 0; -#endif +#endif /* defined(FLAG_NOINHERIT) */ } /** @@ -199,7 +199,7 @@ tor_mmap_anonymous(size_t sz, unsigned flags, raw_assert(ptr != NULL); #else ptr = tor_malloc_zero(sz); -#endif +#endif /* defined(_WIN32) || ... */ if (flags & ANONMAP_PRIVATE) { int lock_result = lock_mem(ptr, sz); @@ -234,5 +234,5 @@ tor_munmap_anonymous(void *mapping, size_t sz) #else (void)sz; tor_free(mapping); -#endif +#endif /* defined(_WIN32) || ... */ } diff --git a/src/lib/malloc/map_anon.h b/src/lib/malloc/map_anon.h index 6c02cd6c16..4c4690e12f 100644 --- a/src/lib/malloc/map_anon.h +++ b/src/lib/malloc/map_anon.h @@ -62,7 +62,7 @@ typedef enum { #define NOINHERIT_CAN_FAIL #else #define NOINHERIT_CAN_FAIL -#endif +#endif /* defined(_WIN32) || ... */ void *tor_mmap_anonymous(size_t sz, unsigned flags, inherit_res_t *inherit_result_out); diff --git a/src/lib/math/fp.h b/src/lib/math/fp.h index cb24649e6c..a73789c945 100644 --- a/src/lib/math/fp.h +++ b/src/lib/math/fp.h @@ -21,4 +21,4 @@ int64_t tor_llround(double d) ATTR_CONST; int64_t clamp_double_to_int64(double number); int tor_isinf(double x); -#endif +#endif /* !defined(TOR_FP_H) */ diff --git a/src/lib/math/laplace.h b/src/lib/math/laplace.h index e8651e5197..02b0e890f0 100644 --- a/src/lib/math/laplace.h +++ b/src/lib/math/laplace.h @@ -19,4 +19,4 @@ int64_t sample_laplace_distribution(double mu, double b, double p); int64_t add_laplace_noise(int64_t signal, double random, double delta_f, double epsilon); -#endif +#endif /* !defined(TOR_LAPLACE_H) */ diff --git a/src/lib/math/prob_distr.h b/src/lib/math/prob_distr.h index 8fccf8d015..7254dc8623 100644 --- a/src/lib/math/prob_distr.h +++ b/src/lib/math/prob_distr.h @@ -58,7 +58,7 @@ struct dist { #else #define TYPE_CHECK_OBJ(OPS, OBJ, TYPE) \ (0*sizeof(&(OBJ) - (const TYPE *)&(OBJ))) -#endif +#endif /* defined(__COVERITY__) */ /** * Typed initializer element for struct dist using the specified struct @@ -248,6 +248,6 @@ STATIC double icdf_genpareto(double p, double mu, double sigma, double xi); STATIC double isf_genpareto(double p, double mu, double sigma, double xi); STATIC double sample_genpareto(uint32_t s, double p0, double xi); -#endif +#endif /* defined(PROB_DISTR_PRIVATE) */ -#endif +#endif /* !defined(TOR_PROB_DISTR_H) */ diff --git a/src/lib/meminfo/meminfo.h b/src/lib/meminfo/meminfo.h index 2d64e1ab06..9580640f4d 100644 --- a/src/lib/meminfo/meminfo.h +++ b/src/lib/meminfo/meminfo.h @@ -18,4 +18,4 @@ void tor_log_mallinfo(int severity); MOCK_DECL(int, get_total_system_memory, (size_t *mem_out)); -#endif +#endif /* !defined(TOR_MEMINFO_H) */ diff --git a/src/lib/net/alertsock.h b/src/lib/net/alertsock.h index c45f42be81..4d0d0dd57c 100644 --- a/src/lib/net/alertsock.h +++ b/src/lib/net/alertsock.h @@ -42,4 +42,4 @@ typedef struct alert_sockets_t { int alert_sockets_create(alert_sockets_t *socks_out, uint32_t flags); void alert_sockets_close(alert_sockets_t *socks); -#endif +#endif /* !defined(TOR_ALERTSOCK_H) */ diff --git a/src/lib/net/buffers_net.h b/src/lib/net/buffers_net.h index a3a90172a1..5058dd0a26 100644 --- a/src/lib/net/buffers_net.h +++ b/src/lib/net/buffers_net.h @@ -31,4 +31,4 @@ int buf_read_from_pipe(struct buf_t *buf, int fd, size_t at_most, int buf_flush_to_pipe(struct buf_t *buf, int fd, size_t sz, size_t *buf_flushlen); -#endif /* !defined(TOR_BUFFERS_H) */ +#endif /* !defined(TOR_BUFFERS_NET_H) */ diff --git a/src/lib/net/gethostname.h b/src/lib/net/gethostname.h index 69b0528bc0..b3b77b0589 100644 --- a/src/lib/net/gethostname.h +++ b/src/lib/net/gethostname.h @@ -16,4 +16,4 @@ MOCK_DECL(int,tor_gethostname,(char *name, size_t namelen)); -#endif +#endif /* !defined(TOR_GETHOSTNAME_H) */ diff --git a/src/lib/net/inaddr.h b/src/lib/net/inaddr.h index 36352b65ea..602573944c 100644 --- a/src/lib/net/inaddr.h +++ b/src/lib/net/inaddr.h @@ -24,4 +24,4 @@ int tor_inet_ntoa(const struct in_addr *in, char *buf, size_t buf_len); const char *tor_inet_ntop(int af, const void *src, char *dst, size_t len); int tor_inet_pton(int af, const char *src, void *dst); -#endif +#endif /* !defined(TOR_INADDR_H) */ diff --git a/src/lib/net/inaddr_st.h b/src/lib/net/inaddr_st.h index 806f2c096a..230f29a63a 100644 --- a/src/lib/net/inaddr_st.h +++ b/src/lib/net/inaddr_st.h @@ -104,4 +104,4 @@ struct sockaddr_in6 { }; #endif /* !defined(HAVE_STRUCT_SOCKADDR_IN6) */ -#endif /* TOR_INADDR_ST_H */ +#endif /* !defined(TOR_INADDR_ST_H) */ diff --git a/src/lib/net/nettypes.h b/src/lib/net/nettypes.h index 6209bbe18a..0eb352c657 100644 --- a/src/lib/net/nettypes.h +++ b/src/lib/net/nettypes.h @@ -41,4 +41,4 @@ typedef int socklen_t; #define TOR_INVALID_SOCKET (-1) #endif /* defined(_WIN32) */ -#endif +#endif /* !defined(TOR_NET_TYPES_H) */ diff --git a/src/lib/net/resolve.c b/src/lib/net/resolve.c index 49c263faa2..2dda491d14 100644 --- a/src/lib/net/resolve.c +++ b/src/lib/net/resolve.c @@ -421,7 +421,7 @@ tor_make_getaddrinfo_cache_active(void) { sandbox_getaddrinfo_is_active = 1; } -#else +#else /* !(defined(USE_SANDBOX_GETADDRINFO)) */ void sandbox_disable_getaddrinfo_cache(void) { @@ -430,4 +430,4 @@ void tor_make_getaddrinfo_cache_active(void) { } -#endif +#endif /* defined(USE_SANDBOX_GETADDRINFO) */ diff --git a/src/lib/net/resolve.h b/src/lib/net/resolve.h index 0fb77f1661..d11c902a91 100644 --- a/src/lib/net/resolve.h +++ b/src/lib/net/resolve.h @@ -55,4 +55,4 @@ void tor_free_getaddrinfo_cache(void); void sandbox_disable_getaddrinfo_cache(void); void tor_make_getaddrinfo_cache_active(void); -#endif +#endif /* !defined(TOR_RESOLVE_H) */ diff --git a/src/lib/net/socket.c b/src/lib/net/socket.c index f978deeab8..e824a05045 100644 --- a/src/lib/net/socket.c +++ b/src/lib/net/socket.c @@ -84,9 +84,9 @@ check_network_configuration(bool server_mode) "so your relay makes it harder to figure out how busy it is."); } } -#else +#else /* !(defined(__FreeBSD__)) */ (void) server_mode; -#endif +#endif /* defined(__FreeBSD__) */ } /* When set_max_file_sockets() is called, update this with the max file @@ -487,11 +487,11 @@ tor_socketpair(int family, int type, int protocol, tor_socket_t fd[2]) r = socketpair(family, type, protocol, fd); if (r < 0) return -errno; -#else +#else /* !(defined(HAVE_SOCKETPAIR) && !defined(_WIN32)) */ r = tor_ersatz_socketpair(family, type, protocol, fd); if (r < 0) return -r; -#endif +#endif /* defined(HAVE_SOCKETPAIR) && !defined(_WIN32) */ #if defined(FD_CLOEXEC) if (SOCKET_OK(fd[0])) { diff --git a/src/lib/net/socket.h b/src/lib/net/socket.h index 86ae336dfb..193ad91e4c 100644 --- a/src/lib/net/socket.h +++ b/src/lib/net/socket.h @@ -116,4 +116,4 @@ const char *tor_socket_strerror(int e); #define SIO_IDEAL_SEND_BACKLOG_QUERY 0x4004747b #endif -#endif +#endif /* !defined(TOR_SOCKET_H) */ diff --git a/src/lib/net/socketpair.c b/src/lib/net/socketpair.c index 15c706bec7..3be7b26f7f 100644 --- a/src/lib/net/socketpair.c +++ b/src/lib/net/socketpair.c @@ -22,11 +22,11 @@ #include #define socket_errno() (WSAGetLastError()) #define SOCKET_EPROTONOSUPPORT WSAEPROTONOSUPPORT -#else +#else /* !(defined(_WIN32)) */ #define closesocket(x) close(x) #define socket_errno() (errno) #define SOCKET_EPROTONOSUPPORT EPROTONOSUPPORT -#endif +#endif /* defined(_WIN32) */ #ifdef NEED_ERSATZ_SOCKETPAIR diff --git a/src/lib/net/socketpair.h b/src/lib/net/socketpair.h index 6be0803881..5820606973 100644 --- a/src/lib/net/socketpair.h +++ b/src/lib/net/socketpair.h @@ -16,4 +16,4 @@ int tor_ersatz_socketpair(int family, int type, int protocol, tor_socket_t fd[2]); #endif -#endif +#endif /* !defined(TOR_SOCKETPAIR_H) */ diff --git a/src/lib/net/socks5_status.h b/src/lib/net/socks5_status.h index e55242ce66..e55119e0b0 100644 --- a/src/lib/net/socks5_status.h +++ b/src/lib/net/socks5_status.h @@ -29,4 +29,4 @@ typedef enum { SOCKS5_ADDRESS_TYPE_NOT_SUPPORTED = 0x08, } socks5_reply_status_t; -#endif +#endif /* !defined(TOR_SOCKS5_STATUS_H) */ diff --git a/src/lib/osinfo/uname.h b/src/lib/osinfo/uname.h index fcce629074..443a30d358 100644 --- a/src/lib/osinfo/uname.h +++ b/src/lib/osinfo/uname.h @@ -15,4 +15,4 @@ MOCK_DECL(const char *, get_uname,(void)); -#endif +#endif /* !defined(HAVE_TOR_UNAME_H) */ diff --git a/src/lib/process/daemon.h b/src/lib/process/daemon.h index 20920e0aae..423c498837 100644 --- a/src/lib/process/daemon.h +++ b/src/lib/process/daemon.h @@ -18,4 +18,4 @@ int finish_daemon(const char *desired_cwd); bool start_daemon_has_been_called(void); -#endif +#endif /* !defined(TOR_DAEMON_H) */ diff --git a/src/lib/process/env.h b/src/lib/process/env.h index 15d59351e0..19c2235970 100644 --- a/src/lib/process/env.h +++ b/src/lib/process/env.h @@ -38,4 +38,4 @@ void set_environment_variable_in_smartlist(struct smartlist_t *env_vars, const char *new_var, void (*free_old)(void*), int free_p); -#endif +#endif /* !defined(TOR_ENV_H) */ diff --git a/src/lib/process/pidfile.h b/src/lib/process/pidfile.h index dfeb39e046..af59041f80 100644 --- a/src/lib/process/pidfile.h +++ b/src/lib/process/pidfile.h @@ -13,4 +13,4 @@ int write_pidfile(const char *filename); -#endif +#endif /* !defined(TOR_PIDFILE_H) */ diff --git a/src/lib/process/process.c b/src/lib/process/process.c index 422942dc83..631c7169f1 100644 --- a/src/lib/process/process.c +++ b/src/lib/process/process.c @@ -83,7 +83,7 @@ struct process_t { #else /** Our Win32 process handle. */ process_win32_t *win32_process; -#endif +#endif /* !defined(_WIN32) */ }; /** Convert a given process status in status to its string @@ -205,7 +205,7 @@ process_new(const char *command) #else /* Prepare our Win32 process handle. */ process->win32_process = process_win32_new(); -#endif +#endif /* !defined(_WIN32) */ smartlist_add(processes, process); @@ -240,7 +240,7 @@ process_free_(process_t *process) #else /* Cleanup our Win32 process handle. */ process_win32_free(process->win32_process); -#endif +#endif /* !defined(_WIN32) */ smartlist_remove(processes, process); @@ -513,7 +513,7 @@ process_get_unix_process(const process_t *process) tor_assert(process->unix_process); return process->unix_process; } -#else +#else /* !(!defined(_WIN32)) */ /** Get the internal handle for Windows backend. */ process_win32_t * process_get_win32_process(const process_t *process) @@ -522,7 +522,7 @@ process_get_win32_process(const process_t *process) tor_assert(process->win32_process); return process->win32_process; } -#endif +#endif /* !defined(_WIN32) */ /** Write size bytes of data to the given process's standard * input. */ diff --git a/src/lib/process/process.h b/src/lib/process/process.h index 14069923a0..05c091a5bf 100644 --- a/src/lib/process/process.h +++ b/src/lib/process/process.h @@ -111,7 +111,7 @@ struct process_unix_t *process_get_unix_process(const process_t *process); #else struct process_win32_t; struct process_win32_t *process_get_win32_process(const process_t *process); -#endif +#endif /* !defined(_WIN32) */ void process_write(process_t *process, const uint8_t *data, size_t size); @@ -140,6 +140,6 @@ STATIC void process_read_buffer(process_t *process, STATIC void process_read_lines(process_t *process, buf_t *buffer, process_read_callback_t callback); -#endif /* defined(PROCESS_PRIVATE). */ +#endif /* defined(PROCESS_PRIVATE) */ -#endif /* defined(TOR_PROCESS_H). */ +#endif /* !defined(TOR_PROCESS_H) */ diff --git a/src/lib/process/process_unix.c b/src/lib/process/process_unix.c index 790ab897e9..17ade87463 100644 --- a/src/lib/process/process_unix.c +++ b/src/lib/process/process_unix.c @@ -702,4 +702,4 @@ process_unix_close_file_descriptors(process_unix_t *unix_process) return success; } -#endif /* defined(_WIN32). */ +#endif /* !defined(_WIN32) */ diff --git a/src/lib/process/process_unix.h b/src/lib/process/process_unix.h index a1d8f72993..da40b3e567 100644 --- a/src/lib/process/process_unix.h +++ b/src/lib/process/process_unix.h @@ -61,8 +61,8 @@ STATIC int process_unix_read_handle(process_t *, process_unix_handle_t *, buf_t *); STATIC bool process_unix_close_file_descriptors(process_unix_t *); -#endif /* defined(PROCESS_UNIX_PRIVATE). */ +#endif /* defined(PROCESS_UNIX_PRIVATE) */ -#endif /* defined(_WIN32). */ +#endif /* !defined(_WIN32) */ -#endif /* defined(TOR_PROCESS_UNIX_H). */ +#endif /* !defined(TOR_PROCESS_UNIX_H) */ diff --git a/src/lib/process/process_win32.c b/src/lib/process/process_win32.c index ddbe76bfd9..624333d4a3 100644 --- a/src/lib/process/process_win32.c +++ b/src/lib/process/process_win32.c @@ -741,7 +741,7 @@ process_win32_cleanup_handle(process_win32_handle_t *handle) format_win32_error(error_code)); } } -#endif +#endif /* 0 */ /* Close our handle. */ if (handle->pipe != INVALID_HANDLE_VALUE) { @@ -1084,4 +1084,4 @@ tor_join_win_cmdline(const char *argv[]) return joined_argv; } -#endif /* ! defined(_WIN32). */ +#endif /* defined(_WIN32) */ diff --git a/src/lib/process/process_win32.h b/src/lib/process/process_win32.h index d79dde157e..a50d86df5b 100644 --- a/src/lib/process/process_win32.h +++ b/src/lib/process/process_win32.h @@ -90,8 +90,8 @@ STATIC bool process_win32_handle_read_completion(process_win32_handle_t *, STATIC char *format_win_cmdline_argument(const char *arg); STATIC char *tor_join_win_cmdline(const char *argv[]); -#endif /* defined(PROCESS_WIN32_PRIVATE). */ +#endif /* defined(PROCESS_WIN32_PRIVATE) */ -#endif /* ! defined(_WIN32). */ +#endif /* defined(_WIN32) */ -#endif /* defined(TOR_PROCESS_WIN32_H). */ +#endif /* !defined(TOR_PROCESS_WIN32_H) */ diff --git a/src/lib/process/setuid.h b/src/lib/process/setuid.h index 7d03e1f025..a2125d2d06 100644 --- a/src/lib/process/setuid.h +++ b/src/lib/process/setuid.h @@ -19,4 +19,4 @@ int have_capability_support(void); #define SWITCH_ID_WARN_IF_NO_CAPS (1<<1) int switch_id(const char *user, unsigned flags); -#endif +#endif /* !defined(TOR_SETUID_H) */ diff --git a/src/lib/process/winprocess_sys.c b/src/lib/process/winprocess_sys.c index 1266babca8..48c0888658 100644 --- a/src/lib/process/winprocess_sys.c +++ b/src/lib/process/winprocess_sys.c @@ -51,7 +51,7 @@ subsys_winprocess_initialize(void) return 0; } -#else /* !defined(_WIN32) */ +#else /* !(defined(_WIN32)) */ #define WINPROCESS_SYS_ENABLED false #define subsys_winprocess_initialize NULL #endif /* defined(_WIN32) */ diff --git a/src/lib/pubsub/pub_binding_st.h b/src/lib/pubsub/pub_binding_st.h index 4f5df8ff38..d841bf3f54 100644 --- a/src/lib/pubsub/pub_binding_st.h +++ b/src/lib/pubsub/pub_binding_st.h @@ -35,4 +35,4 @@ typedef struct pub_binding_t { msg_t msg_template; } pub_binding_t; -#endif +#endif /* !defined(TOR_PUB_BINDING_ST_H) */ diff --git a/src/lib/pubsub/pubsub.h b/src/lib/pubsub/pubsub.h index 08e3f42f7c..5346b07517 100644 --- a/src/lib/pubsub/pubsub.h +++ b/src/lib/pubsub/pubsub.h @@ -86,4 +86,4 @@ #include "lib/pubsub/pubsub_macros.h" #include "lib/pubsub/pubsub_publish.h" -#endif +#endif /* !defined(TOR_PUBSUB_PUBSUB_H) */ diff --git a/src/lib/pubsub/pubsub_build.h b/src/lib/pubsub/pubsub_build.h index 93aad50b28..5a0c5f5bd3 100644 --- a/src/lib/pubsub/pubsub_build.h +++ b/src/lib/pubsub/pubsub_build.h @@ -89,4 +89,4 @@ void pubsub_items_clear_bindings(pubsub_items_t *items); FREE_AND_NULL(pubsub_items_t, pubsub_items_free_, (cfg)) void pubsub_items_free_(pubsub_items_t *cfg); -#endif +#endif /* !defined(TOR_PUBSUB_BUILD_H) */ diff --git a/src/lib/pubsub/pubsub_builder_st.h b/src/lib/pubsub/pubsub_builder_st.h index cedeb02b16..545aa3f3ef 100644 --- a/src/lib/pubsub/pubsub_builder_st.h +++ b/src/lib/pubsub/pubsub_builder_st.h @@ -156,6 +156,6 @@ typedef struct pubsub_adjmap_t { struct smartlist_t **sub_by_msg; } pubsub_adjmap_t; -#endif +#endif /* defined(PUBSUB_PRIVATE) */ -#endif +#endif /* !defined(TOR_PUBSUB_BUILDER_ST_H) */ diff --git a/src/lib/pubsub/pubsub_connect.h b/src/lib/pubsub/pubsub_connect.h index bdcb33d2f5..0ad106044e 100644 --- a/src/lib/pubsub/pubsub_connect.h +++ b/src/lib/pubsub/pubsub_connect.h @@ -51,4 +51,4 @@ int pubsub_connector_register_type_(struct pubsub_connector_t *, const char *file, unsigned line); -#endif +#endif /* !defined(TOR_PUBSUB_CONNECT_H) */ diff --git a/src/lib/pubsub/pubsub_flags.h b/src/lib/pubsub/pubsub_flags.h index d07a06be7b..53c6e49565 100644 --- a/src/lib/pubsub/pubsub_flags.h +++ b/src/lib/pubsub/pubsub_flags.h @@ -29,4 +29,4 @@ */ #define DISP_FLAG_STUB (1u<<1) -#endif +#endif /* !defined(TOR_PUBSUB_FLAGS_H) */ diff --git a/src/lib/pubsub/pubsub_macros.h b/src/lib/pubsub/pubsub_macros.h index d091e40dfa..357e59fd54 100644 --- a/src/lib/pubsub/pubsub_macros.h +++ b/src/lib/pubsub/pubsub_macros.h @@ -370,4 +370,4 @@ __FILE__, \ __LINE__) -#endif +#endif /* !defined(TOR_DISPATCH_MSG_H) */ diff --git a/src/lib/pubsub/pubsub_publish.h b/src/lib/pubsub/pubsub_publish.h index 0250fd0760..0686a465de 100644 --- a/src/lib/pubsub/pubsub_publish.h +++ b/src/lib/pubsub/pubsub_publish.h @@ -12,4 +12,4 @@ struct pub_binding_t; int pubsub_pub_(const struct pub_binding_t *pub, msg_aux_data_t auxdata); -#endif +#endif /* !defined(TOR_PUBSUB_PUBLISH_H) */ diff --git a/src/lib/smartlist_core/smartlist_core.h b/src/lib/smartlist_core/smartlist_core.h index a1a195f312..795741c447 100644 --- a/src/lib/smartlist_core/smartlist_core.h +++ b/src/lib/smartlist_core/smartlist_core.h @@ -98,4 +98,4 @@ void smartlist_del(smartlist_t *sl, int idx); void smartlist_del_keeporder(smartlist_t *sl, int idx); void smartlist_insert(smartlist_t *sl, int idx, void *val); -#endif /* !defined(TOR_CONTAINER_H) */ +#endif /* !defined(TOR_SMARTLIST_CORE_H) */ diff --git a/src/lib/smartlist_core/smartlist_split.h b/src/lib/smartlist_core/smartlist_split.h index 4f72376125..e2cc7245b7 100644 --- a/src/lib/smartlist_core/smartlist_split.h +++ b/src/lib/smartlist_core/smartlist_split.h @@ -17,4 +17,4 @@ int smartlist_split_string(smartlist_t *sl, const char *str, const char *sep, int flags, int max); -#endif +#endif /* !defined(TOR_SMARTLIST_SPLIT_H) */ diff --git a/src/lib/string/compat_string.h b/src/lib/string/compat_string.h index a0e37bb6dc..4f30bf5392 100644 --- a/src/lib/string/compat_string.h +++ b/src/lib/string/compat_string.h @@ -25,14 +25,14 @@ static inline int strncasecmp(const char *a, const char *b, size_t n); static inline int strncasecmp(const char *a, const char *b, size_t n) { return _strnicmp(a,b,n); } -#endif +#endif /* !defined(HAVE_STRNCASECMP) */ #ifndef HAVE_STRCASECMP static inline int strcasecmp(const char *a, const char *b); static inline int strcasecmp(const char *a, const char *b) { return _stricmp(a,b); } -#endif -#endif +#endif /* !defined(HAVE_STRCASECMP) */ +#endif /* defined(_WIN32) */ #if defined __APPLE__ /* On OSX 10.9 and later, the overlap-checking code for strlcat would @@ -59,4 +59,4 @@ char *tor_strtok_r_impl(char *str, const char *sep, char **lasts); #define tor_strtok_r(str, sep, lasts) tor_strtok_r_impl(str, sep, lasts) #endif -#endif +#endif /* !defined(TOR_COMPAT_STRING_H) */ diff --git a/src/lib/string/parse_int.h b/src/lib/string/parse_int.h index 925547942e..50d48b44c5 100644 --- a/src/lib/string/parse_int.h +++ b/src/lib/string/parse_int.h @@ -22,4 +22,4 @@ double tor_parse_double(const char *s, double min, double max, int *ok, uint64_t tor_parse_uint64(const char *s, int base, uint64_t min, uint64_t max, int *ok, char **next); -#endif +#endif /* !defined(TOR_PARSE_INT_H) */ diff --git a/src/lib/string/printf.h b/src/lib/string/printf.h index 2cc13d6bee..6e90770f81 100644 --- a/src/lib/string/printf.h +++ b/src/lib/string/printf.h @@ -27,4 +27,4 @@ int tor_asprintf(char **strp, const char *fmt, ...) int tor_vasprintf(char **strp, const char *fmt, va_list args) CHECK_PRINTF(2,0); -#endif /* !defined(TOR_UTIL_STRING_H) */ +#endif /* !defined(TOR_UTIL_PRINTF_H) */ diff --git a/src/lib/string/scanf.h b/src/lib/string/scanf.h index 6673173de5..b642e242db 100644 --- a/src/lib/string/scanf.h +++ b/src/lib/string/scanf.h @@ -21,4 +21,4 @@ int tor_vsscanf(const char *buf, const char *pattern, va_list ap) \ int tor_sscanf(const char *buf, const char *pattern, ...) CHECK_SCANF(2, 3); -#endif /* !defined(TOR_UTIL_STRING_H) */ +#endif /* !defined(TOR_UTIL_SCANF_H) */ diff --git a/src/lib/subsys/subsys.h b/src/lib/subsys/subsys.h index d78bb4a602..21f984f32d 100644 --- a/src/lib/subsys/subsys.h +++ b/src/lib/subsys/subsys.h @@ -92,4 +92,4 @@ typedef struct subsys_fns_t { * less than this value. */ #define SUBSYS_LEVEL_LIBS -10 -#endif +#endif /* !defined(TOR_SUBSYS_T) */ diff --git a/src/lib/term/getpass.h b/src/lib/term/getpass.h index a9c146ea8f..aa597ec423 100644 --- a/src/lib/term/getpass.h +++ b/src/lib/term/getpass.h @@ -15,4 +15,4 @@ ssize_t tor_getpass(const char *prompt, char *output, size_t buflen); -#endif +#endif /* !defined(TOR_GETPASS_H) */ diff --git a/src/lib/testsupport/testsupport.h b/src/lib/testsupport/testsupport.h index 9363a9ba66..631ec0228c 100644 --- a/src/lib/testsupport/testsupport.h +++ b/src/lib/testsupport/testsupport.h @@ -21,7 +21,7 @@ * tests. */ #define STATIC #define EXTERN(type, name) extern type name; -#else +#else /* !(defined(TOR_UNIT_TESTS)) */ #define STATIC static #define EXTERN(type, name) #endif /* defined(TOR_UNIT_TESTS) */ diff --git a/src/lib/thread/numcpus.h b/src/lib/thread/numcpus.h index 3f0a29ce7c..2f1ea16eb9 100644 --- a/src/lib/thread/numcpus.h +++ b/src/lib/thread/numcpus.h @@ -13,4 +13,4 @@ int compute_num_cpus(void); -#endif +#endif /* !defined(TOR_NUMCPUS_H) */ diff --git a/src/lib/time/compat_time.c b/src/lib/time/compat_time.c index 70802770cc..7136eaba67 100644 --- a/src/lib/time/compat_time.c +++ b/src/lib/time/compat_time.c @@ -304,7 +304,7 @@ monotime_coarse_get(monotime_coarse_t *out) #endif /* defined(TOR_UNIT_TESTS) */ out->abstime_ = mach_approximate_time(); } -#endif +#endif /* defined(HAVE_MACH_APPROXIMATE_TIME) */ /** * Return the number of nanoseconds between start and end. @@ -767,7 +767,7 @@ monotime_coarse_zero(monotime_coarse_t *out) { memset(out, 0, sizeof(*out)); } -#endif +#endif /* defined(MONOTIME_COARSE_TYPE_IS_DIFFERENT) */ int64_t monotime_diff_usec(const monotime_t *start, @@ -833,7 +833,7 @@ monotime_coarse_absolute_msec(void) { return monotime_coarse_absolute_nsec() / ONE_MILLION; } -#else +#else /* !(defined(MONOTIME_COARSE_FN_IS_DIFFERENT)) */ #define initialized_at_coarse initialized_at #endif /* defined(MONOTIME_COARSE_FN_IS_DIFFERENT) */ @@ -865,7 +865,7 @@ monotime_msec_to_approx_coarse_stamp_units(uint64_t msec) mach_time_info.numer; return abstime_val >> monotime_shift; } -#else +#else /* !(defined(__APPLE__)) */ uint64_t monotime_coarse_stamp_units_to_approx_msec(uint64_t units) { @@ -876,4 +876,4 @@ monotime_msec_to_approx_coarse_stamp_units(uint64_t msec) { return (msec * STAMP_TICKS_PER_SECOND) / 1000; } -#endif +#endif /* defined(__APPLE__) */ diff --git a/src/lib/time/compat_time.h b/src/lib/time/compat_time.h index 360d92e5c9..8c7661d7cb 100644 --- a/src/lib/time/compat_time.h +++ b/src/lib/time/compat_time.h @@ -344,7 +344,7 @@ monotime_coarse_diff_msec32(const monotime_coarse_t *start, #else #define USING_32BIT_MSEC_HACK return monotime_coarse_diff_msec32_(start, end); -#endif +#endif /* SIZEOF_VOID_P == 8 */ } #ifdef TOR_UNIT_TESTS diff --git a/src/lib/time/tvdiff.h b/src/lib/time/tvdiff.h index 724af1528a..657cb99553 100644 --- a/src/lib/time/tvdiff.h +++ b/src/lib/time/tvdiff.h @@ -20,4 +20,4 @@ int64_t tv_to_msec(const struct timeval *tv); time_t time_diff(const time_t from, const time_t to); -#endif +#endif /* !defined(TOR_TVDIFF_H) */ diff --git a/src/lib/tls/nss_countbytes.h b/src/lib/tls/nss_countbytes.h index 8b31603923..47f220c4c1 100644 --- a/src/lib/tls/nss_countbytes.h +++ b/src/lib/tls/nss_countbytes.h @@ -22,4 +22,4 @@ int tor_get_prfiledesc_byte_counts(struct PRFileDesc *fd, uint64_t *n_read_out, uint64_t *n_written_out); -#endif +#endif /* !defined(TOR_NSS_COUNTBYTES_H) */ diff --git a/src/lib/tls/tortls.h b/src/lib/tls/tortls.h index 8efc7a1c98..9e195c6af2 100644 --- a/src/lib/tls/tortls.h +++ b/src/lib/tls/tortls.h @@ -25,12 +25,12 @@ struct ssl_ctx_st; struct ssl_session_st; typedef struct ssl_ctx_st tor_tls_context_impl_t; typedef struct ssl_st tor_tls_impl_t; -#else +#else /* !(defined(ENABLE_OPENSSL)) */ struct PRFileDesc; typedef struct PRFileDesc tor_tls_context_impl_t; typedef struct PRFileDesc tor_tls_impl_t; -#endif -#endif +#endif /* defined(ENABLE_OPENSSL) */ +#endif /* defined(TORTLS_PRIVATE) */ struct tor_x509_cert_t; @@ -144,9 +144,9 @@ void check_no_tls_errors_(const char *fname, int line); void tor_tls_log_one_error(tor_tls_t *tls, unsigned long err, int severity, int domain, const char *doing); -#else +#else /* !(defined(ENABLE_OPENSSL)) */ #define check_no_tls_errors() STMT_NIL -#endif +#endif /* defined(ENABLE_OPENSSL) */ int tor_tls_get_my_certs(int server, const struct tor_x509_cert_t **link_cert_out, diff --git a/src/lib/tls/tortls_internal.h b/src/lib/tls/tortls_internal.h index 071c506561..866483a94c 100644 --- a/src/lib/tls/tortls_internal.h +++ b/src/lib/tls/tortls_internal.h @@ -61,8 +61,8 @@ STATIC int tor_tls_session_secret_cb(struct ssl_st *ssl, void *secret, void *arg); STATIC int find_cipher_by_id(const SSL *ssl, const SSL_METHOD *m, uint16_t cipher); -#endif -#endif +#endif /* defined(TORTLS_OPENSSL_PRIVATE) */ +#endif /* defined(ENABLE_OPENSSL) */ #ifdef TOR_UNIT_TESTS extern int tor_tls_object_ex_data_index; @@ -73,4 +73,4 @@ extern uint64_t total_bytes_written_over_tls; extern uint64_t total_bytes_written_by_tls; #endif /* defined(TOR_UNIT_TESTS) */ -#endif /* defined(TORTLS_INTERNAL_H) */ +#endif /* !defined(TORTLS_INTERNAL_H) */ diff --git a/src/lib/tls/tortls_openssl.c b/src/lib/tls/tortls_openssl.c index b40f948a3b..04027104e1 100644 --- a/src/lib/tls/tortls_openssl.c +++ b/src/lib/tls/tortls_openssl.c @@ -25,7 +25,7 @@ * and mess things up, in at least some openssl versions. */ #include #include -#endif +#endif /* defined(_WIN32) */ #include "lib/crypt_ops/crypto_cipher.h" #include "lib/crypt_ops/crypto_rand.h" @@ -318,7 +318,7 @@ tor_tls_init(void) #else SSL_library_init(); SSL_load_error_strings(); -#endif +#endif /* defined(OPENSSL_1_1_API) */ #if (SIZEOF_VOID_P >= 8 && \ OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,0,1)) @@ -383,7 +383,7 @@ static const char SERVER_CIPHER_LIST[] = * conclude that it has no valid ciphers if it's running with TLS1.3. */ TLS1_3_TXT_AES_128_GCM_SHA256 ":" -#endif +#endif /* defined(TLS1_3_TXT_AES_128_GCM_SHA256) */ TLS1_TXT_DHE_RSA_WITH_AES_256_SHA ":" TLS1_TXT_DHE_RSA_WITH_AES_128_SHA; @@ -657,7 +657,7 @@ tor_tls_context_new(crypto_pk_t *identity, unsigned int key_lifetime, if (r < 0) goto error; } -#else +#else /* !(defined(SSL_CTX_set1_groups_list) || ...) */ if (! is_client) { int nid; EC_KEY *ec_key; @@ -673,7 +673,7 @@ tor_tls_context_new(crypto_pk_t *identity, unsigned int key_lifetime, SSL_CTX_set_tmp_ecdh(result->ctx, ec_key); EC_KEY_free(ec_key); } -#endif +#endif /* defined(SSL_CTX_set1_groups_list) || ...) SSL_CTX_set_verify(result->ctx, SSL_VERIFY_PEER, always_accept_verify_cb); /* let us realloc bufs that we're writing from */ @@ -1062,7 +1062,7 @@ tor_tls_new(tor_socket_t sock, int isServer) /* We can't actually use TLS 1.3 until this bug is fixed. */ SSL_set_max_proto_version(result->ssl, TLS1_2_VERSION); } -#endif +#endif /* defined(SSL_CTRL_SET_MAX_PROTO_VERSION) */ if (!SSL_set_cipher_list(result->ssl, isServer ? SERVER_CIPHER_LIST : CLIENT_CIPHER_LIST)) { @@ -1728,7 +1728,7 @@ tor_tls_export_key_material,(tor_tls_t *tls, uint8_t *secrets_out, else return -1; } -#endif +#endif /* defined(TLS1_3_VERSION) */ return (r == 1) ? 0 : -1; } diff --git a/src/lib/tls/tortls_st.h b/src/lib/tls/tortls_st.h index 3f7ea8ac6a..73f6e6ecca 100644 --- a/src/lib/tls/tortls_st.h +++ b/src/lib/tls/tortls_st.h @@ -64,7 +64,7 @@ struct tor_tls_t { void (*negotiated_callback)(tor_tls_t *tls, void *arg); /** Argument to pass to negotiated_callback. */ void *callback_arg; -#endif +#endif /* defined(ENABLE_OPENSSL) */ #ifdef ENABLE_NSS /** Last values retried from tor_get_prfiledesc_byte_counts(). */ uint64_t last_write_count; @@ -72,4 +72,4 @@ struct tor_tls_t { #endif }; -#endif +#endif /* !defined(TOR_TORTLS_ST_H) */ diff --git a/src/lib/tls/x509.h b/src/lib/tls/x509.h index 5e6660de5c..0390a5464d 100644 --- a/src/lib/tls/x509.h +++ b/src/lib/tls/x509.h @@ -35,7 +35,7 @@ struct tor_x509_cert_t { common_digests_t cert_digests; common_digests_t pkey_digests; }; -#endif +#endif /* defined(TOR_X509_PRIVATE) */ void tor_tls_pick_certificate_lifetime(time_t now, unsigned cert_lifetime, @@ -47,7 +47,7 @@ tor_x509_cert_t *tor_x509_cert_replace_expiration( const tor_x509_cert_t *inp, time_t new_expiration_time, crypto_pk_t *signing_key); -#endif +#endif /* defined(TOR_UNIT_TESTS) */ tor_x509_cert_t *tor_x509_cert_dup(const tor_x509_cert_t *cert); @@ -72,4 +72,4 @@ int tor_tls_cert_is_valid(int severity, time_t now, int check_rsa_1024); -#endif +#endif /* !defined(TOR_X509_H) */ diff --git a/src/lib/tls/x509_internal.h b/src/lib/tls/x509_internal.h index bf2bec9689..f858baae98 100644 --- a/src/lib/tls/x509_internal.h +++ b/src/lib/tls/x509_internal.h @@ -50,4 +50,4 @@ int tor_x509_cert_set_cached_der_encoding(tor_x509_cert_t *cert); #define tor_x509_cert_set_cached_der_encoding(cert) (0) #endif -#endif +#endif /* !defined(TOR_X509_INTERNAL_H) */ diff --git a/src/lib/tls/x509_nss.c b/src/lib/tls/x509_nss.c index fb4af54c52..e04afaf07b 100644 --- a/src/lib/tls/x509_nss.c +++ b/src/lib/tls/x509_nss.c @@ -120,13 +120,13 @@ tor_tls_create_certificate_internal(crypto_pk_t *rsa, der.data, der.len, (SECKEYPrivateKey *)signing_key,//const &cert->signature); -#else +#else /* !(0) */ s = SEC_DerSignData(cert->arena, &signed_der, der.data, der.len, (SECKEYPrivateKey *)signing_key,//const SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION); -#endif +#endif /* 0 */ if (s != SECSuccess) goto err; @@ -145,7 +145,7 @@ tor_tls_create_certificate_internal(crypto_pk_t *rsa, &result_cert->signatureWrap, issuer_pk, NULL); tor_assert(cert_ok == SECSuccess); } -#endif +#endif /* 1 */ err: if (subject_spki) @@ -455,4 +455,4 @@ tor_x509_cert_replace_expiration(const tor_x509_cert_t *inp, return newcert ? tor_x509_cert_new(newcert) : NULL; } -#endif +#endif /* defined(TOR_UNIT_TESTS) */ diff --git a/src/lib/tls/x509_openssl.c b/src/lib/tls/x509_openssl.c index a344279c22..03f65049cf 100644 --- a/src/lib/tls/x509_openssl.c +++ b/src/lib/tls/x509_openssl.c @@ -59,12 +59,12 @@ ENABLE_GCC_WARNING(redundant-decls) #define X509_get_notAfter(cert) \ X509_getm_notAfter(cert) #endif -#else /* ! OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) */ +#else /* !(defined(OPENSSL_1_1_API)) */ #define X509_get_notBefore_const(cert) \ ((const ASN1_TIME*) X509_get_notBefore((X509 *)cert)) #define X509_get_notAfter_const(cert) \ ((const ASN1_TIME*) X509_get_notAfter((X509 *)cert)) -#endif +#endif /* defined(OPENSSL_1_1_API) */ /** Return a newly allocated X509 name with commonName cname. */ static X509_NAME * diff --git a/src/lib/trace/debug.h b/src/lib/trace/debug.h index e35616cf50..92bb95c883 100644 --- a/src/lib/trace/debug.h +++ b/src/lib/trace/debug.h @@ -27,4 +27,4 @@ "\"" XSTR(subsystem) "\" hit. " \ "(line "XSTR(__LINE__) ")") -#endif /* TOR_TRACE_LOG_DEBUG_H */ +#endif /* !defined(TOR_TRACE_LOG_DEBUG_H) */ diff --git a/src/lib/trace/events.h b/src/lib/trace/events.h index 1e1e7b9d16..0674f7d501 100644 --- a/src/lib/trace/events.h +++ b/src/lib/trace/events.h @@ -34,12 +34,12 @@ #include "lib/trace/debug.h" #endif -#else /* TOR_EVENT_TRACING_ENABLED */ +#else /* !(defined(TOR_EVENT_TRACING_ENABLED)) */ /* Reaching this point, we NOP every event declaration because event tracing * is not been enabled at compile time. */ #define tor_trace(subsystem, name, args...) -#endif /* TOR_EVENT_TRACING_ENABLED */ +#endif /* defined(TOR_EVENT_TRACING_ENABLED) */ -#endif /* TOR_TRACE_EVENTS_H */ +#endif /* !defined(TOR_TRACE_EVENTS_H) */ diff --git a/src/lib/trace/trace.h b/src/lib/trace/trace.h index 606d435568..5001b28a1d 100644 --- a/src/lib/trace/trace.h +++ b/src/lib/trace/trace.h @@ -11,4 +11,4 @@ void tor_trace_init(void); -#endif // TOR_TRACE_TRACE_H +#endif /* !defined(TOR_TRACE_TRACE_H) */ diff --git a/src/lib/wallclock/approx_time.h b/src/lib/wallclock/approx_time.h index e6b53f2c27..e7da160122 100644 --- a/src/lib/wallclock/approx_time.h +++ b/src/lib/wallclock/approx_time.h @@ -22,4 +22,4 @@ time_t approx_time(void); void update_approx_time(time_t now); #endif /* defined(TIME_IS_FAST) */ -#endif +#endif /* !defined(TOR_APPROX_TIME_H) */ diff --git a/src/lib/wallclock/time_to_tm.h b/src/lib/wallclock/time_to_tm.h index abe78c0efe..da27fcaba1 100644 --- a/src/lib/wallclock/time_to_tm.h +++ b/src/lib/wallclock/time_to_tm.h @@ -19,4 +19,4 @@ struct tm *tor_localtime_r_msg(const time_t *timep, struct tm *result, struct tm *tor_gmtime_r_msg(const time_t *timep, struct tm *result, char **err_out); -#endif +#endif /* !defined(TOR_WALLCLOCK_TIME_TO_TM_H) */ diff --git a/src/lib/wallclock/timeval.h b/src/lib/wallclock/timeval.h index 33076adc8b..e632d04a04 100644 --- a/src/lib/wallclock/timeval.h +++ b/src/lib/wallclock/timeval.h @@ -39,7 +39,7 @@ (tvout)->tv_sec += (tvout)->tv_usec / 1000000; \ (tvout)->tv_usec %= 1000000; \ } while (0) -#endif +#endif /* defined(TOR_COVERAGE) */ #ifndef timeradd /** Replacement for timeradd on platforms that do not have it: sets tvout to @@ -83,4 +83,4 @@ ((tv1)->tv_sec op (tv2)->tv_sec)) #endif /* !defined(timercmp) */ -#endif +#endif /* !defined(TOR_TIMEVAL_H) */ diff --git a/src/lib/wallclock/tor_gettimeofday.h b/src/lib/wallclock/tor_gettimeofday.h index c7fff9747a..6fec2fc893 100644 --- a/src/lib/wallclock/tor_gettimeofday.h +++ b/src/lib/wallclock/tor_gettimeofday.h @@ -17,4 +17,4 @@ struct timeval; MOCK_DECL(void, tor_gettimeofday, (struct timeval *timeval)); -#endif +#endif /* !defined(TOR_GETTIMEOFDAY_H) */ diff --git a/src/test/bench.c b/src/test/bench.c index 65fa617cbd..cf732df593 100644 --- a/src/test/bench.c +++ b/src/test/bench.c @@ -22,7 +22,7 @@ #include #include #include -#endif +#endif /* defined(ENABLE_OPENSSL) */ #include "core/or/circuitlist.h" #include "app/config/config.h" @@ -701,7 +701,7 @@ bench_ecdh_p224(void) { bench_ecdh_impl(NID_secp224r1, "P-224"); } -#endif +#endif /* defined(ENABLE_OPENSSL) */ static void bench_md_parse(void) diff --git a/src/test/fuzz/fuzzing.h b/src/test/fuzz/fuzzing.h index 150ac4aa7d..2d278825ec 100644 --- a/src/test/fuzz/fuzzing.h +++ b/src/test/fuzz/fuzzing.h @@ -9,5 +9,5 @@ int fuzz_main(const uint8_t *data, size_t sz); void disable_signature_checking(void); -#endif /* FUZZING_H */ +#endif /* !defined(FUZZING_H) */ diff --git a/src/test/fuzz/fuzzing_common.c b/src/test/fuzz/fuzzing_common.c index 387c865a9b..6d0f9d7d60 100644 --- a/src/test/fuzz/fuzzing_common.c +++ b/src/test/fuzz/fuzzing_common.c @@ -137,7 +137,7 @@ LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) return fuzz_main(Data, Size); } -#else /* Not LLVM_FUZZ, so AFL. */ +#else /* !(defined(LLVM_FUZZ)) */ int main(int argc, char **argv) @@ -194,4 +194,4 @@ main(int argc, char **argv) return 0; } -#endif +#endif /* defined(LLVM_FUZZ) */ diff --git a/src/test/ptr_helpers.c b/src/test/ptr_helpers.c index 296238feeb..a55ab437fa 100644 --- a/src/test/ptr_helpers.c +++ b/src/test/ptr_helpers.c @@ -3,7 +3,7 @@ * Copyright (c) 2007-2019, The Tor Project, Inc. */ /* See LICENSE for licensing information */ -#include "ptr_helpers.h" +#include "test/ptr_helpers.h" /** * Cast (inptr_t value) to a void pointer. diff --git a/src/test/ptr_helpers.h b/src/test/ptr_helpers.h index 67776b1006..7349bddd51 100644 --- a/src/test/ptr_helpers.h +++ b/src/test/ptr_helpers.h @@ -20,4 +20,4 @@ cast_uintptr_to_voidstar(uintptr_t x); uintptr_t cast_voidstar_to_uintptr(void *x); -#endif +#endif /* !defined(TOR_PTR_HELPERS_H) */ diff --git a/src/test/test-memwipe.c b/src/test/test-memwipe.c index 43754ed1c2..3f952e484f 100644 --- a/src/test/test-memwipe.c +++ b/src/test/test-memwipe.c @@ -49,7 +49,7 @@ const char *s = NULL; * us do bad things, such as access freed buffers, without crashing. */ extern const char *malloc_options; const char *malloc_options = "sufjj"; -#endif +#endif /* defined(OpenBSD) */ static unsigned fill_a_buffer_memset(void) diff --git a/src/test/test_circuitpadding.c b/src/test/test_circuitpadding.c index a2d192203e..236f4a192d 100644 --- a/src/test/test_circuitpadding.c +++ b/src/test/test_circuitpadding.c @@ -6,7 +6,7 @@ #define CRYPT_PATH_PRIVATE #include "core/or/or.h" -#include "test.h" +#include "test/test.h" #include "lib/testsupport/testsupport.h" #include "core/or/connection_or.h" #include "core/or/channel.h" @@ -2329,7 +2329,7 @@ test_circuitpadding_circuitsetup_machine(void *arg) return; } -#endif +#endif /* 0 */ /** Helper function: Initializes a padding machine where every state uses the * uniform probability distribution. */ diff --git a/src/test/test_config.c b/src/test/test_config.c index 6cfb7b764b..12b78f806a 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -5066,7 +5066,7 @@ test_config_include_no_permission(void *data) chmod(dir, 0700); tor_free(dir); } -#endif +#endif /* !defined(_WIN32) */ static void test_config_include_recursion_before_after(void *data) @@ -5698,7 +5698,7 @@ test_config_compute_max_mem_in_queues(void *data) #else /* We are on a 32-bit system. */ tt_u64_op(compute_real_max_mem_in_queues(0, 0), OP_EQ, GIGABYTE(1)); -#endif +#endif /* SIZEOF_VOID_P >= 8 */ /* We are able to detect the amount of RAM on the system. */ total_system_memory_return = 0; @@ -5739,7 +5739,7 @@ test_config_compute_max_mem_in_queues(void *data) /* We will at maximum get MAX_DEFAULT_MEMORY_QUEUE_SIZE here. */ tt_u64_op(compute_real_max_mem_in_queues(0, 0), OP_EQ, MAX_DEFAULT_MEMORY_QUEUE_SIZE); -#endif +#endif /* SIZEOF_SIZE_T > 4 */ done: UNMOCK(get_total_system_memory); diff --git a/src/test/test_connection.h b/src/test/test_connection.h index 027e405d89..40121e6d38 100644 --- a/src/test/test_connection.h +++ b/src/test/test_connection.h @@ -14,4 +14,4 @@ void test_conn_lookup_addr_helper(const char *address, int family, tor_addr_t *addr); -#endif +#endif /* !defined(TOR_TEST_CONNECTION_H) */ diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index 872da3d2c5..178a9a5097 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -32,7 +32,7 @@ DISABLE_GCC_WARNING(redundant-decls) #include ENABLE_GCC_WARNING(redundant-decls) -#endif +#endif /* defined(ENABLE_OPENSSL) */ /** Run unit tests for Diffie-Hellman functionality. */ static void @@ -190,7 +190,7 @@ test_crypto_dh(void *arg) DH_get0_key(dh4, &pk, &sk); #else pk = dh4->pub_key; -#endif +#endif /* defined(OPENSSL_1_1_API) */ tt_assert(pk); tt_int_op(BN_num_bytes(pk), OP_LE, DH1024_KEY_LEN); tt_int_op(BN_num_bytes(pk), OP_GT, 0); @@ -207,7 +207,7 @@ test_crypto_dh(void *arg) tt_int_op(s1len, OP_GT, 0); tt_mem_op(s1, OP_EQ, s2, s1len); } -#endif +#endif /* defined(ENABLE_OPENSSL) */ done: crypto_dh_free(dh1); @@ -219,7 +219,7 @@ test_crypto_dh(void *arg) DH_free(dh4); if (pubkey_tmp) BN_free(pubkey_tmp); -#endif +#endif /* defined(ENABLE_OPENSSL) */ } static void @@ -248,7 +248,7 @@ test_crypto_openssl_version(void *arg) tt_int_op(a, OP_GE, 0); tt_int_op(b, OP_GE, 0); tt_int_op(c, OP_GE, 0); -#endif +#endif /* defined(ENABLE_NSS) */ done: ; diff --git a/src/test/test_dir_common.h b/src/test/test_dir_common.h index ab99ed36f4..619dc83eb9 100644 --- a/src/test/test_dir_common.h +++ b/src/test/test_dir_common.h @@ -52,4 +52,4 @@ int dir_common_construct_vote_3(networkstatus_t **vote, networkstatus_t **vote_out, int *n_vrs, time_t now, int clear_rl); -#endif +#endif /* !defined(TOR_TEST_DIR_COMMON_H) */ diff --git a/src/test/test_dns.c b/src/test/test_dns.c index 231e6965f7..51ff8729d0 100644 --- a/src/test/test_dns.c +++ b/src/test/test_dns.c @@ -67,7 +67,7 @@ NS(test_main)(void *arg) tt_assert(tor_addr_family(nameserver_addr) == AF_INET); tt_assert(tor_addr_eq_ipv4h(nameserver_addr, 0x7f000001)); -#endif +#endif /* !defined(_WIN32) */ UNMOCK(get_options); @@ -77,7 +77,7 @@ NS(test_main)(void *arg) } #undef NS_SUBMODULE -#endif +#endif /* defined(HAVE_EVDNS_BASE_GET_NAMESERVER_ADDR) */ #define NS_SUBMODULE clip_ttl diff --git a/src/test/test_dos.c b/src/test/test_dos.c index 4756c5014e..bda9908e6c 100644 --- a/src/test/test_dos.c +++ b/src/test/test_dos.c @@ -411,7 +411,7 @@ test_dos_bucket_refill(void *arg) } tt_uint_op(current_circ_count, OP_EQ, 0); tt_uint_op(dos_stats->cc_stats.circuit_bucket, OP_EQ, current_circ_count); -#endif +#endif /* SIZEOF_TIME_T == 8 */ done: tor_free(chan); diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c index 4e4c86aa0a..5e78e1ce4d 100644 --- a/src/test/test_link_handshake.c +++ b/src/test/test_link_handshake.c @@ -948,7 +948,7 @@ test_link_handshake_send_authchallenge(void *arg) #else tt_int_op(36, OP_EQ, cell1->payload_len); tt_int_op(36, OP_EQ, cell2->payload_len); -#endif +#endif /* defined(HAVE_WORKING_TOR_TLS_GET_TLSSECRETS) */ tt_int_op(0, OP_EQ, cell1->circ_id); tt_int_op(0, OP_EQ, cell2->circ_id); tt_int_op(CELL_AUTH_CHALLENGE, OP_EQ, cell1->command); @@ -960,7 +960,7 @@ test_link_handshake_send_authchallenge(void *arg) #else tt_mem_op("\x00\x01\x00\x03", OP_EQ, cell1->payload + 32, 4); tt_mem_op("\x00\x01\x00\x03", OP_EQ, cell2->payload + 32, 4); -#endif +#endif /* defined(HAVE_WORKING_TOR_TLS_GET_TLSSECRETS) */ tt_mem_op(cell1->payload, OP_NE, cell2->payload, 32); done: diff --git a/src/test/test_periodic_event.c b/src/test/test_periodic_event.c index 961a8be698..267156a908 100644 --- a/src/test/test_periodic_event.c +++ b/src/test/test_periodic_event.c @@ -108,7 +108,7 @@ test_pe_launch(void *arg) periodic_event_item_t *item = &periodic_events[i]; tt_int_op(periodic_event_is_enabled(item), OP_EQ, 0); } -#endif +#endif /* 0 */ initialize_periodic_events(); periodic_events_connect_all(); diff --git a/src/test/test_process.c b/src/test/test_process.c index 7cc01d2442..7836312761 100644 --- a/src/test/test_process.c +++ b/src/test/test_process.c @@ -594,7 +594,7 @@ test_unix(void *arg) done: process_free(process); -#endif +#endif /* !defined(_WIN32) */ } static void @@ -649,7 +649,7 @@ test_win32(void *arg) done: tor_free(joined_argv); process_free(process); -#endif +#endif /* defined(_WIN32) */ } struct testcase_t process_tests[] = { diff --git a/src/test/test_process_slow.c b/src/test/test_process_slow.c index 1322d7b833..91252c725d 100644 --- a/src/test/test_process_slow.c +++ b/src/test/test_process_slow.c @@ -135,7 +135,7 @@ get_win32_test_binary_path(void) done: return NULL; } -#endif +#endif /* defined(_WIN32) */ static void main_loop_timeout_cb(periodic_timer_t *timer, void *data) diff --git a/src/test/test_protover.c b/src/test/test_protover.c index 63c508bd13..1759aef97d 100644 --- a/src/test/test_protover.c +++ b/src/test/test_protover.c @@ -22,7 +22,7 @@ test_protover_parse(void *arg) tt_skip(); done: ; -#else +#else /* !(defined(HAVE_RUST)) */ char *re_encoded = NULL; const char *orig = "Foo=1,3 Bar=3 Baz= Quux=9-12,14,15-16,900"; @@ -89,7 +89,7 @@ test_protover_parse(void *arg) SMARTLIST_FOREACH(elts, proto_entry_t *, ent, proto_entry_free(ent)); smartlist_free(elts); tor_free(re_encoded); -#endif +#endif /* defined(HAVE_RUST) */ } static void @@ -133,7 +133,7 @@ test_protover_parse_fail(void *arg) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); tt_ptr_op(elts, OP_EQ, NULL); -#endif +#endif /* defined(HAVE_RUST) */ done: ; } @@ -335,7 +335,7 @@ test_protover_all_supported(void *arg) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaa=1-65536", &msg)); tor_end_capture_bugs_(); -#endif +#endif /* !defined(HAVE_RUST) */ done: tor_end_capture_bugs_(); @@ -459,7 +459,7 @@ test_protover_supported_protocols(void *arg) tt_assert(protocol_list_supports_protocol(supported_protocols, PRT_LINKAUTH, PROTOVER_LINKAUTH_V1)); -#endif +#endif /* defined(HAVE_WORKING_TOR_TLS_GET_TLSSECRETS) */ /* Latest LinkAuth is not exposed in the headers. */ tt_assert(protocol_list_supports_protocol(supported_protocols, PRT_LINKAUTH, diff --git a/src/test/test_rng.c b/src/test/test_rng.c index c749de112a..dcf08fff1d 100644 --- a/src/test/test_rng.c +++ b/src/test/test_rng.c @@ -46,7 +46,7 @@ main(int argc, char **argv) return 1; } } -#endif +#endif /* 0 */ crypto_fast_rng_t *rng = crypto_fast_rng_new(); while (1) { diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c index 9fb88b9bee..9c8703fa6f 100644 --- a/src/test/test_shared_random.c +++ b/src/test/test_shared_random.c @@ -1367,7 +1367,7 @@ test_utils_auth(void *arg) sr_state_set_current_srv(sr_state_get_current_srv()); sr_state_set_previous_srv(sr_state_get_previous_srv()); } -#endif +#endif /* 0 */ done: sr_state_free_all(); diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c index 11e35be2fa..5f87434f6a 100644 --- a/src/test/test_tortls.c +++ b/src/test/test_tortls.c @@ -219,7 +219,7 @@ test_tortls_tor_tls_get_error(void *data) crypto_pk_free(key2); tor_tls_free(tls); } -#endif +#endif /* defined(ENABLE_OPENSSL) */ static void test_tortls_x509_cert_get_id_digests(void *ignored) @@ -336,7 +336,7 @@ test_tortls_server_got_renegotiate(void *ignored) done: tor_free(tls); } -#endif +#endif /* defined(ENABLE_OPENSSL) */ static void test_tortls_evaluate_ecgroup_for_tls(void *ignored) @@ -526,7 +526,7 @@ struct testcase_t tortls_tests[] = { LOCAL_TEST_CASE(get_forced_write_size, 0), LOCAL_TEST_CASE(used_v1_handshake, TT_FORK), LOCAL_TEST_CASE(server_got_renegotiate, 0), -#endif +#endif /* defined(ENABLE_OPENSSL) */ LOCAL_TEST_CASE(evaluate_ecgroup_for_tls, 0), LOCAL_TEST_CASE(double_init, TT_FORK), LOCAL_TEST_CASE(address, TT_FORK), diff --git a/src/test/test_tortls.h b/src/test/test_tortls.h index 1a8b117d0f..4567b9f6a0 100644 --- a/src/test/test_tortls.h +++ b/src/test/test_tortls.h @@ -10,4 +10,4 @@ extern const char *notCompletelyValidCertString; extern const char *validCertString; extern const char *caCertString; -#endif +#endif /* !defined(TEST_TORTLS_H) */ diff --git a/src/test/test_tortls_openssl.c b/src/test/test_tortls_openssl.c index 73041a871c..81e2d3aa4f 100644 --- a/src/test/test_tortls_openssl.c +++ b/src/test/test_tortls_openssl.c @@ -133,7 +133,7 @@ library_init(void) #else SSL_library_init(); SSL_load_error_strings(); -#endif +#endif /* defined(OPENSSL_1_1_API) */ } static void @@ -477,7 +477,7 @@ fake_x509_free(X509 *cert) tor_free(cert); } } -#endif +#endif /* !defined(OPENSSL_OPAQUE) */ static tor_x509_cert_t *fixed_x509_cert = NULL; static tor_x509_cert_t * diff --git a/src/test/test_util.c b/src/test/test_util.c index 79df2825be..2faadd4e19 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -6116,9 +6116,9 @@ test_util_log_mallinfo(void *arg) } else { tt_u64_op(mem1, OP_LT, mem2); } -#else +#else /* !(defined(HAVE_MALLINFO)) */ tt_skip(); -#endif +#endif /* defined(HAVE_MALLINFO) */ done: teardown_capture_of_logs(); tor_free(log1); @@ -6175,7 +6175,7 @@ test_util_map_anon_nofork(void *arg) tt_skip(); done: ; -#else +#else /* !(defined(_WIN32)) */ /* We have the right OS support. We're going to try marking the buffer as * either zero-on-fork or as drop-on-fork, whichever is supported. Then we * will fork and send a byte back to the parent process. This will either @@ -6236,7 +6236,7 @@ test_util_map_anon_nofork(void *arg) * implemented. */ tt_skip(); } -#endif +#endif /* !defined(NOINHERIT_CAN_FAIL) */ done: tor_munmap_anonymous(ptr, sz); @@ -6246,7 +6246,7 @@ test_util_map_anon_nofork(void *arg) if (pipefd[1] >= 0) { close(pipefd[1]); } -#endif +#endif /* defined(_WIN32) */ } #define UTIL_LEGACY(name) \ diff --git a/src/tools/tor-gencert.c b/src/tools/tor-gencert.c index 25113420df..ea96f41dbf 100644 --- a/src/tools/tor-gencert.c +++ b/src/tools/tor-gencert.c @@ -31,7 +31,7 @@ DISABLE_GCC_WARNING(redundant-decls) #include ENABLE_GCC_WARNING(redundant-decls) -#endif +#endif /* defined(ENABLE_OPENSSL) */ #include