-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
seastar.cc, tls: include used header #2175
Closed
Closed
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
this should address the build failure with modules enabled: ``` FAILED: src/CMakeFiles/seastar-module.dir/net/tls.cc.o /home/kefu/.local/bin/clang++ -DFMT_SHARED -DSEASTAR_API_LEVEL=7 -DSEASTAR_COROUTINES_ENABLED -DSEASTAR_MODULE -DSEASTAR_SCHEDULING_GROUPS_COUNT=16 -DSEASTAR_SSTRING -Dseastar_module_EXPORTS -I/home/kefu/dev/seastar/include -I/home/kefu/d ev/seastar/build/debug/gen/include -I/home/kefu/dev/seastar/src -g -std=c++23 -fPIC -U_FORTIFY_SOURCE -Wno-include-angled-in-module-purview -MD -MT src/CMakeFiles/seastar-module.dir/net/tls.cc.o -MF src/CMakeFiles/seastar-module.dir/net/t ls.cc.o.d @src/CMakeFiles/seastar-module.dir/net/tls.cc.o.modmap -o src/CMakeFiles/seastar-module.dir/net/tls.cc.o -c /home/kefu/dev/seastar/src/net/tls.cc /home/kefu/dev/seastar/src/net/tls.cc:930:14: error: missing '#include <bits/unordered_set.h>'; 'unordered_set' must be declared before it is used 930 | std::unordered_set<sstring> _all_files; | ^ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:104:11: note: declaration here is not visible 104 | class unordered_set | ^ /home/kefu/dev/seastar/src/net/tls.cc:892:44: error: missing '#include <bits/unordered_set.h>'; 'unordered_set' must be declared before it is used 892 | _cb(boost::copy_range<std::unordered_set<sstring>>(_files | boost::adaptors::map_keys), std::move(ep)); | ^ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:104:11: note: declaration here is not visible 104 | class unordered_set | ^ /home/kefu/dev/seastar/src/net/tls.cc:1574:73: error: missing '#include <bits/unordered_set.h>'; 'unordered_set' must be declared before it is used 1574 | future<std::vector<subject_alt_name>> get_alt_name_information(std::unordered_set<subject_alt_name_type> types) { | ^ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:104:11: note: declaration here is not visible 104 | class unordered_set | ^ /home/kefu/dev/seastar/src/net/tls.cc:1793:73: error: missing '#include <bits/unordered_set.h>'; 'unordered_set' must be declared before it is used 1793 | future<std::vector<subject_alt_name>> get_alt_name_information(std::unordered_set<subject_alt_name_type> types) { | ^ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:104:11: note: declaration here is not visible 104 | class unordered_set | ^ /home/kefu/dev/seastar/src/net/tls.cc:1977:105: error: missing '#include <bits/unordered_set.h>'; 'unordered_set' must be declared before it is used 1977 | future<std::vector<tls::subject_alt_name>> tls::get_alt_name_information(connected_socket& socket, std::unordered_set<subject_alt_name_type> types) { | ^ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:104:11: note: declaration here is not visible 104 | class unordered_set | ^ ``` Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
this allows all module implementation units to use a single definition without worrying about using different definitions in different units. without this change, clang-18 and libstdc++ shipped by GCC-13 fails to build the tree like: ``` FAILED: src/CMakeFiles/seastar-module.dir/core/memory.cc.o /home/kefu/.local/bin/clang++ -DFMT_SHARED -DSEASTAR_API_LEVEL=7 -DSEASTAR_COROUTINES_ENABLED -DSEASTAR_MODULE -DSEASTAR_SCHEDULING_GROUPS_COUNT=16 -DSEASTAR_SSTRING -Dseastar_module_EXPORTS -I/home/kefu/dev/seastar/include -I/home/kefu/d ev/seastar/build/debug/gen/include -I/home/kefu/dev/seastar/src -g -std=c++23 -fPIC -U_FORTIFY_SOURCE -Wno-include-angled-in-module-purview -MD -MT src/CMakeFiles/seastar-module.dir/core/memory.cc.o -MF src/CMakeFiles/seastar-module.dir/c ore/memory.cc.o.d @src/CMakeFiles/seastar-module.dir/core/memory.cc.o.modmap -o src/CMakeFiles/seastar-module.dir/core/memory.cc.o -c /home/kefu/dev/seastar/src/core/memory.cc In module 'seastar' imported from /home/kefu/dev/seastar/src/core/memory.cc:111: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:1827:5: error: 'std::operator==' has different definitions in different modules; definition in module 'seastar' first difference is function body 1826 | inline bool | ~~~~~~~~~~~ 1827 | operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1828 | const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1829 | { return __x._M_h._M_equal(__y._M_h); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:1827:5: note: but in '' found a different body 1826 | inline bool | ~~~~~~~~~~~ 1827 | operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1828 | const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1829 | { return __x._M_h._M_equal(__y._M_h); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In module 'seastar' imported from /home/kefu/dev/seastar/src/core/memory.cc:111: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unordered_set.h:1813:5: error: 'std::operator==' has different definitions in different modules; definition in module 'seastar' first difference is function body 1812 | inline bool | ~~~~~~~~~~~ 1813 | operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1814 | const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1815 | { return __x._M_h._M_equal(__y._M_h); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
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.
this series add two missing
#include
:s intls.cc
andseastar.cc
. for similar but different reasons:tls.cc
, we useunordered_set<>
template without including it. this compiles fine without enabling C++20 modules, but this behavior is fragile -- we could remove the#include <unordered_set>
macro in a random header file (indirectly) included by this source file in future. so we should include it where the template is used.seastar.cc
, the purview is supposed to include all external headers. if it fails to do so, the implementation units would fail to access a single copy of the symbols, and causes confusions of the compiler.