build: Optionally enable -Wthread-safety-attributes#15556
Closed
Empact wants to merge 4 commits intobitcoin:masterfrom
Closed
build: Optionally enable -Wthread-safety-attributes#15556Empact wants to merge 4 commits intobitcoin:masterfrom
Empact wants to merge 4 commits intobitcoin:masterfrom
Conversation
When configured with --enable-isystem.
Was necessary to split QT_INCLUDES into QT_INCLUDES and
QT_MOC_INCLUDES because moc does not understand -isystem, e.g.:
Unknown options: isystem/usr/local/Cellar/qt/5.10.0_1/include/QtNetwork[...]
This does not convert all uses, but focuses on libraries which have triggered
warnings/errors when applying initial additional build checks: QT, Univalue, and Berkeley DB.
LevelDb requires additional measures as its code is compiled with the project warnings
via AM_CXXFLAGS.
Note -isystem should not be applied to /usr/include, see BITCOIN_SYSTEM_INCLUDE
for a helper to convert -I to -isystem with /usr/include excepted.
-Werror=documentation if isystem & werror are enabled.
And solve associated error:
In file included from sync.cpp:5:
./sync.h:66:106: error: 'assert_exclusive_lock' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'void *' [-Werror,-Wthread-safety-attributes]
void static inline AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) ASSERT_EXCLUSIVE_LOCK(cs) {}
^
./threadsafety.h:34:49: note: expanded from macro 'ASSERT_EXCLUSIVE_LOCK'
#define ASSERT_EXCLUSIVE_LOCK(...) __attribute((assert_exclusive_lock(__VA_ARGS__)))
^
In file included from threadinterrupt.cpp:6:
In file included from ./threadinterrupt.h:8:
./sync.h:66:106: error: 'assert_exclusive_lock' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'void *' [-Werror,-Wthread-safety-attributes]
void static inline AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) ASSERT_EXCLUSIVE_LOCK(cs) {}
^
./threadsafety.h:34:49: note: expanded from macro 'ASSERT_EXCLUSIVE_LOCK'
#define ASSERT_EXCLUSIVE_LOCK(...) __attribute((assert_exclusive_lock(__VA_ARGS__)))
^
1 error generated.
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Contributor
Author
|
Needs some work |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
And solve
error: 'assert_exclusive_lock' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'void *'by introducing an abstract baseLockclass.Builds on #14920.