Skip to content

Commit 81fd6b1

Browse files
authored
Fix build (#134)
Fix build
1 parent ce27845 commit 81fd6b1

33 files changed

+107
-64
lines changed

.github/workflows/.aarch64.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
name: Build on aarch64
1616
steps:
1717
- uses: actions/checkout@v2.1.0
18-
- uses: uraimo/run-on-arch-action@v2.1.1
18+
- uses: uraimo/run-on-arch-action@v2.8.1
1919
name: Build artifact
2020
id: build
2121
with:
2222
arch: aarch64
23-
distro: ubuntu20.04
23+
distro: ubuntu22.04
2424

2525
# Not required, but speeds up builds
2626
githubToken: ${{ github.token }}

.github/workflows/.armv6.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: Build on armv6
1616
steps:
1717
- uses: actions/checkout@v2.1.0
18-
- uses: uraimo/run-on-arch-action@v2.1.1
18+
- uses: uraimo/run-on-arch-action@v2.8.1
1919
name: Build artifact
2020
id: build
2121
with:

.github/workflows/.armv7.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: Build on armv7
1616
steps:
1717
- uses: actions/checkout@v2.1.0
18-
- uses: uraimo/run-on-arch-action@v2.1.1
18+
- uses: uraimo/run-on-arch-action@v2.8.1
1919
name: Build artifact
2020
id: build
2121
with:

.github/workflows/.ppc64le.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
name: Build on ppc64le
1616
steps:
1717
- uses: actions/checkout@v2.1.0
18-
- uses: uraimo/run-on-arch-action@v2.1.1
18+
- uses: uraimo/run-on-arch-action@v2.8.1
1919
name: Build artifact
2020
id: build
2121
with:
2222
arch: ppc64le
23-
distro: ubuntu20.04
23+
distro: ubuntu22.04
2424

2525
# Not required, but speeds up builds
2626
githubToken: ${{ github.token }}

.github/workflows/.riscv64.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
name: Build on riscv64
1616
steps:
1717
- uses: actions/checkout@v2.1.0
18-
- uses: uraimo/run-on-arch-action@v2.5.1
18+
- uses: uraimo/run-on-arch-action@v2.8.1
1919
name: Build artifact
2020
id: build
2121
with:
2222
arch: riscv64
23-
distro: ubuntu20.04
23+
distro: ubuntu22.04
2424

2525
# Not required, but speeds up builds
2626
githubToken: ${{ github.token }}

.github/workflows/.s390x.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
name: Build on s390x
1616
steps:
1717
- uses: actions/checkout@v2.1.0
18-
- uses: uraimo/run-on-arch-action@v2.1.1
18+
- uses: uraimo/run-on-arch-action@v2.8.1
1919
name: Build artifact
2020
id: build
2121
with:
2222
arch: s390x
23-
distro: ubuntu20.04
23+
distro: ubuntu22.04
2424

2525
# Not required, but speeds up builds
2626
githubToken: ${{ github.token }}

.github/workflows/.ubuntu.yml

+28-8
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,18 @@ on:
1717

1818
jobs:
1919
ubuntu:
20-
runs-on: ubuntu-20.04
20+
runs-on: ubuntu-22.04
2121
if: |
2222
(github.event_name == 'pull_request') ||
2323
(github.event_name == 'push') ||
2424
(github.event_name == 'workflow_dispatch' ||
2525
(github.event_name == 'schedule' && github.repository == 'tezc/sc')) && !contains(github.event.inputs.skip, 'ubuntu')
2626
name: Build on Ubuntu
27-
28-
strategy:
29-
fail-fast: false
30-
matrix:
31-
compiler: [ gcc, clang ]
3227
steps:
3328
- uses: actions/checkout@v2.1.0
3429
- name: build
3530
env:
36-
CC: ${{ matrix.compiler }}
31+
CC: gcc
3732
run: |
3833
sudo apt update
3934
sudo apt-get install valgrind cmake
@@ -50,6 +45,31 @@ jobs:
5045
make -j
5146
make valgrind
5247
48+
ubuntu-clang:
49+
runs-on: ubuntu-22.04
50+
if: |
51+
(github.event_name == 'pull_request') ||
52+
(github.event_name == 'push') ||
53+
(github.event_name == 'workflow_dispatch' ||
54+
(github.event_name == 'schedule' && github.repository == 'tezc/sc')) && !contains(github.event.inputs.skip, 'ubuntu')
55+
name: Build on Ubuntu
56+
steps:
57+
- uses: actions/checkout@v2.1.0
58+
- name: build
59+
env:
60+
CC: clang
61+
run: |
62+
sudo apt update
63+
sudo apt-get install valgrind cmake
64+
mkdir build-debug && cd build-debug
65+
cmake .. -DSANITIZER=address
66+
make -j
67+
make check
68+
rm -rf *
69+
cmake .. -DSANITIZER=undefined
70+
make -j
71+
make check
72+
5373
ubuntu-gcc-thread:
5474
runs-on: ubuntu-latest
5575
if: |
@@ -145,7 +165,7 @@ jobs:
145165
sudo apt update
146166
sudo apt-get install cmake curl tar wine
147167
mkdir build-debug && cd build-debug
148-
export ZIG=zig-linux-x86_64-0.12.0-dev.1834+f36ac227b
168+
export ZIG=zig-linux-x86_64-0.14.0-dev.3222+8a3aebaee
149169
curl -o zig.tar.xz "https://ziglang.org/builds/$ZIG.tar.xz"
150170
tar -xf zig.tar.xz
151171
export CC="$(pwd)/$ZIG/zig cc -target x86_64-windows"

CMakeLists.txt

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.10)
22
project(sc_lib C)
33
include(CTest)
44
include(CheckCCompilerFlag)
@@ -68,11 +68,12 @@ if (SC_BUILD_TEST)
6868
add_custom_target(coverage)
6969
add_custom_command(
7070
TARGET coverage
71+
POST_BUILD
7172
COMMAND lcov --capture --directory .
72-
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
73+
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert' --ignore-errors unused
7374
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'
74-
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
75-
COMMAND lcov --list coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
75+
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert' --ignore-errors unused
76+
COMMAND lcov --list coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert' --ignore-errors unused
7677
)
7778

7879
# -------------------------- Code Coverage End ------------------------------ #

array/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.10)
22
project(sc_array C)
33

44
set(CMAKE_C_STANDARD 99)
@@ -96,6 +96,7 @@ if (SC_BUILD_TEST)
9696
add_custom_target(coverage_${PROJECT_NAME})
9797
add_custom_command(
9898
TARGET coverage_${PROJECT_NAME}
99+
POST_BUILD
99100
COMMAND lcov --capture --directory .
100101
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
101102
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'

buffer/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.10)
22
project(sc_buf C)
33

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

@@ -95,6 +95,7 @@ if (SC_BUILD_TEST)
9595
add_custom_target(coverage_${PROJECT_NAME})
9696
add_custom_command(
9797
TARGET coverage_${PROJECT_NAME}
98+
POST_BUILD
9899
COMMAND lcov --capture --directory .
99100
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
100101
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'

condition/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.10)
22
project(sc_cond C)
33

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

@@ -96,6 +96,7 @@ if (SC_BUILD_TEST)
9696
add_custom_target(coverage_${PROJECT_NAME})
9797
add_custom_command(
9898
TARGET coverage_${PROJECT_NAME}
99+
POST_BUILD
99100
COMMAND lcov --capture --directory .
100101
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
101102
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'

crc32/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.10)
22
project(sc_crc32 C)
33

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

@@ -113,6 +113,7 @@ if (SC_BUILD_TEST)
113113
add_custom_target(coverage_${PROJECT_NAME})
114114
add_custom_command(
115115
TARGET coverage_${PROJECT_NAME}
116+
POST_BUILD
116117
COMMAND lcov --capture --directory .
117118
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
118119
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'

heap/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.10)
22
project(sc_heap C)
33

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

@@ -94,6 +94,7 @@ if (SC_BUILD_TEST)
9494
add_custom_target(coverage_${PROJECT_NAME})
9595
add_custom_command(
9696
TARGET coverage_${PROJECT_NAME}
97+
POST_BUILD
9798
COMMAND lcov --capture --directory .
9899
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
99100
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'

ini/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.10)
22
project(sc_ini C)
33

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

@@ -93,6 +93,7 @@ if (SC_BUILD_TEST)
9393
add_custom_target(coverage_${PROJECT_NAME})
9494
add_custom_command(
9595
TARGET coverage_${PROJECT_NAME}
96+
POST_BUILD
9697
COMMAND lcov --capture --directory .
9798
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
9899
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'

ini/sc_ini.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,5 +191,5 @@ int sc_ini_parse_file(void *arg, sc_ini_on_item cb, const char *filename)
191191
int sc_ini_parse_string(void *arg, sc_ini_on_item cb, const char *str)
192192
{
193193
char *ptr = (char *) str;
194-
return sc_ini_parse(arg, cb, &ptr, string_line);
194+
return sc_ini_parse(arg, cb, (void*) &ptr, string_line);
195195
}

linked-list/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.10)
22
project(sc_list C)
33

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

@@ -83,6 +83,7 @@ if (SC_BUILD_TEST)
8383
add_custom_target(coverage_${PROJECT_NAME})
8484
add_custom_command(
8585
TARGET coverage_${PROJECT_NAME}
86+
POST_BUILD
8687
COMMAND lcov --capture --directory .
8788
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
8889
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'

logger/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.10)
22
project(sc_log C)
33

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

@@ -96,6 +96,7 @@ if (SC_BUILD_TEST)
9696
add_custom_target(coverage_${PROJECT_NAME})
9797
add_custom_command(
9898
TARGET coverage_${PROJECT_NAME}
99+
POST_BUILD
99100
COMMAND lcov --capture --directory .
100101
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
101102
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'

logger/sc_log.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ static int sc_strcasecmp(const char *a, const char *b)
224224
return 0;
225225
}
226226

227-
if ((n = tolower(*a) - tolower(*b)) != 0) {
227+
n = tolower(*a) - tolower(*b);
228+
if (n != 0) {
228229
return n;
229230
}
230231
}

map/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.10)
22
project(sc_map C)
33

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

@@ -103,6 +103,7 @@ if (SC_BUILD_TEST)
103103
add_custom_target(coverage_${PROJECT_NAME})
104104
add_custom_command(
105105
TARGET coverage_${PROJECT_NAME}
106+
POST_BUILD
106107
COMMAND lcov --capture --directory .
107108
--output-file coverage.info --rc lcov_branch_coverage=1 --rc lcov_excl_br_line='assert'
108109
COMMAND lcov --remove coverage.info '/usr/*' '*example*' '*test*'

0 commit comments

Comments
 (0)