-
Notifications
You must be signed in to change notification settings - Fork 543
[CXX-2625] Bring our very own string_view (plus: Some iterators + ranges backports) #1062
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
Merged
vector-of-bool
merged 50 commits into
mongodb:master
from
vector-of-bool:own-string_view.2
Dec 21, 2023
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
71f0e61
Shorthand for trailing return type, noexcept, and single-return-state…
vector-of-bool f5e1d02
Some additional traits: decay_copy and rank<>
vector-of-bool f79efdb
New operators.hpp utilities
vector-of-bool ff488e3
Iterator utilities
vector-of-bool 155f528
We don't need to start_mongod for the simple compile tasks
vector-of-bool e3575fa
A new set of macros for concise diagnostic controls
vector-of-bool fb1ac46
Disable warnings about void-dereference on Clang
vector-of-bool 41d6765
Reorganize macro definitions
vector-of-bool 3868e35
Fix: malformed pragmas on MSVC
vector-of-bool c7350d3
A small amount of std::ranges from the future
vector-of-bool c13e052
Bring our own std::string_view
vector-of-bool f2bb2fb
Avoid warnings about "unsecure stdlib" code
vector-of-bool fbd5535
Tweak definition of is_equality_comparable
vector-of-bool 5740433
decay_copy is no longer needed (yet)
vector-of-bool b318f62
Check for MSVC's version macro
vector-of-bool ff7978d
No ADL-only data()
vector-of-bool 4aeae1d
Remove c_str(), tweak "string-like" detection
vector-of-bool 536fc05
Minor spelling and tests
vector-of-bool b973270
Merge branch 'master' into own-string_view.2
vector-of-bool 39dc524
MSVC 19.10 lies about C++14 constexpr
vector-of-bool d67f942
Test and fixup for ADL lookup on VS 2015
vector-of-bool c1a7997
Cleaner size() constraint
vector-of-bool 40f544f
unreachable_sentinel, plus support for arg swapping in equality_opera…
vector-of-bool e083ca5
Qualify test names in string_view tests
vector-of-bool 43c7924
Bring our own algorithm.hpp
vector-of-bool 09961a8
Implement find() and contains() from string_view
vector-of-bool e9e78ea
Merge branch 'master' into own-string_view.2
vector-of-bool 1f3c509
Remove newer .clang-foramt option, document internal macros as internal
vector-of-bool 67af4b3
Calm linter
vector-of-bool 2c61f8d
Sort file lists
vector-of-bool 7d31688
Remove string_view assertions
vector-of-bool bff45a1
Add/update copyright banners
vector-of-bool b502632
Tweak is_dereferencable to test lvalues
vector-of-bool 347228a
Tweak some macro names/scoping
vector-of-bool af787d5
Updating casing on macro names
vector-of-bool 7fb5dc3
Exclude some files from Doxygen coverage
vector-of-bool cb8f1d9
[foldme] macro case updates
vector-of-bool b89c040
Simpler iterator_concept_t
vector-of-bool 4aad0eb
Explain the inclusion of std::contiguous_iterator_tag
vector-of-bool 2b9291d
Update #include style
vector-of-bool cf495de
Qualify bsoncxx::detail references
vector-of-bool c7168a5
Spelling/wording tweaks
vector-of-bool f59fbea
Remove C++20+ string-view APIs
vector-of-bool 348fa3e
More testing and fixes for fencepost errors in string searches
vector-of-bool b5398c1
Drop range constructs. Test+fix some more edge cases in string search…
vector-of-bool 2a06503
Drop equality requirement
vector-of-bool c948aa6
Merge branch 'master' into own-string_view.2
vector-of-bool ffc332e
More review and cleanup + spec matching
vector-of-bool 3608164
More careful conversion to/from std types
vector-of-bool 87bc426
ClangFormat changes its mind in the future, +stray noexcepts
vector-of-bool File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
133 changes: 133 additions & 0 deletions
133
src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/util.hpp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
// clang-format off | ||
/** | ||
* @internal | ||
* @brief Convert the given macro argument to a string literal, after macro expansion | ||
*/ | ||
#define BSONCXX_STRINGIFY(...) BSONCXX_STRINGIFY_IMPL(__VA_ARGS__) | ||
#define BSONCXX_STRINGIFY_IMPL(...) #__VA_ARGS__ | ||
|
||
/** | ||
* @brief Token-paste two macro arguments, after macro expansion | ||
*/ | ||
#define BSONCXX_CONCAT(A, ...) BSONCXX_CONCAT_IMPL(A, __VA_ARGS__) | ||
#define BSONCXX_CONCAT_IMPL(A, ...) A##__VA_ARGS__ | ||
|
||
/** | ||
* @internal | ||
* @brief Expands to a _Pragma() preprocessor directive, after macro expansion | ||
eramongodb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* The arguments an arbitrary "token soup", and should not be quoted like a regular | ||
* _Pragma. This macro will stringify-them itself. | ||
* | ||
* Example: | ||
* | ||
* BSONCXX_PRAGMA(GCC diagnostic ignore "-Wconversion") | ||
* | ||
* will become: | ||
* | ||
* _Pragma("GCC diagnostic ignore \"-Wconversion\"") | ||
* | ||
*/ | ||
#define BSONCXX_PRAGMA(...) _bsoncxxPragma(__VA_ARGS__) | ||
#ifdef _MSC_VER | ||
// Old MSVC doesn't recognize C++11 _Pragma(), but it always recognized __pragma | ||
#define _bsoncxxPragma(...) __pragma(__VA_ARGS__) | ||
#else | ||
#define _bsoncxxPragma(...) _Pragma(BSONCXX_STRINGIFY(__VA_ARGS__)) | ||
#endif | ||
|
||
/** | ||
* @internal | ||
* @brief Use in a declaration position to force the appearence of a semicolon | ||
* as the next token. Use this for statement-like or declaration-like macros to | ||
* enforce that their call sites are followed by a semicolon | ||
*/ | ||
#define BSONCXX_FORCE_SEMICOLON static_assert(true, "") | ||
|
||
/** | ||
* @internal | ||
* @brief Add a trailing noexcept, decltype-return, and return-body to a | ||
* function definition. (Not compatible with lambda expressions.) | ||
* | ||
* Example: | ||
* | ||
* template <typename T> | ||
* auto foo(T x, T y) BSONCXX_RETURNS(x + y); | ||
* | ||
* Becomes: | ||
* | ||
* template <typename T> | ||
* auto foo(T x, T y) noexcept(noexcept(x + y)) | ||
* -> decltype(x + y) | ||
* { return x + y }; | ||
* | ||
*/ | ||
#define BSONCXX_RETURNS(...) \ | ||
noexcept(noexcept(__VA_ARGS__))->decltype(__VA_ARGS__) { \ | ||
return __VA_ARGS__; \ | ||
} \ | ||
BSONCXX_FORCE_SEMICOLON | ||
|
||
/** | ||
* @internal | ||
* @macro mongocxx_cxx14_constexpr | ||
* @brief Expands to `constexpr` if compiling as c++14 or greater, otherwise | ||
* expands to `inline`. | ||
* | ||
* Use this on functions that can only be constexpr in C++14 or newer, including | ||
* non-const member functions. | ||
*/ | ||
#if __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L && _MSC_VER > 1910) | ||
#define bsoncxx_cxx14_constexpr constexpr | ||
#else | ||
#define bsoncxx_cxx14_constexpr inline | ||
#endif | ||
|
||
/** | ||
* @internal | ||
* @brief Disable a warning for a particular compiler. | ||
* | ||
* The argument should be of the form: | ||
* | ||
* - Clang(<flag-string-literal>) | ||
* - GCC(<flag-string-literal>) | ||
* - GNU(<flag-string-literal>) | ||
* - MSVC(<id-integer-literal>) | ||
* | ||
* The "GNU" form applies to both GCC and Clang | ||
*/ | ||
#define BSONCXX_DISABLE_WARNING(Spec) \ | ||
BSONCXX_CONCAT(_bsoncxxDisableWarningImpl_for_, Spec) \ | ||
BSONCXX_FORCE_SEMICOLON | ||
|
||
/** | ||
* @internal | ||
* @brief Push the current compiler diagnostics settings state | ||
*/ | ||
#define BSONCXX_PUSH_WARNINGS() \ | ||
BSONCXX_IF_GNU_LIKE(BSONCXX_PRAGMA(GCC diagnostic push)) \ | ||
BSONCXX_IF_MSVC(BSONCXX_PRAGMA(warning(push))) \ | ||
BSONCXX_FORCE_SEMICOLON | ||
|
||
/** | ||
* @internal | ||
* @brief Restore prior compiler diagnostics settings from before the most | ||
* recent BSONCXX_PUSH_WARNINGS() | ||
*/ | ||
#define BSONCXX_POP_WARNINGS() \ | ||
BSONCXX_IF_GNU_LIKE(BSONCXX_PRAGMA(GCC diagnostic pop)) \ | ||
BSONCXX_IF_MSVC(BSONCXX_PRAGMA(warning(pop))) \ | ||
BSONCXX_FORCE_SEMICOLON | ||
|
||
#define _bsoncxxDisableWarningImpl_for_GCC(...) \ | ||
BSONCXX_IF_GCC(BSONCXX_PRAGMA(GCC diagnostic ignored __VA_ARGS__)) | ||
|
||
#define _bsoncxxDisableWarningImpl_for_Clang(...) \ | ||
BSONCXX_IF_CLANG(BSONCXX_PRAGMA(GCC diagnostic ignored __VA_ARGS__)) | ||
|
||
#define _bsoncxxDisableWarningImpl_for_GNU(...) \ | ||
_bsoncxxDisableWarningImpl_for_GCC(__VA_ARGS__) \ | ||
_bsoncxxDisableWarningImpl_for_Clang(__VA_ARGS__) | ||
|
||
#define _bsoncxxDisableWarningImpl_for_MSVC(...) \ | ||
BSONCXX_IF_MSVC(BSONCXX_PRAGMA(warning(disable : __VA_ARGS__))) |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.