validationinterface: make MainSignalsInstance() a class, drop unused forward declarations#25067
Conversation
|
Most of the diff is move-only and is easily reviewed with git options like --ignore-all-space -U8 --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space. |
466a11a to
2b38010
Compare
2b38010 to
856040e
Compare
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
856040e to
1949586
Compare
pk-b2
left a comment
There was a problem hiding this comment.
ACK 1949586afc2f57061d27b87bf48d40861b8a4767
1949586 to
2911d94
Compare
|
ACK 2911d94 |
|
Is there a reason to move it to the header? This will make the header heavier and increase the includes, both of which theoretically result in slower builds. |
|
Thanks @MarcoFalke, you're right; there's no reason to and the forward class declaration is lighter. Repushed with the class remaining in the implementation, and removed two forward declarations in the header file that are no longer used. |
2911d94 to
f5afc23
Compare
maflcko
left a comment
There was a problem hiding this comment.
second commit looks wrong:
- "enter the commit message for your changes. Lines starting"
- missing includes (see iwyu)
|
Not sure about fixing includes manually now that we have iwyu. Seems wasteful of review resources and is likely still wrong (as seen here). |
f5afc23 to
c05ee1e
Compare
Yes, I hesitated on it and agree. Dropped the headers. |
promag
left a comment
There was a problem hiding this comment.
Code review ACK c05ee1e8440f7e1030a5d9597cb6963b99fe4051.
nit, would use refactor: prefix instead, like:
- refactor: make MainSignalsInstance a class
- refactor: remove unused forward declarations
2nd nit, I wouldn't mind dropping Instance from MainSignalsInstance. Maybe rename it to MainSignalsImpl as it looks like CMainSignals follows pimpl.
and use Doxygen documentation for it, per our developer notes. Context: MainSignalsInstance was created in 3a19fed and originally was a struct collection of boost::signals methods moved to validationinterface.cpp, in order to no longer need to include boost/signals in validationinterface.h. MainSignalsInstance then evolved in d6815a2 to remove boost/signals2 and became class-like. [C.8: Use class rather than struct if any member is non-public](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-class) [C.2: Use class if the class has an invariant; use struct if the data members can vary independently](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c2-use-class-if-the-class-has-an-invariant-use-struct-if-the-data-members-can-vary-independently) A class also has the advantage of default private access, as opposed to public for a struct.
```
-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" src test doc | xargs sed -i "s/$1/$2/g"; }
s 'MainSignalsInstance' 'MainSignalsImpl'
-END VERIFY SCRIPT-
Done. Grepping for |
c05ee1e to
ca1ac1f
Compare
danielabrozzoni
left a comment
There was a problem hiding this comment.
Code review ACK ca1ac1f
|
Code ACK ca1ac1f Tiny nit for the renaming ca1ac1f: |
Hm, perhaps (thanks for reviewing!) I've been reading it to mean "main signals" as in "primary signals" and there are also CMainSignals and GetMainSignals in validationinterface.{h,cpp}, so I don't have a strong opinion. |
…sImpl Summary: > refactor: make MainSignalsInstance() a class Context: MainSignalsInstance was originally a struct collection of boost::signals methods moved to validationinterface.cpp, in order to no longer need to include boost/signals in validationinterface.h. MainSignalsInstance then evolved to remove boost/signals2 and became class-like. [C.8: Use class rather than struct if any member is non-public](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-class) [C.2: Use class if the class has an invariant; use struct if the data members can vary independently](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c2-use-class-if-the-class-has-an-invariant-use-struct-if-the-data-members-can-vary-independently) A class also has the advantage of default private access, as opposed to public for a struct. > refactor: remove unused forward declarations in validationinterface.h > Rename MainSignalsInstance() class to MainSignalsImpl() This is a backport of [[bitcoin/bitcoin#25067 | core#25067]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D13265
Make MainSignalsInstance a class, rename it to MainSignalsImpl, use Doxygen documentation for it, and remove no longer used forward declarations in src/validationinterface.h.
MainSignalsInstance was created in 3a19fed and originally was a collection of boost::signals methods moved to validationinterface.cpp, in order to no longer need to include boost/signals in validationinterface.h.
MainSignalsInstance then evolved in d6815a2 to become class-like:
C.8: Use class rather than struct if any member is non-public
C.2: Use class if the class has an invariant; use struct if the data members can vary independently
A class has the advantage of default private access, as opposed to public for a struct.