From 366d64224f7aebee3f37b9efafd66893baff348c Mon Sep 17 00:00:00 2001 From: Robert Konicar Date: Fri, 12 May 2023 16:13:06 +0200 Subject: [PATCH 1/4] git: Fix compiler matrix. --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73da07d885..526514c60a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: build_linux: strategy: matrix: - compiler: [gcc, clang-16] + compiler: [ {c: gcc, cpp: g++}, {c: clang-16, cpp: clang++-16} ] runs-on: ubuntu-22.04 timeout-minutes: 32 @@ -40,7 +40,8 @@ jobs: uses: devcontainers/ci@v0.2 with: runCmd: | - export CC=${{ matrix.compiler }} + export CC=${{ matrix.compiler.c }} + export CXX=${{ matrix.compiler.cpp }} export TOOLCHAIN=$(pwd)/cmake/lld.toolchain.cmake From d1e375f50d817ed33574a34fdfa2a9bb26f74dbb Mon Sep 17 00:00:00 2001 From: Robert Konicar Date: Tue, 16 May 2023 11:18:59 +0200 Subject: [PATCH 2/4] treewide: Silence gcc warnings. --- lib/vast/Dialect/HighLevel/HighLevelLinkage.cpp | 2 +- lib/vast/Frontend/GenAction.cpp | 1 + lib/vast/Translation/CodeGenDriver.cpp | 2 +- lib/vast/Translation/CodeGenFunction.cpp | 2 +- lib/vast/Translation/CodeGenStmtVisitor.cpp | 1 + lib/vast/Translation/Mangler.cpp | 2 +- tools/vast-repl/vast-repl.cpp | 2 +- 7 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/vast/Dialect/HighLevel/HighLevelLinkage.cpp b/lib/vast/Dialect/HighLevel/HighLevelLinkage.cpp index 20b63d7320..38e8881755 100644 --- a/lib/vast/Dialect/HighLevel/HighLevelLinkage.cpp +++ b/lib/vast/Dialect/HighLevel/HighLevelLinkage.cpp @@ -250,7 +250,7 @@ namespace vast::hl { auto &actx = decl->getASTContext(); auto linkage = actx.GetGVALinkageForFunction(decl); - if (const auto *dtor = clang::dyn_cast< clang::CXXDestructorDecl >(decl)) { + if (/*const auto *dtor =*/ clang::dyn_cast< clang::CXXDestructorDecl >(decl)) { VAST_UNIMPLEMENTED; } diff --git a/lib/vast/Frontend/GenAction.cpp b/lib/vast/Frontend/GenAction.cpp index 668e6ea757..a8b963d61b 100644 --- a/lib/vast/Frontend/GenAction.cpp +++ b/lib/vast/Frontend/GenAction.cpp @@ -183,6 +183,7 @@ namespace vast::cc { case target_dialect::low_level: return "low_level"; case target_dialect::llvm: return "llvm"; } + VAST_UNREACHABLE("Unknown target dialect to string."); } void compile_via_vast(auto mod, mcontext_t *mctx) diff --git a/lib/vast/Translation/CodeGenDriver.cpp b/lib/vast/Translation/CodeGenDriver.cpp index 325c8d5b08..c912d3230d 100644 --- a/lib/vast/Translation/CodeGenDriver.cpp +++ b/lib/vast/Translation/CodeGenDriver.cpp @@ -236,7 +236,7 @@ namespace vast::cg VAST_UNIMPLEMENTED_MSG("codegen for multi version function"); } - if (const auto *method = llvm::dyn_cast< clang::CXXMethodDecl >(decl)) { + if (/*const auto *method =*/ llvm::dyn_cast< clang::CXXMethodDecl >(decl)) { VAST_UNIMPLEMENTED_MSG("cxx methods"); } diff --git a/lib/vast/Translation/CodeGenFunction.cpp b/lib/vast/Translation/CodeGenFunction.cpp index 6532258266..982c677d34 100644 --- a/lib/vast/Translation/CodeGenFunction.cpp +++ b/lib/vast/Translation/CodeGenFunction.cpp @@ -74,7 +74,7 @@ namespace vast::cg bool codegen_driver::may_drop_function_return(qual_type rty) const { // We can't just disard the return value for a record type with a complex // destructor or a non-trivially copyable type. - if (const auto *recorrd_type = rty.getCanonicalType()->getAs< clang::RecordType >()) { + if (/*const auto *record_type =*/ rty.getCanonicalType()->getAs< clang::RecordType >()) { VAST_UNIMPLEMENTED; } diff --git a/lib/vast/Translation/CodeGenStmtVisitor.cpp b/lib/vast/Translation/CodeGenStmtVisitor.cpp index 73603e48e8..c34350cdf9 100644 --- a/lib/vast/Translation/CodeGenStmtVisitor.cpp +++ b/lib/vast/Translation/CodeGenStmtVisitor.cpp @@ -104,6 +104,7 @@ namespace vast::hl case clang::PredefinedExpr::IdentKind::PrettyFunctionNoVirtual : return IdentKind::PrettyFunctionNoVirtual; } + VAST_UNREACHABLE( "unsupported ident kind" ); } } // namespace vast::hl diff --git a/lib/vast/Translation/Mangler.cpp b/lib/vast/Translation/Mangler.cpp index fa6d66e5dc..398f869fd1 100644 --- a/lib/vast/Translation/Mangler.cpp +++ b/lib/vast/Translation/Mangler.cpp @@ -11,7 +11,7 @@ namespace vast::cg // Some ABIs don't have constructor variants. Make sure that base and complete // constructors get mangled the same. - if (const auto *ctor = clang::dyn_cast< clang::CXXConstructorDecl >(canonical.getDecl())) { + if (/*const auto *ctor =*/ clang::dyn_cast< clang::CXXConstructorDecl >(canonical.getDecl())) { VAST_UNIMPLEMENTED_IF(!target_info.getCXXABI().hasConstructorVariants()); } diff --git a/tools/vast-repl/vast-repl.cpp b/tools/vast-repl/vast-repl.cpp index 727e3d705b..9be90c2252 100644 --- a/tools/vast-repl/vast-repl.cpp +++ b/tools/vast-repl/vast-repl.cpp @@ -57,7 +57,7 @@ namespace vast::repl while (!cli.exit()) { std::string cmd; - if (auto quit = linenoise::Readline("> ", cmd)) { + if (linenoise::Readline("> ", cmd)) { break; } From 3b7296d8e5778684cecb8bc77af2d84c8b881bc2 Mon Sep 17 00:00:00 2001 From: Robert Konicar Date: Tue, 16 May 2023 12:31:06 +0200 Subject: [PATCH 3/4] XXX: Try constexpr fix. --- include/vast/repl/command.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vast/repl/command.hpp b/include/vast/repl/command.hpp index fe0798e966..59511240d3 100644 --- a/include/vast/repl/command.hpp +++ b/include/vast/repl/command.hpp @@ -114,7 +114,7 @@ namespace vast::repl } else { using current = typename std::tuple_element< 0, params_storage >::type; - if constexpr (current::param_name == name) { + if constexpr (std::string_view(current::param_name) == name) { return util::head(params).value; } else { return get_param< name >(util::tail(params)); From 2835554303ac8c66393e1d9889cd4e1dd64e2a89 Mon Sep 17 00:00:00 2001 From: Robert Konicar Date: Wed, 24 May 2023 14:09:06 +0200 Subject: [PATCH 4/4] XXX: Relax gcc warnings. --- include/vast/Util/Warnings.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/vast/Util/Warnings.hpp b/include/vast/Util/Warnings.hpp index 543d604b6d..cb40b0845c 100644 --- a/include/vast/Util/Warnings.hpp +++ b/include/vast/Util/Warnings.hpp @@ -21,7 +21,8 @@ #define VAST_GCC_RELAX_WARNINGS \ _Pragma( "GCC diagnostic ignored \"-Wuseless-cast\"" ) \ _Pragma( "GCC diagnostic ignored \"-Wnull-dereference\"" ) \ - _Pragma( "GCC diagnostic ignored \"-Wmaybe-uninitialized\"" ) + _Pragma( "GCC diagnostic ignored \"-Wmaybe-uninitialized\"" ) \ + _Pragma( "GCC diagnostic ignored \"-Wduplicated-branches\"" ) #ifdef __clang__ #define VAST_RELAX_WARNINGS \