fixed additional warnings

This commit is contained in:
Sergiu Deitsch 2021-08-01 14:52:03 +02:00
parent f8c8e99fdf
commit 92cb3c449b
3 changed files with 7 additions and 7 deletions

View File

@ -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}"

View File

@ -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-') }}

View File

@ -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;
}
@ -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)
@ -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) {
@ -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);
}