From patchwork Sat Sep 27 00:24:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 4988281 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 38758BEEA6 for ; Sat, 27 Sep 2014 00:24:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 69C562021B for ; Sat, 27 Sep 2014 00:24:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48E0F20212 for ; Sat, 27 Sep 2014 00:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755944AbaI0AYp (ORCPT ); Fri, 26 Sep 2014 20:24:45 -0400 Received: from mail-we0-f170.google.com ([74.125.82.170]:49345 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756020AbaI0AYn (ORCPT ); Fri, 26 Sep 2014 20:24:43 -0400 Received: by mail-we0-f170.google.com with SMTP id q58so884651wes.29 for ; Fri, 26 Sep 2014 17:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=5MZ+3Aq9EOC05S2nQjd4mobXot6ujvotI1YkkA3OYcg=; b=WhwPhPPs5pmTBhWXLmFwFLe46bqMeFiuboItdSFXZADKkHTT4gxeySshKOKSX+CYd+ ba0/SLXyInYxblcTOhyPeQiTU4U9yxVejbYtuZx4xgWcTz4C1n9xkxE3QU4IeRd0mPhr sxmCvVdF3v8XgmcK8M3bm6LEgbWeaUkMJ8lPjXRJaJpGIYH8Hd1AUZ+De5EHkoz5DaQH 1eyNzaKay63ye91Bo2w73tkiZiC1n+g4DfX0XzeKi1aOp4uV9+9yI8NNY7qvhWdkSnnU s9AIO9cjIfDQk1avbPcGfyXocKt7qZm/XDM2IHqflI5J+qth1vOWcWn0QYLKAk2OyOZZ w8YA== MIME-Version: 1.0 X-Received: by 10.194.5.234 with SMTP id v10mr27370490wjv.45.1411777482192; Fri, 26 Sep 2014 17:24:42 -0700 (PDT) Received: by 10.27.175.129 with HTTP; Fri, 26 Sep 2014 17:24:42 -0700 (PDT) In-Reply-To: <795aaa7448d91bd59bcbea3d8e49b068a569409e.1411632579.git.tgraf@suug.ch> References: <795aaa7448d91bd59bcbea3d8e49b068a569409e.1411632579.git.tgraf@suug.ch> Date: Sat, 27 Sep 2014 08:24:42 +0800 X-Google-Sender-Auth: USwYTiG3JR3gYjbuBpN9YHy2Zhk Message-ID: Subject: Re: [PATCH v2] sparse: Make -Werror turn warnigns into errors From: Christopher Li To: Thomas Graf Cc: Linux-Sparse 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 On Thu, Sep 25, 2014 at 4:11 PM, Thomas Graf wrote: > > @@ -467,6 +475,9 @@ static char **handle_onoff_switch(char *arg, char **next, const struct warning w > } > } > > + if (!strcmp(p, "error")) > + Werror = 1; > + > // Prefixes "no" and "no-" mean to turn warning off. > if (p[0] == 'n' && p[1] == 'o') { > p += 2; > diff --git a/lib.h b/lib.h > index f6cd9b4..dc01684 100644 While I apply the patch, I notice this piece. Sparse has the on/off switch list. "Werror" seems should belong to that list. Gcc accept "-Wno-error" to turn off the switch. However, we might not want "-Wsparse-all" to turn on "Werror". So I have the incremental patch to convert "Werror" using the on/off switch list. Feed back? Chris if (p[0] == 'n' && p[1] == 'o') { p += 2; --- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib.c b/lib.c index 5203d98..8395662 100644 --- a/lib.c +++ b/lib.c @@ -439,6 +439,7 @@ static const struct warning { { "designated-init", &Wdesignated_init }, { "do-while", &Wdo_while }, { "enum-mismatch", &Wenum_mismatch }, + { "error", &Werror }, { "init-cstring", &Winit_cstring }, { "non-pointer-null", &Wnon_pointer_null }, { "old-initializer", &Wold_initializer }, @@ -470,14 +471,11 @@ static char **handle_onoff_switch(char *arg, char **next, const struct warning if (!strcmp(p, "sparse-all")) { for (i = 0; i < n; i++) { - if (*warnings[i].flag != WARNING_FORCE_OFF) + if (*warnings[i].flag != WARNING_FORCE_OFF && warnings[i].flag != &Werror) *warnings[i].flag = WARNING_ON; } } - if (!strcmp(p, "error")) - Werror = 1; - // Prefixes "no" and "no-" mean to turn warning off.