diff --git a/src/app/config/config.c b/src/app/config/config.c
index 108786fb64f714f8e54cae9a1331128ae551b060..1b697e73fc33e9b90499ea499392c3ce9b6a543d 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -2951,7 +2951,7 @@ options_validate(const or_options_t *old_options, or_options_t *options,
   vs = config_validate(get_options_mgr(), old_options, options, msg);
   return vs < 0 ? -1 : 0;
 }
-#endif
+#endif /* defined(TOR_UNIT_TESTS) */
 
 #define REJECT(arg) \
   STMT_BEGIN *msg = tor_strdup(arg); return -1; STMT_END
diff --git a/src/feature/dirauth/dirauth_config.h b/src/feature/dirauth/dirauth_config.h
index fbe4ec1a52672d830c50b56592f3e7489b41f031..655ab0a7fad8035015f733bf33f31b12e205edc9 100644
--- a/src/feature/dirauth/dirauth_config.h
+++ b/src/feature/dirauth/dirauth_config.h
@@ -39,7 +39,7 @@ int options_act_dirauth_mtbf(const or_options_t *old_options);
 int options_act_dirauth_stats(const or_options_t *old_options,
                               bool *print_notice_out);
 
-#else
+#else /* !defined(HAVE_MODULE_DIRAUTH) */
 
 /** When tor is compiled with the dirauth module disabled, it can't be
  * configured as a directory authority.
diff --git a/src/feature/relay/relay_config.h b/src/feature/relay/relay_config.h
index c0d7d41240daf021577487cdf8a270133da9ce64..214f07efc246a5a60995c92392d14ac0be23abc2 100644
--- a/src/feature/relay/relay_config.h
+++ b/src/feature/relay/relay_config.h
@@ -88,9 +88,9 @@ STATIC int check_bridge_distribution_setting(const char *bd);
 STATIC int have_enough_mem_for_dircache(const or_options_t *options,
                                         size_t total_mem, char **msg);
 
-#endif
+#endif /* defined(RELAY_CONFIG_PRIVATE) */
 
-#else
+#else /* !defined(HAVE_MODULE_RELAY) */
 
 #include "lib/cc/compat_compiler.h"
 
@@ -183,6 +183,6 @@ options_validate_relay_mode(const or_options_t *old_options,
 #define options_act_relay_dir(old_options) \
   (((void)(old_options)),0)
 
-#endif
+#endif /* defined(HAVE_MODULE_RELAY) */
 
 #endif /* !defined(TOR_FEATURE_RELAY_RELAY_CONFIG_H) */
diff --git a/src/feature/relay/transport_config.h b/src/feature/relay/transport_config.h
index de6e7668e20137ef2c1f1148c2ece1f51b9df417..d3cceb3698cfbacfd3f2458273af7bdb3f7a2065 100644
--- a/src/feature/relay/transport_config.h
+++ b/src/feature/relay/transport_config.h
@@ -34,9 +34,9 @@ STATIC smartlist_t *get_options_from_transport_options_line(
                       const char *line,
                       const char *transport);
 
-#endif
+#endif /* defined(RELAY_TRANSPORT_CONFIG_PRIVATE) */
 
-#else
+#else /* !defined(HAVE_MODULE_RELAY) */
 
 /** When tor is compiled with the relay module disabled, it can't be
  * configured with server pluggable transports.
@@ -80,6 +80,6 @@ options_validate_server_transport(const or_options_t *old_options,
 #define options_act_server_transport(old_options) \
   (((void)(old_options)),0)
 
-#endif
+#endif /* defined(HAVE_MODULE_RELAY) */
 
 #endif /* !defined(TOR_FEATURE_RELAY_TRANSPORT_CONFIG_H) */
diff --git a/src/test/test_options.c b/src/test/test_options.c
index 8e673c09f6afc37bfdac06508ae644ea2892df44..c06fb998fbc060fa28fffaccf625dbf87c3824f4 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -112,7 +112,7 @@ clear_log_messages(void)
 #define ENABLE_AUTHORITY_V3 ""
 #define ENABLE_AUTHORITY_BRIDGE ""
 
-#else
+#else /* !defined(COCCI) */
 
 #define ENABLE_AUTHORITY_MIN \
   "AuthoritativeDirectory 1\n"
@@ -144,7 +144,7 @@ clear_log_messages(void)
   ENABLE_AUTHORITY_BRIDGE_MIN \
   AUTHORITY_OPT_REQ_
 
-#endif
+#endif /* defined(COCCI) */
 
 #define VALID_DIR_AUTH "DirAuthority dizum orport=443 v3ident=E8A9C45"  \
   "EDE6D711294FADF8E7951F4DE6CA56B58 194.109.206.212:80 7EA6 EAD6 FD83" \