[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] relay: Silence compiler warnings when relay mode is disabled



commit e2280d6f849ea6e00fccc704e91d48a2f6924135
Author: teor <teor@xxxxxxxxxxxxxx>
Date:   Fri Oct 18 14:16:24 2019 +1000

    relay: Silence compiler warnings when relay mode is disabled
    
    Part of 32123.
---
 src/feature/relay/router.c | 4 ++++
 src/feature/relay/router.h | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index ab0762e17..92803f88a 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -372,6 +372,8 @@ assert_identity_keys_ok(void)
   }
 }
 
+#ifdef HAVE_MODULE_RELAY
+
 /** Returns the current server identity key; requires that the key has
  * been set, and that we are running as a Tor server.
  */
@@ -384,6 +386,8 @@ get_server_identity_key,(void))
   return server_identitykey;
 }
 
+#endif
+
 /** Return true iff we are a server and the server identity key
  * has been set. */
 int
diff --git a/src/feature/relay/router.h b/src/feature/relay/router.h
index 55b9ef9e6..a708b2488 100644
--- a/src/feature/relay/router.h
+++ b/src/feature/relay/router.h
@@ -28,7 +28,13 @@ struct ed25519_keypair_t;
 MOCK_DECL(crypto_pk_t *,get_onion_key,(void));
 time_t get_onion_key_set_at(void);
 void set_server_identity_key(crypto_pk_t *k);
+/* Some compilers are clever enough to know that when relay mode is disabled,
+ * this function never returns. */
+#ifdef HAVE_MODULE_RELAY
 MOCK_DECL(crypto_pk_t *,get_server_identity_key,(void));
+#else
+#define get_server_identity_key() (tor_abort_(),NULL)
+#endif
 int server_identity_key_is_set(void);
 void set_client_identity_key(crypto_pk_t *k);
 crypto_pk_t *get_tlsclient_identity_key(void);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits