From patchwork Tue Aug 4 12:06:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Camuso X-Patchwork-Id: 6937751 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2D2B79F373 for ; Tue, 4 Aug 2015 12:06:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 935DC2039E for ; Tue, 4 Aug 2015 12:06:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7EFB520480 for ; Tue, 4 Aug 2015 12:06:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933780AbbHDMGh (ORCPT ); Tue, 4 Aug 2015 08:06:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55043 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933307AbbHDMGf (ORCPT ); Tue, 4 Aug 2015 08:06:35 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id A1CFA8CF6A; Tue, 4 Aug 2015 12:06:35 +0000 (UTC) Received: from dhcp40-158.desklab.eng.bos.redhat.com (dhcp40-158.desklab.eng.bos.redhat.com [10.19.40.158] (may be forged)) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t74C6YvA023089; Tue, 4 Aug 2015 08:06:34 -0400 From: Tony Camuso To: sparse@chrisli.org, linux-sparse@vger.kernel.org Cc: tcamuso@redhat.com, nicstange@gmail.com Subject: [PATCH 2/3 v2] Handle all enum members in case statements Date: Tue, 4 Aug 2015 08:06:34 -0400 Message-Id: <1438689994-30940-1-git-send-email-tcamuso@redhat.com> In-Reply-To: <1438216001-8862-3-git-send-email-tcamuso@redhat.com> References: <1438216001-8862-3-git-send-email-tcamuso@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Missing enum members in case statements in c2xml.c and parse.c were causing compile time complaints by gcc 5.1.1. Better to explicitly handle all enum members of the switch variable in case statements, even if they just break. Signed-off-by: Tony Camuso --- c2xml.c | 16 ++++++++++++++++ parse.c | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/c2xml.c b/c2xml.c index 67486c7..a53f5bd 100644 --- a/c2xml.c +++ b/c2xml.c @@ -214,6 +214,22 @@ static void examine_symbol(struct symbol *sym, xmlNodePtr node) case SYM_UNINITIALIZED: newProp(child, "base-type-builtin", builtin_typename(sym)); break; + case SYM_PREPROCESSOR: + case SYM_BASETYPE: + case SYM_NODE: + case SYM_PTR: + case SYM_ARRAY: + case SYM_ENUM: + case SYM_TYPEDEF: + case SYM_TYPEOF: + case SYM_MEMBER: + case SYM_BITFIELD: + case SYM_LABEL: + case SYM_RESTRICT: + case SYM_FOULED: + case SYM_KEYWORD: + case SYM_BAD: + break; } return; } diff --git a/parse.c b/parse.c index b43d683..74a56e4 100644 --- a/parse.c +++ b/parse.c @@ -2769,6 +2769,21 @@ struct token *external_declaration(struct token *token, struct symbol_list **lis case SYM_ENUM: case SYM_RESTRICT: base_type->ident = ident; + case SYM_PREPROCESSOR: + case SYM_BASETYPE: + case SYM_NODE: + case SYM_PTR: + case SYM_FN: + case SYM_ARRAY: + case SYM_TYPEDEF: + case SYM_TYPEOF: + case SYM_MEMBER: + case SYM_BITFIELD: + case SYM_LABEL: + case SYM_FOULED: + case SYM_KEYWORD: + case SYM_BAD: + break; } } } else if (base_type && base_type->type == SYM_FN) {