Skip to content

Commit

Permalink
mike-lischke#132 Migrate to C++ 20
Browse files Browse the repository at this point in the history
Signed-off-by: vityaman <vityaman.dev@yandex.ru>
  • Loading branch information
vityaman committed Jul 28, 2024
1 parent e0b116d commit 4f9e0ce
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ jobs:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo add-apt-repository universe
sudo apt update
sudo apt install build-essential
sudo apt install clang
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
Expand All @@ -32,7 +30,7 @@ jobs:
run: |
mkdir build
cd build
CXX=clang++ CC=clang cmake \
cmake \
-DANTLR4C3_DEVELOPER=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
..
Expand Down
2 changes: 1 addition & 1 deletion ports/cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Please see the parent [README.md](../../readme.md) for an explanation of the lib

## Requirements

- [C++ 23 standard](https://en.cppreference.com/w/cpp/23) to compile sources.
- [C++ 20 standard](https://en.cppreference.com/w/cpp/20) to compile sources.

- [ANTLRv4 C++ Runtime](https://github.com/antlr/antlr4/tree/4.13.1/runtime/Cpp) to compile sources.

Expand Down
2 changes: 1 addition & 1 deletion ports/cpp/cmake/CompileOptions.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down
11 changes: 2 additions & 9 deletions ports/cpp/test/cpp14/Cpp14Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,8 @@ TEST(CPP14Parser, SimpleCppExampleWithErrorsInInput) {

TEST(CPP14Parser, RealCppFile) {
{
auto actual = //
std::filesystem::current_path() //
| std::views::reverse //
| std::views::take(5) //
| std::views::reverse //
| std::views::transform([](auto word) { return word.string(); }) //
| std::ranges::to<std::vector>();
std::vector<std::string> expected{"ports", "cpp", "build", "test", "cpp14"};
EXPECT_EQ(actual, expected);
const auto path = std::filesystem::current_path().string();
EXPECT_TRUE(path.ends_with("ports/cpp/build/test/cpp14"));
}

const auto source = [] {
Expand Down
2 changes: 1 addition & 1 deletion ports/cpp/test/whitebox/WhiteboxTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TEST(WhiteboxGrammarTests, CaretAtOneOfMultiplePossibleStates) {
for (const auto index : {4, 5, 6, 7}) {
AntlrPipeline<WhiteboxGrammar> pipeline("LOREM IPSUM ");

auto *ctx = [&] -> antlr4::ParserRuleContext * {
auto *ctx = [&]() -> antlr4::ParserRuleContext * {
switch (index) {
case 4:
return pipeline.parser.test4();
Expand Down

0 comments on commit 4f9e0ce

Please sign in to comment.