Merge pull request #694 from google/more-warnings
fixed additional warnings
This commit is contained in:
commit
a063a04ecf
2
.github/workflows/macos-builds.yml
vendored
2
.github/workflows/macos-builds.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
- name: Configure
|
- name: Configure
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
CXXFLAGS: -Wall -Wextra -Wsign-conversion -Werror
|
CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Werror
|
||||||
run: |
|
run: |
|
||||||
if [[ ${{matrix.std}} == 98 ]]; then
|
if [[ ${{matrix.std}} == 98 ]]; then
|
||||||
export CXXFLAGS="-Werror=c++11-extensions ${CXXFLAGS}"
|
export CXXFLAGS="-Werror=c++11-extensions ${CXXFLAGS}"
|
||||||
|
|||||||
2
.github/workflows/windows-builds.yml
vendored
2
.github/workflows/windows-builds.yml
vendored
@ -102,7 +102,7 @@ jobs:
|
|||||||
if: ${{ startswith(matrix.config.name, 'MinGW-') }}
|
if: ${{ startswith(matrix.config.name, 'MinGW-') }}
|
||||||
shell: powershell
|
shell: powershell
|
||||||
env:
|
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}}
|
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
|
- name: Build MinGW
|
||||||
if: ${{ startswith(matrix.config.name, 'MinGW-') }}
|
if: ${{ startswith(matrix.config.name, 'MinGW-') }}
|
||||||
|
|||||||
@ -233,8 +233,9 @@ bool GetSectionHeaderByName(int fd, const char *name, size_t name_len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ElfW(Shdr) shstrtab;
|
ElfW(Shdr) shstrtab;
|
||||||
size_t shstrtab_offset = (elf_header.e_shoff +
|
size_t shstrtab_offset =
|
||||||
elf_header.e_shentsize * elf_header.e_shstrndx);
|
(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)) {
|
if (!ReadFromOffsetExact(fd, &shstrtab, sizeof(shstrtab), shstrtab_offset)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -670,7 +671,7 @@ OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
|
|||||||
// bytes. Output will be truncated as needed, and a NUL character is always
|
// bytes. Output will be truncated as needed, and a NUL character is always
|
||||||
// appended.
|
// appended.
|
||||||
// NOTE: code from sandbox/linux/seccomp-bpf/demo.cc.
|
// 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.
|
// Make sure we can write at least one NUL byte.
|
||||||
size_t n = 1;
|
size_t n = 1;
|
||||||
if (n > sz)
|
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;
|
char *start = buf;
|
||||||
|
|
||||||
uintptr_t j = i;
|
uintptr_t j = static_cast<uintptr_t>(i);
|
||||||
|
|
||||||
// Handle negative numbers (only for base 10).
|
// Handle negative numbers (only for base 10).
|
||||||
if (i < 0 && base == 10) {
|
if (i < 0 && base == 10) {
|
||||||
@ -943,7 +944,6 @@ _END_GOOGLE_NAMESPACE_
|
|||||||
_START_GOOGLE_NAMESPACE_
|
_START_GOOGLE_NAMESPACE_
|
||||||
|
|
||||||
bool Symbolize(void *pc, char *out, size_t out_size) {
|
bool Symbolize(void *pc, char *out, size_t out_size) {
|
||||||
SAFE_ASSERT(out_size >= 0);
|
|
||||||
return SymbolizeAndDemangle(pc, out, out_size);
|
return SymbolizeAndDemangle(pc, out, out_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user