summaryrefslogtreecommitdiff
path: root/src/lib/conf
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-06-21 09:58:40 -0400
committerNick Mathewson <nickm@torproject.org>2019-06-25 12:51:25 -0400
commita7835202cf871f68854494df904058a6e644c0b0 (patch)
tree0da40c2c861d44374de01f58902e17a913326993 /src/lib/conf
parentb6457d4c08f601c4e42e64aad47ac9c30c36306e (diff)
downloadtor-a7835202cf871f68854494df904058a6e644c0b0.tar.gz
tor-a7835202cf871f68854494df904058a6e644c0b0.zip
Turn several properties of types or variables into flags.
"unsettable" is a property of types. LINELIST_V and OBSOLETE are unsettable, meaning that they cannot be set by name. "contained" is a property of types. I'm hoping to find a better name here. LINELIST_S is "contained" because it always appears within a LINELIST_V, and as such doesn't need to be dumped ore copied independently. "cumulative" is a property of types. Cumulative types can appear more than once in a torrc without causing a warning, because they add to each other rather than replacing each other. "obsolete" is a property of variables. "marking fragile" is now a command that struct members can accept. With these changes, confparse and config no longer ever need to mention CONFIG_TYPE_XYZ values by name.
Diffstat (limited to 'src/lib/conf')
-rw-r--r--src/lib/conf/confmacros.h4
-rw-r--r--src/lib/conf/conftypes.h6
2 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/conf/confmacros.h b/src/lib/conf/confmacros.h
index ff284e681d..aa89965e69 100644
--- a/src/lib/conf/confmacros.h
+++ b/src/lib/conf/confmacros.h
@@ -60,6 +60,8 @@
}
#define CONFIG_VAR_OBSOLETE(varname) \
- { .member = { .name = varname, .type = CONFIG_TYPE_OBSOLETE } }
+ { .member = { .name = varname, .type = CONFIG_TYPE_OBSOLETE }, \
+ .flags = CVFLAG_OBSOLETE \
+ }
#endif /* !defined(TOR_LIB_CONF_CONFMACROS_H) */
diff --git a/src/lib/conf/conftypes.h b/src/lib/conf/conftypes.h
index 028a889917..6a44fb92ed 100644
--- a/src/lib/conf/conftypes.h
+++ b/src/lib/conf/conftypes.h
@@ -105,6 +105,12 @@ typedef struct struct_magic_decl_t {
int magic_offset;
} struct_magic_decl_t;
+/**
+ * Flag to indicate that an option is obsolete. Any attempt to set or
+ * fetch this option should produce a warning.
+ **/
+#define CVFLAG_OBSOLETE (1u<<0)
+
/** A variable allowed in the configuration file or on the command line. */
typedef struct config_var_t {
struct_member_t member; /** A struct member corresponding to this