Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build #134

Merged
merged 15 commits into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/.aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
name: Build on aarch64
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.1.1
- uses: uraimo/run-on-arch-action@v2.8.1
name: Build artifact
id: build
with:
arch: aarch64
distro: ubuntu20.04
distro: ubuntu22.04

# Not required, but speeds up builds
githubToken: ${{ github.token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/.armv6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Build on armv6
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.1.1
- uses: uraimo/run-on-arch-action@v2.8.1
name: Build artifact
id: build
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/.armv7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Build on armv7
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.1.1
- uses: uraimo/run-on-arch-action@v2.8.1
name: Build artifact
id: build
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/.ppc64le.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
name: Build on ppc64le
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.1.1
- uses: uraimo/run-on-arch-action@v2.8.1
name: Build artifact
id: build
with:
arch: ppc64le
distro: ubuntu20.04
distro: ubuntu22.04

# Not required, but speeds up builds
githubToken: ${{ github.token }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/.riscv64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
name: Build on riscv64
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.5.1
- uses: uraimo/run-on-arch-action@v2.8.1
name: Build artifact
id: build
with:
arch: riscv64
distro: ubuntu20.04
distro: ubuntu22.04

# Not required, but speeds up builds
githubToken: ${{ github.token }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/.s390x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
name: Build on s390x
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.1.1
- uses: uraimo/run-on-arch-action@v2.8.1
name: Build artifact
id: build
with:
arch: s390x
distro: ubuntu20.04
distro: ubuntu22.04

# Not required, but speeds up builds
githubToken: ${{ github.token }}
Expand Down
36 changes: 28 additions & 8 deletions .github/workflows/.ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@ on:

jobs:
ubuntu:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: |
(github.event_name == 'pull_request') ||
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch' ||
(github.event_name == 'schedule' && github.repository == 'tezc/sc')) && !contains(github.event.inputs.skip, 'ubuntu')
name: Build on Ubuntu

strategy:
fail-fast: false
matrix:
compiler: [ gcc, clang ]
steps:
- uses: actions/checkout@v2.1.0
- name: build
env:
CC: ${{ matrix.compiler }}
CC: gcc
run: |
sudo apt update
sudo apt-get install valgrind cmake
Expand All @@ -50,6 +45,31 @@ jobs:
make -j
make valgrind

ubuntu-clang:
runs-on: ubuntu-22.04
if: |
(github.event_name == 'pull_request') ||
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch' ||
(github.event_name == 'schedule' && github.repository == 'tezc/sc')) && !contains(github.event.inputs.skip, 'ubuntu')
name: Build on Ubuntu
steps:
- uses: actions/checkout@v2.1.0
- name: build
env:
CC: clang
run: |
sudo apt update
sudo apt-get install valgrind cmake
mkdir build-debug && cd build-debug
cmake .. -DSANITIZER=address
make -j
make check
rm -rf *
cmake .. -DSANITIZER=undefined
make -j
make check

ubuntu-gcc-thread:
runs-on: ubuntu-latest
if: |
Expand Down Expand Up @@ -145,7 +165,7 @@ jobs:
sudo apt update
sudo apt-get install cmake curl tar wine
mkdir build-debug && cd build-debug
export ZIG=zig-linux-x86_64-0.12.0-dev.1834+f36ac227b
export ZIG=zig-linux-x86_64-0.14.0-dev.3222+8a3aebaee
curl -o zig.tar.xz "https://ziglang.org/builds/$ZIG.tar.xz"
tar -xf zig.tar.xz
export CC="$(pwd)/$ZIG/zig cc -target x86_64-windows"
Expand Down
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.10)
project(sc_lib C)
include(CTest)
include(CheckCCompilerFlag)
Expand Down Expand Up @@ -68,11 +68,12 @@ if (SC_BUILD_TEST)
add_custom_target(coverage)
add_custom_command(
TARGET coverage
POST_BUILD
COMMAND lcov --capture --directory .
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert' --ignore-errors unused
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
COMMAND lcov --list coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert' --ignore-errors unused
COMMAND lcov --list coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert' --ignore-errors unused
)

# -------------------------- Code Coverage End ------------------------------ #
Expand Down
3 changes: 2 additions & 1 deletion array/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.10)
project(sc_array C)

set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -96,6 +96,7 @@ if (SC_BUILD_TEST)
add_custom_target(coverage_${PROJECT_NAME})
add_custom_command(
TARGET coverage_${PROJECT_NAME}
POST_BUILD
COMMAND lcov --capture --directory .
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
Expand Down
5 changes: 3 additions & 2 deletions buffer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.10)
project(sc_buf C)

set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -31,7 +31,7 @@ if (SC_BUILD_TEST)
set(CMAKE_C_CLANG_TIDY
clang-tidy;
-line-filter=[{"name":"${PROJECT_NAME}.h"},{"name":"${PROJECT_NAME}.c"}];
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-easily-swappable-parameters*;
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-easily-swappable-parameters*,-misc-include-cleaner*;
-warnings-as-errors=clang-analyzer-*,misc-*,portability-*,bugprone-*;)
endif ()

Expand Down Expand Up @@ -95,6 +95,7 @@ if (SC_BUILD_TEST)
add_custom_target(coverage_${PROJECT_NAME})
add_custom_command(
TARGET coverage_${PROJECT_NAME}
POST_BUILD
COMMAND lcov --capture --directory .
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
Expand Down
5 changes: 3 additions & 2 deletions condition/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.10)
project(sc_cond C)

set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -31,7 +31,7 @@ if (SC_BUILD_TEST)
set(CMAKE_C_CLANG_TIDY
clang-tidy;
-line-filter=[{"name":"${PROJECT_NAME}.h"},{"name":"${PROJECT_NAME}.c"}];
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-reserved-identifier*;
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-reserved-identifier*,-misc-include-cleaner*;
-warnings-as-errors=clang-analyzer-*,misc-*,portability-*,bugprone-*;)
endif ()

Expand Down Expand Up @@ -96,6 +96,7 @@ if (SC_BUILD_TEST)
add_custom_target(coverage_${PROJECT_NAME})
add_custom_command(
TARGET coverage_${PROJECT_NAME}
POST_BUILD
COMMAND lcov --capture --directory .
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
Expand Down
5 changes: 3 additions & 2 deletions crc32/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.10)
project(sc_crc32 C)

set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -32,7 +32,7 @@ if (SC_BUILD_TEST)
set(CMAKE_C_CLANG_TIDY
clang-tidy;
-line-filter=[{"name":"${PROJECT_NAME}.h"},{"name":"${PROJECT_NAME}.c"}];
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-implicit-widening-of-multiplication-result*;
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-implicit-widening-of-multiplication-result*,-misc-include-cleaner*;
-warnings-as-errors=clang-analyzer-*,misc-*,portability-*,bugprone-*;)
endif ()

Expand Down Expand Up @@ -113,6 +113,7 @@ if (SC_BUILD_TEST)
add_custom_target(coverage_${PROJECT_NAME})
add_custom_command(
TARGET coverage_${PROJECT_NAME}
POST_BUILD
COMMAND lcov --capture --directory .
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
Expand Down
5 changes: 3 additions & 2 deletions heap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.10)
project(sc_heap C)

set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -31,7 +31,7 @@ if (SC_BUILD_TEST)
set(CMAKE_C_CLANG_TIDY
clang-tidy;
-line-filter=[{"name":"${PROJECT_NAME}.h"},{"name":"${PROJECT_NAME}.c"}];
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*;
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-misc-include-cleaner*,-bugprone-assignment-in-if-condition*;
-warnings-as-errors=clang-analyzer-*,misc-*,portability-*,bugprone-*;)
endif ()

Expand Down Expand Up @@ -94,6 +94,7 @@ if (SC_BUILD_TEST)
add_custom_target(coverage_${PROJECT_NAME})
add_custom_command(
TARGET coverage_${PROJECT_NAME}
POST_BUILD
COMMAND lcov --capture --directory .
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
Expand Down
5 changes: 3 additions & 2 deletions ini/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.10)
project(sc_ini C)

set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -31,7 +31,7 @@ if (SC_BUILD_TEST)
set(CMAKE_C_CLANG_TIDY
clang-tidy;
-line-filter=[{"name":"${PROJECT_NAME}.h"},{"name":"${PROJECT_NAME}.c"}];
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*;
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-misc-include-cleaner*,-bugprone-assignment-in-if-condition*;
-warnings-as-errors=clang-analyzer-*,misc-*,portability-*,bugprone-*;)
endif ()

Expand Down Expand Up @@ -93,6 +93,7 @@ if (SC_BUILD_TEST)
add_custom_target(coverage_${PROJECT_NAME})
add_custom_command(
TARGET coverage_${PROJECT_NAME}
POST_BUILD
COMMAND lcov --capture --directory .
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
Expand Down
2 changes: 1 addition & 1 deletion ini/sc_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,5 @@ int sc_ini_parse_file(void *arg, sc_ini_on_item cb, const char *filename)
int sc_ini_parse_string(void *arg, sc_ini_on_item cb, const char *str)
{
char *ptr = (char *) str;
return sc_ini_parse(arg, cb, &ptr, string_line);
return sc_ini_parse(arg, cb, (void*) &ptr, string_line);
}
5 changes: 3 additions & 2 deletions linked-list/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.10)
project(sc_list C)

set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -31,7 +31,7 @@ if (SC_BUILD_TEST)
set(CMAKE_C_CLANG_TIDY
clang-tidy;
-line-filter=[{"name":"${PROJECT_NAME}.h"},{"name":"${PROJECT_NAME}.c"}];
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-easily-swappable-parameters*;
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-easily-swappable-parameters*,-misc-include-cleaner*;
-warnings-as-errors=clang-analyzer-*,misc-*,portability-*,bugprone-*;)
endif ()

Expand Down Expand Up @@ -83,6 +83,7 @@ if (SC_BUILD_TEST)
add_custom_target(coverage_${PROJECT_NAME})
add_custom_command(
TARGET coverage_${PROJECT_NAME}
POST_BUILD
COMMAND lcov --capture --directory .
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
Expand Down
5 changes: 3 additions & 2 deletions logger/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.10)
project(sc_log C)

set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -31,7 +31,7 @@ if (SC_BUILD_TEST)
set(CMAKE_C_CLANG_TIDY
clang-tidy;
-line-filter=[{"name":"${PROJECT_NAME}.h"},{"name":"${PROJECT_NAME}.c"}];
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-easily-swappable-parameters*,-bugprone-reserved-identifier*;
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-easily-swappable-parameters*,-bugprone-reserved-identifier*,-misc-include-cleaner*;
-warnings-as-errors=clang-analyzer-*,misc-*,portability-*,bugprone-*;)
endif ()

Expand Down Expand Up @@ -96,6 +96,7 @@ if (SC_BUILD_TEST)
add_custom_target(coverage_${PROJECT_NAME})
add_custom_command(
TARGET coverage_${PROJECT_NAME}
POST_BUILD
COMMAND lcov --capture --directory .
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
Expand Down
3 changes: 2 additions & 1 deletion logger/sc_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ static int sc_strcasecmp(const char *a, const char *b)
return 0;
}

if ((n = tolower(*a) - tolower(*b)) != 0) {
n = tolower(*a) - tolower(*b);
if (n != 0) {
return n;
}
}
Expand Down
5 changes: 3 additions & 2 deletions map/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.10)
project(sc_map C)

set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -31,7 +31,7 @@ if (SC_BUILD_TEST)
set(CMAKE_C_CLANG_TIDY
clang-tidy;
-line-filter=[{"name":"${PROJECT_NAME}.h"},{"name":"${PROJECT_NAME}.c"}];
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-easily-swappable-parameters*;
-checks=clang-analyzer-*,misc-*,portability-*,bugprone-*,-bugprone-easily-swappable-parameters*,-misc-include-cleaner*;
-warnings-as-errors=clang-analyzer-*,misc-*,portability-*,bugprone-*;)
endif ()

Expand Down Expand Up @@ -103,6 +103,7 @@ if (SC_BUILD_TEST)
add_custom_target(coverage_${PROJECT_NAME})
add_custom_command(
TARGET coverage_${PROJECT_NAME}
POST_BUILD
COMMAND lcov --capture --directory .
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
Expand Down
Loading
Loading