New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config subsys #1488
Closed
Closed
Config subsys #1488
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closes ticket 32344.
This will help us reimplement warn_about_relative_paths(). FILENAME options currently are the same as STRINGs in most respects, except for the type reported to the controller. In this commit, I'm picking the options to change based on: * the current contents of warn_about_relative_paths() * options that end with "File".
This is part of ticket 32344.
nmathewson
force-pushed
the
config_subsys
branch
from
October 30, 2019 19:59
1678e3a
to
60d0e23
Compare
Pull Request Test Coverage Report for Build 7038
💛 - Coveralls |
This file is a workaround for the issue that if you say `a ## b` to create a token that is the name of a macro, the C preprocessor won't expand that macro. So you can't say this: #define FOO__SQUARE(x) ((x)*(x)) #define FOO__CUBE(x) ((x)*(x)*(x)) #define FOO(func, x) FOO__##func(x) Instead, the standard C trick is to add a layer of indirection: #define PASTE(a,b) PASTE__(a,b) #define PASTE__(a,b) a ## b #define FOO__SQUARE(x) ((x)*(x)) #define FOO__CUBE(x) ((x)*(x)*(x)) #define FOO(func, x) PASTE(FOO__, func)(x) We should use this kind of trick sparingly, since it gets confusing.
In our old design, we had to declare configuration structures (like or_options_t) and variable tables (like option_vars_) separately, and we used some magic to enforce their consistency (see conftesting.h). With this design, we write a single definition for the configuration object and its fields, and use C macros to expand it either into a structure, or a variable table. Since they are both made from the same source, they can't become inconsistent. The two designs can coexist happily, and we can migrate from one to the other at our convenience.
This version uses the enum rather than the type definitions, to avoid layering violations and linking problems.
Here's an example of how we can use the new macros in confdecl.h to declare a module-level configuration. This configuration isn't actually "hooked up" to anything yet: it's just here as an example.
These settings allow doxygen to find and understand doxygen comments in configuration definitions made using the macros in confdecl.h.
The subsysmgr code wants to use them.
We used to have only one boolean per subsystem, but we're about to have a little more information.
The formats, when provided, are now added to the global config_mgr_t objects.
These functions are in the subsystem, not in the config_format_t, since they are about how the format is _used_, not about _what it is_.
nmathewson
force-pushed
the
config_subsys
branch
from
November 1, 2019 14:46
60d0e23
to
3cda89f
Compare
teor2345
suggested changes
Nov 5, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a quick review of this PR.
ghost
closed this
May 25, 2021
ghost
deleted the branch
torproject:master
May 25, 2021 12:56
This pull request was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.