Skip to content

Commit fe129a4

Browse files
committed
Avoid BOOST_JSON_STANDALONE
Boost 1.79 dropped support for BOOST_JSON_STANDALONE [1]. Prepare for upgrading Boost by switching off BOOST_JSON_STANDALONE. This commit should not change behavior. [1] https://www.boost.org/users/history/version_1_79_0.html
1 parent 6da2c29 commit fe129a4

File tree

138 files changed

+18970
-58
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+18970
-58
lines changed

benchmark/benchmark-lsp/benchmark-config.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ std::map<std::string, std::string> get_yarn_packages_versions(
102102
std::string_view json = lines[lines.size() - 1];
103103
QLJS_ALWAYS_ASSERT(!json.empty());
104104

105-
std::error_code error;
106-
::boost::json::value root = ::boost::json::parse(json, error);
105+
::boost::json::error_code error;
106+
::boost::json::value root =
107+
::boost::json::parse(to_boost_string_view(json), error);
107108
if (error != std::error_code()) {
108109
std::fprintf(stderr, "error: parsing 'yarn list' JSON failed\n");
109110
std::exit(1);
@@ -112,7 +113,8 @@ std::map<std::string, std::string> get_yarn_packages_versions(
112113
std::map<std::string, std::string> package_versions;
113114
::boost::json::value packages = look_up(root, "data", "trees");
114115
for (::boost::json::value package : packages.as_array()) {
115-
std::string full_package_name(look_up(package, "name").as_string());
116+
std::string full_package_name(
117+
to_string_view(look_up(package, "name").as_string()));
116118
std::size_t version_separator_index = full_package_name.rfind('@');
117119
QLJS_ALWAYS_ASSERT(version_separator_index != full_package_name.npos);
118120
std::string_view package_name =
@@ -352,17 +354,18 @@ benchmark_config benchmark_config::load() {
352354
package_json_content.error_to_string().c_str());
353355
std::exit(1);
354356
}
355-
std::error_code error;
357+
::boost::json::error_code error;
356358
::boost::json::value package_info = ::boost::json::parse(
357-
to_string_view(package_json_content->string_view()), error);
359+
to_boost_string_view(package_json_content->string_view()),
360+
error);
358361
if (error != std::error_code()) {
359362
std::fprintf(stderr, "error: %s: parsing JSON failed\n",
360363
package_json_path);
361364
std::exit(1);
362365
}
363-
metadata["vscode-eslint"] =
366+
metadata["vscode-eslint"] = to_string_view(
364367
look_up(package_info, "dependencies", "vscode-eslint")
365-
.as_string();
368+
.as_string());
366369

367370
return metadata;
368371
},

benchmark/benchmark-lsp/lsp-benchmarks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ class change_wait_benchmark : public benchmark {
167167
while (!remaining_uris.empty()) {
168168
::boost::json::object notification =
169169
co_await server.wait_for_first_diagnostics_notification_async();
170-
string8 notification_uri = to_string8(
171-
std::string(look_up(notification, "params", "uri").get_string()));
170+
string8 notification_uri = to_string8(to_string_view(
171+
look_up(notification, "params", "uri").get_string()));
172172

173173
auto uri_it = remaining_uris.find(notification_uri);
174174
QLJS_ALWAYS_ASSERT(uri_it != remaining_uris.end());

benchmark/benchmark-lsp/lsp-server-process.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ lsp_task<::boost::json::array> lsp_server_process::wait_for_diagnostics_async(
269269
[&](::boost::json::object& params) {
270270
::boost::json::string diagnostics_uri =
271271
look_up(params, "uri").get_string();
272-
if (diagnostics_uri != to_string_view(document_uri)) {
272+
if (diagnostics_uri != to_boost_string_view(document_uri)) {
273273
return false;
274274
}
275275
std::int64_t* diagnostics_version = if_int64(params, "version");
@@ -421,9 +421,9 @@ void lsp_server_process::create_file_on_disk_if_needed(string8_view path) {
421421

422422
::boost::json::value lsp_server_process::get_message_awaitable::await_resume() {
423423
QLJS_ASSERT(!this->message_content_.empty());
424-
std::error_code error;
424+
::boost::json::error_code error;
425425
::boost::json::value root =
426-
::boost::json::parse(to_string_view(this->message_content_), error);
426+
::boost::json::parse(to_boost_string_view(this->message_content_), error);
427427
if (error != std::error_code()) {
428428
std::fprintf(stderr, "error: parsing JSON from LSP server failed\n");
429429
std::exit(1);

src/boost-json.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ ::boost::json::string_view to_boost_string_view(std::string_view sv) {
1818
}
1919
#endif
2020

21-
#if !defined(BOOST_JSON_STANDALONE)
2221
std::string_view to_string_view(::boost::json::string_view sv) {
2322
return std::string_view(sv.data(), sv.size());
2423
}
25-
#endif
2624

2725
std::string_view to_string_view(const ::boost::json::string& s) {
2826
return std::string_view(s.data(), s.size());

src/boost.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
namespace boost {
88
void throw_exception(const std::exception&) { std::terminate(); }
9+
10+
void throw_exception(const std::exception&, boost::source_location const&) {
11+
std::terminate();
12+
}
913
}
1014

1115
// quick-lint-js finds bugs in JavaScript programs.

src/char8.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ string8 to_string8(const std::string &s) {
2525
string8 to_string8(const std::string &s) { return s; }
2626
#endif
2727

28+
string8 to_string8(std::string_view s) { return string8(to_string8_view(s)); }
29+
2830
#if QLJS_HAVE_CHAR8_T
2931
std::string to_string(const string8_view &s) {
3032
return std::string(reinterpret_cast<const char *>(s.data()), s.size());

src/quick-lint-js/boost-json.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ ::boost::json::string_view to_boost_string_view(string8_view sv);
1616
::boost::json::string_view to_boost_string_view(std::string_view sv);
1717
#endif
1818

19-
#if !defined(BOOST_JSON_STANDALONE)
2019
std::string_view to_string_view(::boost::json::string_view sv);
21-
#endif
2220
std::string_view to_string_view(const ::boost::json::string &s);
2321

2422
template <class... Keys>

src/quick-lint-js/char8.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ inline string8_view out_string8(string8_view sv) noexcept { return sv; }
4040
#endif
4141

4242
string8 to_string8(const std::string &);
43+
string8 to_string8(std::string_view);
4344
std::string to_string(const string8_view &);
4445

4546
std::string_view to_string_view(string8_view);

vendor/README.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,13 @@ release archive:
4747

4848
Additionally, the following patches have been manually applied:
4949

50-
* boost-json-pmr.patch
5150
* boost-static-var.patch
5251

5352
Additionally, the following directories and files have been deleted to reduce
5453
storage consumption:
5554

56-
* boost/boost/align/
57-
* boost/boost/io/
58-
* boost/boost/predef/
5955
* boost/boost/shared_ptr.hpp
6056
* boost/boost/smart_ptr/
61-
* boost/boost/system/
62-
* boost/boost/type_traits/
63-
* boost/boost/utility/
64-
* boost/boost/winapi/
6557

6658
Copyright: various
6759
Download URL: https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2

vendor/boost-json-pmr.patch

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)