diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/unittests/enum-flags-selftests.c | 24 | ||||
-rw-r--r-- | gdbsupport/ChangeLog | 5 | ||||
-rw-r--r-- | gdbsupport/valid-expr.h | 8 |
4 files changed, 33 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fcfa751..28e34fb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-09-29 Pedro Alves <pedro@palves.net> + + * unittests/enum-flags-selftests.c: Check whether __GNUC__ is + defined before using '#pragma GCC diagnostic' instead of checking + __clang__. + 2020-09-28 Tom Tromey <tom@tromey.com> * infrun.c (displaced_step_fixup, thread_still_needs_step_over) diff --git a/gdb/unittests/enum-flags-selftests.c b/gdb/unittests/enum-flags-selftests.c index af585f0..5455120 100644 --- a/gdb/unittests/enum-flags-selftests.c +++ b/gdb/unittests/enum-flags-selftests.c @@ -315,18 +315,28 @@ CHECK_VALID (false, void, EF () != EF2 ()) CHECK_VALID (false, void, EF () != RE2 ()) CHECK_VALID (false, void, RE () != EF2 ()) -/* On clang, disable -Wenum-compare due to "error: comparison of two - values with different enumeration types [-Werror,-Wenum-compare]". - clang doesn't suppress -Wenum-compare in SFINAE contexts. Not a - big deal since misuses like these in GDB will be caught by -Werror - anyway. This check is here mainly for completeness. */ -#if defined __clang__ +/* Disable -Wenum-compare due to: + + Clang: + + "error: comparison of two values with different enumeration types + [-Werror,-Wenum-compare]" + + GCC: + + "error: comparison between ‘enum selftests::enum_flags_tests::RE’ + and ‘enum selftests::enum_flags_tests::RE2’ + [-Werror=enum-compare]" + + Not a big deal since misuses like these in GDB will be caught by + -Werror anyway. This check is here mainly for completeness. */ +#if defined __GNUC__ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wenum-compare" #endif CHECK_VALID (true, bool, RE () == RE2 ()) CHECK_VALID (true, bool, RE () != RE2 ()) -#if defined __clang__ +#if defined __GNUC__ # pragma GCC diagnostic pop #endif diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog index a2f563c..91435ff 100644 --- a/gdbsupport/ChangeLog +++ b/gdbsupport/ChangeLog @@ -1,3 +1,8 @@ +2020-09-29 Pedro Alves <pedro@palves.net> + + * valid-expr.h (CHECK_VALID_EXPR_INT): Make archetype a template + class instead of an alias template and adjust static_assert. + 2020-09-24 Simon Marchi <simon.marchi@efficios.com> * event-loop.c (struct file_handler): Remove typedef, re-format. diff --git a/gdbsupport/valid-expr.h b/gdbsupport/valid-expr.h index 459de17..ff5b8f5 100644 --- a/gdbsupport/valid-expr.h +++ b/gdbsupport/valid-expr.h @@ -58,10 +58,12 @@ #define CHECK_VALID_EXPR_INT(TYPENAMES, TYPES, VALID, EXPR_TYPE, EXPR) \ namespace CONCAT (check_valid_expr, __LINE__) { \ \ - template <TYPENAMES> \ - using archetype = decltype (EXPR); \ + template <TYPENAMES, typename = decltype (EXPR)> \ + struct archetype \ + { \ + }; \ \ - static_assert (gdb::is_detected_exact<EXPR_TYPE, \ + static_assert (gdb::is_detected_exact<archetype<TYPES, EXPR_TYPE>, \ archetype, TYPES>::value == VALID, \ ""); \ } /* namespace */ |