From patchwork Mon Aug 10 12:35:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Camuso X-Patchwork-Id: 6983661 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 152329F358 for ; Mon, 10 Aug 2015 12:35:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3DF4C2070A for ; Mon, 10 Aug 2015 12:35:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60723206EE for ; Mon, 10 Aug 2015 12:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751346AbbHJMfd (ORCPT ); Mon, 10 Aug 2015 08:35:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54676 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751112AbbHJMfd (ORCPT ); Mon, 10 Aug 2015 08:35:33 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 63124923BE; Mon, 10 Aug 2015 12:35:33 +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-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7ACZWLg018100; Mon, 10 Aug 2015 08:35:32 -0400 From: Tony Camuso To: linux-sparse@vger.kernel.org Cc: tcamuso@redhat.com, sparse@chrisli.org, nicstange@gmail.com Subject: [PATCH 2/3 v3] Add default case to switches on enum variables Date: Mon, 10 Aug 2015 08:35:32 -0400 Message-Id: <1439210132-19384-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.27 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Spam-Status: No, score=-6.9 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. Adding a default case satisfies the compiler and notifies the reviewer that there are cases not explicitly mentioned being handled by the default case. Signed-off-by: Tony Camuso --- c2xml.c | 3 ++- parse.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/c2xml.c b/c2xml.c index 67486c7..c45d581 100644 --- a/c2xml.c +++ b/c2xml.c @@ -214,6 +214,8 @@ static void examine_symbol(struct symbol *sym, xmlNodePtr node) case SYM_UNINITIALIZED: newProp(child, "base-type-builtin", builtin_typename(sym)); break; + default: + break; } return; } @@ -330,4 +332,3 @@ int main(int argc, char **argv) return 0; } - diff --git a/parse.c b/parse.c index b43d683..39308da 100644 --- a/parse.c +++ b/parse.c @@ -2769,6 +2769,8 @@ struct token *external_declaration(struct token *token, struct symbol_list **lis case SYM_ENUM: case SYM_RESTRICT: base_type->ident = ident; + default: + break; } } } else if (base_type && base_type->type == SYM_FN) {