This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Only ignore -Wenum-compare-switch if it exists
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Sat, 30 Dec 2017 23:57:19 -0500
- Subject: [binutils-gdb] Only ignore -Wenum-compare-switch if it exists
- Authentication-results: sourceware.org; auth=none
*** TEST RESULTS FOR COMMIT cfa27c399ec9236a100ef794505d35f60da41a6d ***
Author: Simon Marchi <simon.marchi@ericsson.com>
Branch: master
Commit: cfa27c399ec9236a100ef794505d35f60da41a6d
Only ignore -Wenum-compare-switch if it exists
My patch
dwarf2read: Silence -Wenum-compare-switch warning
132448f8359a268f34f074b0908b5255b568da06
made some parts of dwarf2read.c ignore warnings about switch using enums
of different kinds. What I did not realize was that older Clang
versions (prior to 6) did not have that warning, and therefore give this
error:
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:24187:7: error: unknown warning group '-Wenum-compare-switch', ignored [-Werror,-Wunknown-pragmas]
DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
^
/home/emaisin/src/binutils-gdb/gdb/common/diagnostics.h:42:3: note: expanded from macro 'DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES'
DIAGNOSTIC_IGNORE ("-Wenum-compare-switch")
^
/home/emaisin/src/binutils-gdb/gdb/common/diagnostics.h:27:3: note: expanded from macro 'DIAGNOSTIC_IGNORE'
_Pragma (STRINGIFY (GCC diagnostic ignored option))
^
<scratch space>:10:25: note: expanded from here
GCC diagnostic ignored "-Wenum-compare-switch"
^
Clang has a way to test if it knows about a particular warning. This
patch uses that feature to only define
DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES to something if the
warning is recognized by the Clang version being used. I tested
building dwarf2read.c with clang 4, 5, 6, as well as gcc.
gdb/ChangeLog:
* common/diagnostics.h
(DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES): Only
define if the compiler knows about -Wenum-compare-switch.
- Follow-Ups:
- Failures on Fedora-x86_64-native-gdbserver-m32, branch master
- Failures on Fedora-i686, branch master
- Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, branch master
- Failures on Fedora-x86_64-native-extended-gdbserver-m64, branch master
- Failures on Fedora-x86_64-m64, branch master
- Failures on Fedora-x86_64-native-gdbserver-m64, branch master
- Failures on Ubuntu-AArch32-native-gdbserver-m32, branch master
- Failures on Fedora-x86_64-cc-with-index, branch master
- Failures on Ubuntu-AArch32-m32, branch master
- Failures on Fedora-x86_64-m32, branch master
- Failures on Ubuntu-AArch64-m64, branch master