Skip to content

Commit

Permalink
fix: support Apple Clang 13
Browse files Browse the repository at this point in the history
Fix issues when compiling with Apple Clang 13.1.6 for macOS:

* add explicit casts
* add explicit [[noreturn]] attributes
* add missing #include
* disable spurious warnings
* stop using removed warning flag (-Wfallback)
  • Loading branch information
strager committed Jul 1, 2022
1 parent c36a92a commit df34a98
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions benchmark/benchmark-lsp/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <cstdlib>
#include <cstring>
#include <quick-lint-js/narrow-cast.h>
#include <quick-lint-js/process.h>
#include <sys/wait.h>
#include <unistd.h>

Expand Down
10 changes: 7 additions & 3 deletions plugin/vscode/quick-lint-js-vscode-node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ class qljs_workspace : public ::Napi::ObjectWrap<qljs_workspace> {
return this->stop_pipe_.reader.ref();
}

void append(string8_view) { QLJS_UNREACHABLE(); }
[[noreturn]] void append(string8_view) { QLJS_UNREACHABLE(); }

#if QLJS_HAVE_KQUEUE || QLJS_HAVE_POLL
std::optional<posix_fd_file_ref> get_pipe_write_fd() {
Expand All @@ -910,9 +910,13 @@ class qljs_workspace : public ::Napi::ObjectWrap<qljs_workspace> {
#endif

#if QLJS_HAVE_KQUEUE
void on_pipe_write_event(const struct ::kevent&) { QLJS_UNREACHABLE(); }
[[noreturn]] void on_pipe_write_event(const struct ::kevent&) {
QLJS_UNREACHABLE();
}
#elif QLJS_HAVE_POLL
void on_pipe_write_event(const ::pollfd&) { QLJS_UNREACHABLE(); }
[[noreturn]] void on_pipe_write_event(const ::pollfd&) {
QLJS_UNREACHABLE();
}
#endif

void filesystem_changed() {
Expand Down
3 changes: 2 additions & 1 deletion plugin/vscode/quick-lint-js/vscode-tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ class vscode_tracer {
std::vector<trace_vscode_document_change> traced_changes(
changes.Length());
for (std::size_t i = 0; i < traced_changes.size(); ++i) {
::Napi::Object change = changes.Get(i).As<::Napi::Object>();
::Napi::Object change =
changes.Get(narrow_cast<std::uint32_t>(i)).As<::Napi::Object>();
::Napi::Object range = change.Get("range").As<::Napi::Object>();
::Napi::Object start = range.Get("start").As<::Napi::Object>();
::Napi::Object end = range.Get("end").As<::Napi::Object>();
Expand Down
1 change: 1 addition & 0 deletions src/lex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,7 @@ QLJS_WARNING_POP

QLJS_WARNING_PUSH
QLJS_WARNING_IGNORE_CLANG("-Wunknown-attributes")
QLJS_WARNING_IGNORE_CLANG("-Wunreachable-code")
QLJS_WARNING_IGNORE_GCC("-Wattributes")
void lexer::skip_whitespace() {
const char8* input = this->input_;
Expand Down
3 changes: 3 additions & 0 deletions test/test-simd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <quick-lint-js/char8.h>
#include <quick-lint-js/have.h>
#include <quick-lint-js/simd.h>
#include <quick-lint-js/warning.h>

#if QLJS_HAVE_ARM_NEON
#include <arm_neon.h>
Expand All @@ -17,6 +18,8 @@
#include <emmintrin.h>
#endif

QLJS_WARNING_IGNORE_CLANG("-Wconditional-uninitialized")

namespace quick_lint_js {
namespace {
#if QLJS_HAVE_X86_SSE2
Expand Down

0 comments on commit df34a98

Please sign in to comment.