Skip to content

Commit

Permalink
Fix the code for clang-11 (#16)
Browse files Browse the repository at this point in the history
This PR fixes #15 as well as adding clang-11 to the CI to avoid similar issues in the future.
  • Loading branch information
0vercl0k authored Jan 16, 2021
1 parent ce69a3f commit 3bec915
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/kdmp-parser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ name: Builds
on: [push, pull_request]

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

name: Ubuntu 20.04 - Py${{ matrix.pyver }}
name: Ubuntu 20.04 - Py${{ matrix.pyver }} / ${{ matrix.compiler }}
runs-on: ubuntu-20.04
steps:
- name: Checkout
Expand All @@ -27,10 +28,22 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt install -y g++-multilib ninja-build
sudo apt install -y g++-10-multilib g++-10 ninja-build
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
- name: Build
- name: Build with gcc
if: matrix.compiler == 'gcc'
run: python3 builder.py --run-tests
env:
CC: gcc-10
CXX: g++-10

- name: Build with clang
if: matrix.compiler == 'clang'
run: python3 builder.py --run-tests
env:
CC: clang-11
CXX: clang++-11

- name: Upload artifacts for rel/x64
uses: actions/upload-artifact@v2
Expand Down
6 changes: 3 additions & 3 deletions src/lib/kdmp-parser-structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ enum class DumpType_t : uint32_t { FullDump = 1, KernelDump = 2, BMPDump = 5 };
// returns the offset of Field in the object via pointer arithmetic.
//

constexpr uint64_t OffsetFromThis(const void *This, const void *Field) {
constexpr uint64_t OffsetFromThis(const uintptr_t This, const uintptr_t Field) {
return uint64_t(Field) - uint64_t(This);
}

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

//
Expand Down

0 comments on commit 3bec915

Please sign in to comment.