Skip to content

Commit 3bec915

Browse files
authored
Fix the code for clang-11 (#16)
This PR fixes #15 as well as adding clang-11 to the CI to avoid similar issues in the future.
1 parent ce69a3f commit 3bec915

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

.github/workflows/kdmp-parser.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ name: Builds
44
on: [push, pull_request]
55

66
jobs:
7-
Linux2004Gcc:
7+
Ubuntu2004:
88
strategy:
99
fail-fast: false
1010
matrix:
1111
# Available versions: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
1212
# We don't test below 3.6 because f'strings were implemented in 3.6 and we use them in build scripts, etc.
1313
pyver: ['3.6', '3.7', '3.8', '3.9', '3.x']
14+
compiler: ['clang', 'gcc']
1415

15-
name: Ubuntu 20.04 - Py${{ matrix.pyver }}
16+
name: Ubuntu 20.04 - Py${{ matrix.pyver }} / ${{ matrix.compiler }}
1617
runs-on: ubuntu-20.04
1718
steps:
1819
- name: Checkout
@@ -27,10 +28,22 @@ jobs:
2728
- name: Install dependencies
2829
run: |
2930
sudo apt-get -y update
30-
sudo apt install -y g++-multilib ninja-build
31+
sudo apt install -y g++-10-multilib g++-10 ninja-build
32+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
3133
32-
- name: Build
34+
- name: Build with gcc
35+
if: matrix.compiler == 'gcc'
36+
run: python3 builder.py --run-tests
37+
env:
38+
CC: gcc-10
39+
CXX: g++-10
40+
41+
- name: Build with clang
42+
if: matrix.compiler == 'clang'
3343
run: python3 builder.py --run-tests
44+
env:
45+
CC: clang-11
46+
CXX: clang++-11
3447

3548
- name: Upload artifacts for rel/x64
3649
uses: actions/upload-artifact@v2

src/lib/kdmp-parser-structs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ enum class DumpType_t : uint32_t { FullDump = 1, KernelDump = 2, BMPDump = 5 };
3636
// returns the offset of Field in the object via pointer arithmetic.
3737
//
3838

39-
constexpr uint64_t OffsetFromThis(const void *This, const void *Field) {
39+
constexpr uint64_t OffsetFromThis(const uintptr_t This, const uintptr_t Field) {
4040
return uint64_t(Field) - uint64_t(This);
4141
}
4242

4343
static void DisplayHeader(const uint32_t Prefix, const char *FieldName,
4444
const void *This, const void *Field) {
45-
printf("%*s+0x%04" PRIx64 ": %-25s", Prefix, "", OffsetFromThis(This, Field),
46-
FieldName);
45+
printf("%*s+0x%04" PRIx64 ": %-25s", Prefix, "",
46+
OffsetFromThis(uintptr_t(This), uintptr_t(Field)), FieldName);
4747
}
4848

4949
//

0 commit comments

Comments
 (0)