Skip to content

Commit

Permalink
clang: upgrade to clang-19 & related due to F41 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ajay committed Jan 18, 2025
1 parent 47cbe52 commit f9b3d83
Show file tree
Hide file tree
Showing 23 changed files with 70 additions and 32 deletions.
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include tools/makefiles/subdir/makefile

################################################################################

CXX_FORMATTER = $(shell command -v clang-format-18 &> /dev/null && echo "clang-format-18" || echo "clang-format")
CXX_FORMATTER = $(shell command -v clang-format-19 &> /dev/null && echo "clang-format-19" || echo "clang-format")

CXX_FORMATTER_FLAGS += --style='{BasedOnStyle: Chromium, ColumnLimit: 100, SortIncludes: true}'
CXX_FORMATTER_FLAGS += --Werror
Expand Down
2 changes: 1 addition & 1 deletion src/2015/01/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <sys/types.h>

#include <fmt/core.h>
#include <fmt/format.h>

#include "lib/io.h"
#include "lib/run.h"
Expand Down
2 changes: 1 addition & 1 deletion src/2023/02/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <sys/types.h>

#include <fmt/core.h>
#include <fmt/core.h> // IWYU pragma: keep
#include <fmt/format.h>

#include "lib/io.h"
Expand Down
1 change: 1 addition & 0 deletions src/2023/03/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <cctype>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <optional>
#include <string>
#include <utility>
Expand Down
1 change: 0 additions & 1 deletion src/2023/06/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <utility>
#include <vector>

#include <fmt/core.h>
#include <fmt/format.h>

#include "lib/io.h"
Expand Down
7 changes: 5 additions & 2 deletions src/2023/11/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@

#include <sys/types.h>

#include <fmt/core.h>
#include <fmt/format.h>
#if defined __has_include && __has_include("fmt/base.h")
#include <fmt/base.h>
#endif
#include <fmt/core.h> // IWYU pragma: keep
#include <fmt/ranges.h>

#include "lib/io.h"
#include "lib/parse.h"
Expand Down
4 changes: 3 additions & 1 deletion src/2023/12/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#include <utility>
#include <vector>

#include <fmt/core.h>
#if defined __has_include && __has_include("fmt/base.h")
#include <fmt/base.h>
#endif
#include <fmt/format.h>

#include "lib/io.h"
Expand Down
6 changes: 5 additions & 1 deletion src/2023/14/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <iterator>
#include <map>
#include <string>
#include <utility>
#include <vector>

#include <fmt/core.h>
#if defined __has_include && __has_include("fmt/base.h")
#include <fmt/base.h>
#endif
#include <fmt/format.h>
#include <fmt/ranges.h>

#include "lib/io.h"
#include "lib/parse.h"
Expand Down
1 change: 1 addition & 0 deletions src/2023/15/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <numeric>
#include <string>
#include <string_view>
Expand Down
5 changes: 4 additions & 1 deletion src/2023/16/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
#include <utility>
#include <vector>

#include <fmt/core.h>
#if defined __has_include && __has_include("fmt/base.h")
#include <fmt/base.h>
#endif
#include <fmt/core.h> // IWYU pragma: keep

#include "lib/io.h"
#include "lib/parse.h"
Expand Down
2 changes: 1 addition & 1 deletion src/2024/01/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <numeric>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

#include <bits/std_abs.h>
#include <sys/types.h>

// #include <fmt/core.h>
Expand Down
2 changes: 1 addition & 1 deletion src/2024/02/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// adventofcode.com/2024/day/2

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <iterator>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

#include <bits/std_abs.h>
#include <sys/types.h>

// #include <fmt/core.h>
Expand Down
2 changes: 1 addition & 1 deletion src/2024/15/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <utility>
#include <vector>

#include <fmt/core.h>
#include <fmt/format.h>

#include "lib/io.h"
#include "lib/parse.h"
Expand Down
1 change: 1 addition & 0 deletions src/2024/16/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <cstddef>
#include <deque>
#include <functional>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
Expand Down
7 changes: 6 additions & 1 deletion src/2024/17/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <cstddef>
#include <cstdint>
#include <exception>
#include <execution>
#include <numeric>
#include <stdexcept>
#include <string>
Expand All @@ -17,6 +16,12 @@
#include <boost/iterator/iterator_facade.hpp>
#include <boost/range/irange.hpp>
// #include <fmt/core.h>
#include <pstl/algorithm_impl.h>
#include <pstl/execution_defs.h>
#include <pstl/execution_impl.h>
#include <pstl/glue_algorithm_impl.h>
#include <pstl/glue_execution_defs.h>
#include <pstl/parallel_backend_serial.h>

#include "lib/io.h"
#include "lib/parse.h"
Expand Down
1 change: 1 addition & 0 deletions src/2024/18/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// adventofcode.com/2024/day/18

#include <cstddef>
#include <iterator> // IWYU pragma: keep
#include <limits>
#include <queue>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/2024/21/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <utility>
#include <vector>

#include <fmt/core.h>
#include <fmt/format.h>

#include "lib/io.h"
#include "lib/parse.h"
Expand Down
9 changes: 9 additions & 0 deletions src/lib/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@
#include <boost/algorithm/string/regex.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/core/addressof.hpp>
#include <boost/function/function_base.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <boost/regex/v5/basic_regex.hpp>
#include <boost/regex/v5/pattern_except.hpp>
#include <boost/regex/v5/perl_matcher.hpp>
#include <boost/regex/v5/perl_matcher_common.hpp>
#include <boost/regex/v5/perl_matcher_non_recursive.hpp>
#include <boost/regex/v5/regex_fwd.hpp>
#include <boost/regex/v5/regex_search.hpp>
#include <boost/regex/v5/regex_traits.hpp>
#include <boost/regex/v5/regex_traits_defaults.hpp>

std::vector<std::string> split(std::string&& str,
const std::string& delim,
Expand Down
5 changes: 4 additions & 1 deletion test/tools/makefiles/compile/src/example.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#include <cstddef>
#include <iostream>

#include <fmt/core.h>
#include <boost/lexical_cast.hpp>
#if defined __has_include && __has_include("fmt/base.h")
#include <fmt/base.h>
#endif
#include <fmt/core.h> // IWYU pragma: keep

int main() {
fmt::print("Hello {}!\n", "world");
Expand Down
2 changes: 2 additions & 0 deletions test/tools/makefiles/gtest/src/test_gtest.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "gtest/gtest.h"

#include <string>

TEST(GtestTest, Trivial) {
EXPECT_FALSE(false);
EXPECT_TRUE(true);
Expand Down
2 changes: 2 additions & 0 deletions test/tools/makefiles/gtest/src/test_gtest2.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "gtest/gtest.h"

#include <string>

TEST(GtestTest, SecondFile) {
EXPECT_STRNE("hello", "world");
}
30 changes: 16 additions & 14 deletions tools/deps/os/ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
#!/usr/bin/env bash
set -x -e
sudo apt -y install \
googletest \
libboost-all-dev \
libfmt-dev \
libgtest-dev \
python3 \
sudo apt -y install \
googletest \
libboost-all-dev \
libgtest-dev \
python3 \
python3-pip

wget --directory-prefix /tmp https://apt.llvm.org/llvm.sh
chmod +x /tmp/llvm.sh
sudo /tmp/llvm.sh 18
sudo apt -y install \
clang \
clang-format-18 \
libclang-18-dev \
llvm-18-dev
sudo /tmp/llvm.sh 19
sudo apt -y install \
clang \
clang-format-19 \
libclang-19-dev \
llvm-19-dev

wget --directory-prefix /tmp http://launchpadlibrarian.net/727348130/iwyu_8.22-1_amd64.deb
sudo dpkg -i /tmp/iwyu_8.22-1_amd64.deb
wget --directory-prefix /tmp https://launchpad.net/ubuntu/+archive/primary/+files/iwyu_8.23-1_amd64.deb
sudo dpkg -i /tmp/iwyu_8.23-1_amd64.deb

wget --directory-prefix /tmp https://launchpad.net/ubuntu/+source/fmtlib/10.1.1+ds1-4/+build/29236594/+files/libfmt-dev_10.1.1+ds1-4_amd64.deb
sudo dpkg -i /tmp/libfmt-dev_10.1.1+ds1-4_amd64.deb
6 changes: 3 additions & 3 deletions tools/makefiles/compile/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ endif

################################################################################

CC = clang-18
CXX = clang++-18
CC = clang-19
CXX = clang++-19

CPPFLAGS = -MMD
CPPFLAGS += -Ofast
CPPFLAGS += -O3
CPPFLAGS += -Wall
CPPFLAGS += -Werror
CPPFLAGS += -Weverything
Expand Down

0 comments on commit f9b3d83

Please sign in to comment.