Skip to content

Commit ba43604

Browse files
committed
merged with upstream
2 parents d0671b0 + 6ab81da commit ba43604

35 files changed

Lines changed: 1424 additions & 533 deletions

.clang-format

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
IndentWidth: 4
22
TabWidth: 4
3-
ColumnLimit: 121
4-
UseTab: Always
3+
ColumnLimit: 120
4+
UseTab: ForIndentation
55
SortIncludes: true
66
IncludeCategories:
77
- Regex: '^\<.*\>' # stdlib
@@ -16,10 +16,10 @@ IncludeCategories:
1616
MaxEmptyLinesToKeep: 1
1717
SpacesBeforeTrailingComments: 1
1818
# ---
19-
AllowShortEnumsOnASingleLine: true
19+
AllowShortEnumsOnASingleLine: false
2020
AllowShortCaseLabelsOnASingleLine: true
21-
AllowShortIfStatementsOnASingleLine: true
22-
AllowShortBlocksOnASingleLine: true
21+
AllowShortIfStatementsOnASingleLine: false
22+
AllowShortBlocksOnASingleLine: false
2323
AllowAllArgumentsOnNextLine: true
2424
AllowAllParametersOfDeclarationOnNextLine: true
2525
AllowShortFunctionsOnASingleLine: Empty
@@ -30,7 +30,7 @@ AlignConsecutiveAssignments: false
3030
AlignConsecutiveMacros:
3131
Enabled: true
3232
AcrossEmptyLines: false
33-
AcrossComments: true
33+
AcrossComments: false
3434
AlignConsecutiveShortCaseStatements:
3535
Enabled: true
3636
AcrossEmptyLines: false
@@ -70,7 +70,7 @@ SpaceBeforeAssignmentOperators: true
7070
SpaceBeforeCaseColon: false
7171
SpaceBeforeParens: Custom
7272
SpaceBeforeParensOptions:
73-
AfterControlStatements: false
73+
AfterControlStatements: true
7474
AfterForeachMacros: false
7575
AfterFunctionDeclarationName: false
7676
AfterIfMacros: false

.clang-tidy

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Checks: >
2+
readability-*,
3+
modernize-*,
4+
bugprone-*,
5+
misc-*,
6+
google-runtime-int,
7+
-misc-no-recursion,
8+
-readability-magic-numbers,
9+
-clang-analyzer-security.insecureAPI.strcpy,
10+
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
11+
-bugprone-easily-swappable-parameters,
12+
-readability-identifier-length,
13+
-readability-uppercase-literal-suffix,
14+
-misc-include-cleaner,
15+
-bugprone-reserved-identifier
16+
17+
18+
FormatStyle: 'file'
19+
CheckOptions:
20+
# allow for
21+
# if (condition)
22+
# stmt;
23+
- key: readability-braces-around-statements.ShortStatementLines
24+
value: '2'
25+
26+
# use int names from stdbigos/types.h
27+
- key: google-runtime-int.UnsignedTypePrefix
28+
value: 'u'
29+
- key: google-runtime-int.SignedTypePrefix
30+
value: 'i'
31+
- key: google-runtime-int.TypeSuffix
32+
value: ''

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.md -whitespace
2+
docs/ -whitespace

.github/workflows/build.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
CMAKE_BUILD_TYPE: "Release"
1414

1515
jobs:
16-
build-and-test:
16+
build-gcc-and-test:
1717
runs-on: ubuntu-latest
1818

1919
steps:
@@ -27,19 +27,53 @@ jobs:
2727

2828
- name: Install dependencies
2929
run: |
30+
sudo apt-get update
3031
sudo apt-get install -y \
3132
gcc-riscv64-unknown-elf dosfstools e2fsprogs mtools \
3233
qemu-system-misc
3334
3435
- name: Generate, build and test
3536
uses: lukka/run-cmake@v10
3637
with:
37-
configurePreset: 'ci-ninja'
38-
buildPreset: 'ci-ninja'
39-
testPreset: 'ci-ninja'
38+
configurePreset: 'ci-gcc'
39+
buildPreset: 'ci-gcc'
40+
testPreset: 'ci-gcc'
4041

4142
- name: Upload artifacts
4243
uses: actions/upload-artifact@v4
4344
with:
4445
name: build-artifacts
4546
path: build/
47+
48+
build-clang:
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
with:
54+
submodules: true
55+
56+
- uses: lukka/get-cmake@latest
57+
with:
58+
cmakeVersion: '~3.24.0'
59+
60+
- name: Install dependencies
61+
run: |
62+
sudo apt-get update
63+
sudo apt-get install -y \
64+
clang llvm \
65+
iwyu \
66+
gcc-riscv64-unknown-elf dosfstools e2fsprogs mtools \
67+
qemu-system-misc
68+
69+
- name: Generate, build and test
70+
uses: lukka/run-cmake@v10
71+
with:
72+
configurePreset: 'ci-clang'
73+
buildPreset: 'ci-clang'
74+
75+
- name: Upload artifacts
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: build-artifacts-clang
79+
path: build/

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ install/
7272

7373
# CMake info
7474
CMakeUserPresets.json
75+
76+
# Github pages data
77+
site/

CMake/CommonConfig.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function(SETUP_COMMON name)
1616
COMPILE_WARNING_AS_ERROR ${BIGOS_WARNINGS_AS_ERRORS}
1717
)
1818

19-
target_compile_options(${name} PRIVATE -Wall -Wextra -Wno-ignored-qualifiers)
19+
target_compile_options(${name} PRIVATE -Wall -Wextra -Wno-ignored-qualifiers -Wno-unknown-pragmas)
2020
endfunction()
2121

2222
function(SETUP_LIBRARY name)

CMake/Linters.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
set(BIGOS_USE_CLANG_TIDY OFF CACHE BOOL "Check using clang-tidy during build")
2+
set(BIGOS_USE_INCLUDE_WHAT_YOU_USE OFF CACHE BOOL "Check using include-what-you-use during build")
3+
4+
find_program(CLANG_TIDY clang-tidy)
5+
find_program(INCLUDE_WHAT_YOU_USE include-what-you-use)
6+
7+
if (BIGOS_USE_CLANG_TIDY)
8+
set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY})
9+
endif()
10+
11+
if (BIGOS_USE_INCLUDE_WHAT_YOU_USE)
12+
set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${INCLUDE_WHAT_YOU_USE})
13+
endif()

CMake/preset-mixins.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"version": 5,
3+
"configurePresets": [
4+
{
5+
"name": "build-dirs",
6+
"hidden": true,
7+
"binaryDir": "${sourceDir}/build",
8+
"installDir": "${sourceDir}/build/install"
9+
},
10+
{
11+
"name": "cross-gcc",
12+
"hidden": true,
13+
"toolchainFile": "${sourceDir}/CMake/toolchains/riscv64-gcc.cmake"
14+
},
15+
{
16+
"name": "cross-clang",
17+
"hidden": true,
18+
"toolchainFile": "${sourceDir}/CMake/toolchains/riscv64-clang.cmake"
19+
},
20+
{
21+
"name": "compile-commands",
22+
"hidden": true,
23+
"environment": {
24+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
25+
}
26+
},
27+
{
28+
"name": "warnings-as-errors",
29+
"hidden": true,
30+
"cacheVariables": {
31+
"BIGOS_WARNINGS_AS_ERRORS": "ON"
32+
}
33+
},
34+
{
35+
"name": "clang-tidy",
36+
"hidden": true,
37+
"cacheVariables": {
38+
"BIGOS_USE_CLANG_TIDY": "ON"
39+
}
40+
},
41+
{
42+
"name": "include-what-you-use",
43+
"hidden": true,
44+
"cacheVariables": {
45+
"BIGOS_USE_INCLUDE_WHAT_YOU_USE": "ON"
46+
}
47+
},
48+
{
49+
"name": "debug-type",
50+
"hidden": true,
51+
"environment": {
52+
"CMAKE_BUILD_TYPE": "Debug"
53+
}
54+
},
55+
{
56+
"name": "release-type",
57+
"hidden": true,
58+
"environment": {
59+
"CMAKE_BUILD_TYPE": "Release"
60+
}
61+
},
62+
{
63+
"name": "release-size-type",
64+
"hidden": true,
65+
"environment": {
66+
"CMAKE_BUILD_TYPE": "MinSizeRel"
67+
}
68+
},
69+
{
70+
"name": "release-debug-type",
71+
"hidden": true,
72+
"environment": {
73+
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
74+
}
75+
}
76+
]
77+
}

CMake/riscv64-cmake-toolchain.cmake

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
3+
if(RISCV_CLANG_TOOLCHAIN_INCLUDED)
4+
return()
5+
endif()
6+
set(RISCV_CLANG_TOOLCHAIN_INCLUDED TRUE)
7+
8+
include(${CMAKE_CURRENT_LIST_DIR}/riscv64-common.cmake)
9+
10+
set(CMAKE_C_COMPILER clang)

0 commit comments

Comments
 (0)