Skip to content

Commit

Permalink
Merge pull request #694 from google/more-warnings
Browse files Browse the repository at this point in the history
fixed additional warnings
  • Loading branch information
sergiud authored Aug 1, 2021
2 parents f8c8e99 + 92cb3c4 commit a063a04
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Configure
shell: bash
env:
CXXFLAGS: -Wall -Wextra -Wsign-conversion -Werror
CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Werror
run: |
if [[ ${{matrix.std}} == 98 ]]; then
export CXXFLAGS="-Werror=c++11-extensions ${CXXFLAGS}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
if: ${{ startswith(matrix.config.name, 'MinGW-') }}
shell: powershell
env:
CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Werror -Wno-error=variadic-macros -Wno-error=long-long
CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Werror -Wno-error=variadic-macros -Wno-error=long-long
run: cmake -S . -B ${{runner.workspace}}/build_${{matrix.config.name}}_${{matrix.build_type}} -G "${{matrix.config.generator}}" -DCMAKE_CXX_STANDARD=${{matrix.config.std}} -DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
- name: Build MinGW
if: ${{ startswith(matrix.config.name, 'MinGW-') }}
Expand Down
10 changes: 5 additions & 5 deletions src/symbolize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ bool GetSectionHeaderByName(int fd, const char *name, size_t name_len,
}

ElfW(Shdr) shstrtab;
size_t shstrtab_offset = (elf_header.e_shoff +
elf_header.e_shentsize * elf_header.e_shstrndx);
size_t shstrtab_offset =
(elf_header.e_shoff + static_cast<size_t>(elf_header.e_shentsize) *
static_cast<size_t>(elf_header.e_shstrndx));
if (!ReadFromOffsetExact(fd, &shstrtab, sizeof(shstrtab), shstrtab_offset)) {
return false;
}
Expand Down Expand Up @@ -670,7 +671,7 @@ OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
// bytes. Output will be truncated as needed, and a NUL character is always
// appended.
// NOTE: code from sandbox/linux/seccomp-bpf/demo.cc.
static char *itoa_r(uintptr_t i, char *buf, size_t sz, unsigned base, size_t padding) {
static char *itoa_r(intptr_t i, char *buf, size_t sz, unsigned base, size_t padding) {
// Make sure we can write at least one NUL byte.
size_t n = 1;
if (n > sz)
Expand All @@ -683,7 +684,7 @@ static char *itoa_r(uintptr_t i, char *buf, size_t sz, unsigned base, size_t pad

char *start = buf;

uintptr_t j = i;
uintptr_t j = static_cast<uintptr_t>(i);

// Handle negative numbers (only for base 10).
if (i < 0 && base == 10) {
Expand Down Expand Up @@ -943,7 +944,6 @@ _END_GOOGLE_NAMESPACE_
_START_GOOGLE_NAMESPACE_

bool Symbolize(void *pc, char *out, size_t out_size) {
SAFE_ASSERT(out_size >= 0);
return SymbolizeAndDemangle(pc, out, out_size);
}

Expand Down

0 comments on commit a063a04

Please sign in to comment.