Skip to content

Commit

Permalink
Add more GCC & Clang versions to use in GitHub Actions workflows (#436)
Browse files Browse the repository at this point in the history
* added g++4.8, 5, 6 for CI

* updated clang versions to use in ci

* updated the supported compilers list
  • Loading branch information
fktn-k authored Nov 30, 2024
1 parent a3ada06 commit 4bfe1b3
Show file tree
Hide file tree
Showing 13 changed files with 184 additions and 99 deletions.
59 changes: 58 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [ "3.5", "3.6", "3.7", "3.8", "3.9", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", latest ]
compiler: [ "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19" ]
build_type: [ Debug, Release ]
container: silkeh/clang:${{matrix.compiler}}

Expand Down Expand Up @@ -270,6 +270,63 @@ jobs:
cd ${{github.workspace}}/build
ctest -C ${{matrix.build_type}} --output-on-failure -j ${{env.JOBS}}
ci_test_older_gcc_versions:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
build_type: [ Debug, Release ]
gcc_ver: [ '4.8', '5', '6' ]

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: add repository commonly needed to install GCC
run: |
sudo apt-get update
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
- name: add repository for GCC 4.8 or 5
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
sudo apt-get update
# for g++-4.8, g++-5
sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu/ xenial main'
sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu/ xenial universe'
sudo apt-get update
if: ${{ matrix.gcc_ver == '4.8' || matrix.gcc_ver == '5' }}

- name: add repository for GCC 6
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
sudo apt-get update
# for g++-6
sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu/ bionic main'
sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu/ bionic universe'
sudo apt-get update
if: ${{ matrix.gcc_ver == '6' }}

- name: install GCC
run: sudo apt-get install --no-install-recommends -y g++-${{matrix.gcc_ver}}

- name: Configure CMake
run: CXX=g++-${{matrix.gcc_ver}} cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DFK_YAML_BUILD_TEST=ON

- name: Build & Test
run: |
cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j ${{env.JOBS}}
cd ${{github.workspace}}/build
ctest -C ${{matrix.build_type}} --output-on-failure -j ${{env.JOBS}}
ci_test_icpx:
runs-on: ubuntu-latest
strategy:
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Currently, the following compilers are known to work and used in GitHub Actions
| AppleClang 15.0.0.15000100 | [macOS 14](https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md) |
| AppleClang 15.0.0.15000309 | [macOS 14](https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md) |
| AppleClang 16.0.0.16000026 | [macOS 15](https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md) |
| Clang 3.4.2 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 3.5.2 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 3.6.2 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 3.7.1 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
Expand All @@ -117,14 +118,18 @@ Currently, the following compilers are known to work and used in GitHub Actions
| Clang 16.0.6 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 17.0.6 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 18.1.6 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 19.1.4 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 4.8.5 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 5.3.1 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 6.4.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 7.5.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 8.5.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 9.5.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 10.5.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 11.4.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 12.3.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 13.3.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 14.1.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 14.2.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| IntelLLVM 2024.1.2 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| MinGW-64 8.1.0 | [Windows Server 2019](https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md) |
| MinGW-64 12.2.0 | [Windows Server 2022](https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md) |
Expand Down
7 changes: 6 additions & 1 deletion docs/mkdocs/docs/home/supported_compilers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Currently, the following compilers are known to work and used in GitHub Actions
| AppleClang 15.0.0.15000100 | [macOS 14](https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md) |
| AppleClang 15.0.0.15000309 | [macOS 14](https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md) |
| AppleClang 16.0.0.16000026 | [macOS 15](https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md) |
| Clang 3.4.2 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 3.5.2 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 3.6.2 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 3.7.1 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
Expand All @@ -31,14 +32,18 @@ Currently, the following compilers are known to work and used in GitHub Actions
| Clang 16.0.6 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 17.0.6 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 18.1.6 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| Clang 19.1.4 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 4.8.5 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 5.3.1 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 6.4.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 7.5.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 8.5.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 9.5.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 10.5.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 11.4.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 12.3.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 13.3.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 14.1.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| GCC 14.2.0 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| IntelLLVM 2024.1.2 | [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md) |
| MinGW-64 8.1.0 | [Windows Server 2019](https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md) |
| MinGW-64 12.2.0 | [Windows Server 2022](https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md) |
Expand Down
15 changes: 10 additions & 5 deletions include/fkYAML/detail/encodings/utf_encode_detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ struct utf_encode_detector<ItrType, enable_if_t<is_iterator_of<ItrType, char>::v
return utf_encode_t::UTF_8;
}

std::array<uint8_t, 4> bytes {};
// the inner curly braces are necessary for older compilers
std::array<uint8_t, 4> bytes {{}};
bytes.fill(0xFFu);
for (int i = 0; i < 4 && begin + i != end; i++) {
bytes[i] = static_cast<uint8_t>(begin[i]); // NOLINT(cppcoreguidelines-pro-bounds-constant-array-index)
Expand Down Expand Up @@ -182,7 +183,8 @@ struct utf_encode_detector<ItrType, enable_if_t<is_iterator_of<ItrType, char16_t
return utf_encode_t::UTF_16BE;
}

std::array<uint8_t, 4> bytes {};
// the inner curly braces are necessary for older compilers
std::array<uint8_t, 4> bytes {{}};
bytes.fill(0xFFu);
for (int i = 0; i < 2 && begin + i != end; i++) {
// NOLINTBEGIN(cppcoreguidelines-pro-bounds-constant-array-index)
Expand Down Expand Up @@ -222,7 +224,8 @@ struct utf_encode_detector<ItrType, enable_if_t<is_iterator_of<ItrType, char32_t
return utf_encode_t::UTF_32BE;
}

std::array<uint8_t, 4> bytes {};
// the inner curly braces are necessary for older compilers
std::array<uint8_t, 4> bytes {{}};
const char32_t elem = *begin;
bytes[0] = static_cast<uint8_t>((elem & 0xFF000000u) >> 24);
bytes[1] = static_cast<uint8_t>((elem & 0x00FF0000u) >> 16);
Expand Down Expand Up @@ -251,7 +254,8 @@ struct file_utf_encode_detector {
/// @param p_file The input file handle.
/// @return A detected encoding type.
static utf_encode_t detect(std::FILE* p_file) noexcept {
std::array<uint8_t, 4> bytes {};
// the inner curly braces are necessary for older compilers
std::array<uint8_t, 4> bytes {{}};
bytes.fill(0xFFu);
for (int i = 0; i < 4; i++) {
char byte = 0;
Expand Down Expand Up @@ -294,7 +298,8 @@ struct stream_utf_encode_detector {
/// @param p_file The input file handle.
/// @return A detected encoding type.
static utf_encode_t detect(std::istream& is) noexcept {
std::array<uint8_t, 4> bytes {};
// the inner curly braces are necessary for older compilers
std::array<uint8_t, 4> bytes {{}};
bytes.fill(0xFFu);
for (int i = 0; i < 4; i++) {
char ch = 0;
Expand Down
3 changes: 2 additions & 1 deletion include/fkYAML/detail/encodings/yaml_escaper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ class yaml_escaper {
}

static void unescape_escaped_unicode(char32_t codepoint, std::string& buff) {
std::array<uint8_t, 4> encode_buff {};
// the inner curly braces are necessary to build with older compilers.
std::array<uint8_t, 4> encode_buff {{}};
uint32_t encoded_size {0};
utf8::from_utf32(codepoint, encode_buff, encoded_size);
buff.append(reinterpret_cast<char*>(encode_buff.data()), encoded_size);
Expand Down
6 changes: 3 additions & 3 deletions include/fkYAML/detail/input/lexical_analyzer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ class lexical_analyzer {
void determine_plain_scalar_range(str_view& token) {
const str_view sv {m_token_begin_itr, m_end_itr};

constexpr str_view filter = "\n :{}[],";
constexpr str_view filter {"\n :{}[],"};
std::size_t pos = sv.find_first_of(filter);
if FK_YAML_UNLIKELY (pos == str_view::npos) {
token = sv;
Expand All @@ -831,7 +831,7 @@ class lexical_analyzer {
indent = get_current_indent_level(&sv[pos]);
}

constexpr str_view space_filter = " \t\n";
constexpr str_view space_filter {" \t\n"};
const std::size_t non_space_pos = sv.find_first_not_of(space_filter, pos);
const std::size_t last_newline_pos = sv.find_last_of('\n', non_space_pos);
FK_YAML_ASSERT(last_newline_pos != str_view::npos);
Expand Down Expand Up @@ -1112,7 +1112,7 @@ class lexical_analyzer {
/// @param indent A variable to store the retrieved indent size.
/// @return Block scalar header information converted from the header line.
block_scalar_header convert_to_block_scalar_header(str_view line) {
constexpr str_view comment_prefix = " #";
constexpr str_view comment_prefix {" #"};
const std::size_t comment_begin_pos = line.find(comment_prefix);
if (comment_begin_pos != str_view::npos) {
line = line.substr(0, comment_begin_pos);
Expand Down
8 changes: 4 additions & 4 deletions include/fkYAML/detail/input/scalar_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class scalar_parser {
scalar_parser& operator=(const scalar_parser&) = default;

scalar_parser(scalar_parser&&) noexcept = default;
scalar_parser& operator=(scalar_parser&&) noexcept = default;
scalar_parser& operator=(scalar_parser&&) noexcept(std::is_nothrow_move_assignable<std::string>::value) = default;

/// @brief Parses a token into a flow scalar (either plain, single quoted or double quoted)
/// @param lex_type Lexical token type for the scalar.
Expand Down Expand Up @@ -160,7 +160,7 @@ class scalar_parser {
return token;
}

constexpr str_view filter = "\'\n";
constexpr str_view filter {"\'\n"};
std::size_t pos = token.find_first_of(filter);
if (pos == str_view::npos) {
return token;
Expand Down Expand Up @@ -204,7 +204,7 @@ class scalar_parser {
return token;
}

constexpr str_view filter = "\\\n";
constexpr str_view filter {"\\\n"};
std::size_t pos = token.find_first_of(filter);
if (pos == str_view::npos) {
return token;
Expand Down Expand Up @@ -311,7 +311,7 @@ class scalar_parser {
m_use_owned_buffer = true;
m_buffer.reserve(token.size());

constexpr str_view white_space_filter = " \t";
constexpr str_view white_space_filter {" \t"};

std::size_t cur_line_begin_pos = 0;
bool has_newline_at_end = true;
Expand Down
4 changes: 2 additions & 2 deletions include/fkYAML/detail/input/tag_resolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

FK_YAML_DETAIL_NAMESPACE_BEGIN

static constexpr str_view default_primary_handle_prefix = "!";
static constexpr str_view default_secondary_handle_prefix = "tag:yaml.org,2002:";
static constexpr str_view default_primary_handle_prefix {"!"};
static constexpr str_view default_secondary_handle_prefix {"tag:yaml.org,2002:"};

template <typename BasicNodeType>
class tag_resolver {
Expand Down
4 changes: 2 additions & 2 deletions include/fkYAML/detail/node_property.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ FK_YAML_DETAIL_NAMESPACE_BEGIN

struct node_property {
/// The tag name property.
std::string tag;
std::string tag {}; // NOLINT(readability-redundant-member-init) necessary for older compilers
/// The anchor name property.
std::string anchor;
std::string anchor {}; // NOLINT(readability-redundant-member-init) necessary for older compilers
};

FK_YAML_DETAIL_NAMESPACE_END
Expand Down
6 changes: 4 additions & 2 deletions include/fkYAML/detail/str_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ class basic_str_view {
template <
typename CharPtrT,
enable_if_t<
disjunction<std::is_same<CharPtrT, value_type*>, std::is_same<CharPtrT, const value_type*>>::value, int> =
0>
conjunction<
negation<std::is_array<CharPtrT>>, std::is_pointer<CharPtrT>,
disjunction<std::is_same<CharPtrT, value_type*>, std::is_same<CharPtrT, const value_type*>>>::value,
int> = 0>
FK_YAML_CXX17_CONSTEXPR basic_str_view(CharPtrT p_str) noexcept
: m_len(traits_type::length(p_str)),
mp_str(p_str) {
Expand Down
Loading

0 comments on commit 4bfe1b3

Please sign in to comment.