aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2018-04-08 14:37:50 -0400
committerRussell Yanofsky <russ@yanofsky.org>2019-02-22 15:43:02 -0400
commit318f41fb2cae0a46b4e4be49156562b8ed640f0c (patch)
tree0eba3861ed4428126b2e068d79e93895375c8163 /contrib/devtools
parentd02b34c8a8bd446c9620fe626b4379617f9a9639 (diff)
downloadbitcoin-318f41fb2cae0a46b4e4be49156562b8ed640f0c.tar.xz
circular-dependencies: Avoid treating some .h/.cpp files as a unit
This avoids a bogus circular dependency error in the next commit: interfaces/chain -> interfaces/wallet -> wallet/wallet -> interfaces/chain Which is incorrect, because interfaces/chain.cpp depends only on the interfaces/wallet.h file, not the interfaces/wallet.cpp file, and it is wrong to treat these as a unit. Inside the interfaces directory, .h files contain abstract class definitions and .cpp files contain implementations of those classes, so you don't need to link against .cpp files if you're only using the abstract class definition in the .h file. An alternative fix might be to rename all the cpp files in the interfaces directory like: chain.cpp->chain_impl.cpp, node.cpp->node_impl.cpp. But just getting the linter to treat these files as independent dependencies seemed like it would allow keeping code organization straightforward and avoiding the need to rename things.
Diffstat (limited to 'contrib/devtools')
-rwxr-xr-xcontrib/devtools/circular-dependencies.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/devtools/circular-dependencies.py b/contrib/devtools/circular-dependencies.py
index abfa5ed5ae..2e4657f1dd 100755
--- a/contrib/devtools/circular-dependencies.py
+++ b/contrib/devtools/circular-dependencies.py
@@ -8,9 +8,18 @@ MAPPING = {
'core_write.cpp': 'core_io.cpp',
}
+# Directories with header-based modules, where the assumption that .cpp files
+# define functions and variables declared in corresponding .h files is
+# incorrect.
+HEADER_MODULE_PATHS = [
+ 'interfaces/'
+]
+
def module_name(path):
if path in MAPPING:
path = MAPPING[path]
+ if any(path.startswith(dirpath) for dirpath in HEADER_MODULE_PATHS):
+ return path
if path.endswith(".h"):
return path[:-2]
if path.endswith(".c"):