From patchwork Fri Jul 27 17:26:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 28650 Received: (qmail 51500 invoked by alias); 27 Jul 2018 17:26:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 51443 invoked by uid 89); 27 Jul 2018 17:26:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=forwards, exhibit X-HELO: gateway31.websitewelcome.com Received: from gateway31.websitewelcome.com (HELO gateway31.websitewelcome.com) (192.185.143.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Jul 2018 17:26:22 +0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway31.websitewelcome.com (Postfix) with ESMTP id A114F4D4CF6 for ; Fri, 27 Jul 2018 12:26:20 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id j6V9fHiu3bXuJj6VJfNwWk; Fri, 27 Jul 2018 12:26:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2CIDv/0hxxfP2DS+e3oDQykh8AAHW7QLKcZDYZzEJbs=; b=xWC1pIwcoKhc5Zp7XdIhQ+VGVA S7XdyWmM99BqNFaivZsODXvyNVsBMvkt6uGDKh/EapckCnxp38FrU1TJPxpq/mpZqU+OTzTILmnXD Qkc7dLQM5T6oeEA+KNkwg1NEm; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:50616 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fj6V9-003MVN-8f; Fri, 27 Jul 2018 12:26:03 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 3/3] Use unsigned as base type for some enums Date: Fri, 27 Jul 2018 11:26:00 -0600 Message-Id: <20180727172600.15994-4-tom@tromey.com> In-Reply-To: <20180727172600.15994-1-tom@tromey.com> References: <20180727172600.15994-1-tom@tromey.com> -fsanitize=undefined complains about using operator~ on various enum types that are used with DEF_ENUM_FLAGS_TYPE. This patch fixes these problems by explicitly setting the base type for these enums to unsigned. gdb/ChangeLog 2018-07-27 Tom Tromey * symfile-add-flags.h (enum symfile_add_flag): Use unsigned as base type. * objfile-flags.h (enum objfile_flag): Use unsigned as base type. * gdbtypes.h (enum type_instance_flag_value): Use unsigned as base type. * c-lang.h (enum c_string_type_values): Use unsigned as base type. * btrace.h (enum btrace_thread_flag): Use unsigned as base type. --- gdb/ChangeLog | 11 +++++++++++ gdb/btrace.h | 2 +- gdb/c-lang.h | 2 +- gdb/gdbtypes.h | 2 +- gdb/objfile-flags.h | 2 +- gdb/symfile-add-flags.h | 2 +- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gdb/btrace.h b/gdb/btrace.h index bfb0b9f2787..0448bd6d498 100644 --- a/gdb/btrace.h +++ b/gdb/btrace.h @@ -228,7 +228,7 @@ struct btrace_call_history }; /* Branch trace thread flags. */ -enum btrace_thread_flag +enum btrace_thread_flag : unsigned { /* The thread is to be stepped forwards. */ BTHR_STEP = (1 << 0), diff --git a/gdb/c-lang.h b/gdb/c-lang.h index e961826407e..822b4b8aa19 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -35,7 +35,7 @@ struct parser_state; /* The various kinds of C string and character. Note that these values are chosen so that they may be or'd together in certain ways. */ -enum c_string_type_values +enum c_string_type_values : unsigned { /* An ordinary string: "value". */ C_STRING = 0, diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 14059ab3dc5..f7ea2ac6df5 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -192,7 +192,7 @@ enum type_code /* * Some bits for the type's instance_flags word. See the macros below for documentation on each bit. */ -enum type_instance_flag_value +enum type_instance_flag_value : unsigned { TYPE_INSTANCE_FLAG_CONST = (1 << 0), TYPE_INSTANCE_FLAG_VOLATILE = (1 << 1), diff --git a/gdb/objfile-flags.h b/gdb/objfile-flags.h index aeaa8fbc04d..6f5760d021d 100644 --- a/gdb/objfile-flags.h +++ b/gdb/objfile-flags.h @@ -25,7 +25,7 @@ /* Defines for the objfile flags field. Defined in a separate file to break circular header dependencies. */ -enum objfile_flag +enum objfile_flag : unsigned { /* When an object file has its functions reordered (currently Irix-5.2 shared libraries exhibit this behaviour), we will need diff --git a/gdb/symfile-add-flags.h b/gdb/symfile-add-flags.h index 3c07513e395..35241fe4a04 100644 --- a/gdb/symfile-add-flags.h +++ b/gdb/symfile-add-flags.h @@ -26,7 +26,7 @@ symbol_file_add, etc. Defined in a separate file to break circular header dependencies. */ -enum symfile_add_flag +enum symfile_add_flag : unsigned { /* Be chatty about what you are doing. */ SYMFILE_VERBOSE = 1 << 1,