From patchwork Sat Feb 18 20:30:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9581207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 66BF3600F6 for ; Sat, 18 Feb 2017 20:30:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 588F426E97 for ; Sat, 18 Feb 2017 20:30:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D560286F4; Sat, 18 Feb 2017 20:30:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04D0B26E97 for ; Sat, 18 Feb 2017 20:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753595AbdBRUa6 (ORCPT ); Sat, 18 Feb 2017 15:30:58 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34423 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753492AbdBRUa4 (ORCPT ); Sat, 18 Feb 2017 15:30:56 -0500 Received: by mail-wr0-f194.google.com with SMTP id 89so1731421wrr.1 for ; Sat, 18 Feb 2017 12:30:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KsOytKQjy/E00eQIxPXdZQFVLbngF/VK5hJiNXb/p3E=; b=e+gzWgWJK37f3FPL4LFKyVJYsOcECfzPP5jTSZXr8CPm9/dDDDD9fCug0EUCg/4ggI NJ9iLc2vimng/GeadydE2QxWXb7LxiG60zg3PEezxAwEBxCTNxL8CwV2BpgXVBv9MAgO h+mqvoyz2oHPjereJCY+iQBKwWpIhMAWfdX1r+KFcscr+EC5DAqmNNKR/bCiR5y4wHbR TD2Iwjm/3jcc8+D+TzTeW5KbO4Uhvx65pEnmTQhAKlmU4E2hT6FQMzfqDtWG0unnssXe tQEl+Ym2HEtCdt9u27moB8jAo2HnZUfDbpmXP4gyfcoVZESV0+k8YOzm9rDa/xkLgmQJ eoeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KsOytKQjy/E00eQIxPXdZQFVLbngF/VK5hJiNXb/p3E=; b=txWDMo99WCnxQULUsMWZCEkjTKjTPuals21FRUjxdLy1Ya6wfkjg0MVrK/IilZ0mw4 JY52rk4cyBH6am9utV3CvdpEL46ufia02wHnCQ+vlZ7BlAtId4o8mIYuVl1m/VkfILn1 /eiiwixttRgNXjIhgAnWqJ7WKBsug7ip6/CjVJPt6pZAoJtJTpjoDx6tcuwu3OH3M959 9AgNgmA3LRpNdWplwx7XUx/ql5Xik8hFsu7mqSDu59ridQrkREBmRnPNEKZFmwW3v8rN 1MDSonbPVWfHqDbT03zIb1MSpKfnfesIzFV7nSKCnWz63Q0PnFaW0EpqwFKd2Cw43y3r 9kAQ== X-Gm-Message-State: AMke39njC2oJN9AVPUyDJ9s2ODJ0KwvwDUT2ZjKwrjfjBPDaVwrdPNKV+tNvcP2lSrmPQQ== X-Received: by 10.223.128.202 with SMTP id 68mr11785809wrl.92.1487449854976; Sat, 18 Feb 2017 12:30:54 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:8c2:3900:48ac:d537:1a61:c3e1]) by smtp.gmail.com with ESMTPSA id a14sm4888854wrc.66.2017.02.18.12.30.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Feb 2017 12:30:54 -0800 (PST) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Christopher Li , Luc Van Oostenryck Subject: [PATCH 1/5] replace test for c99 for-loop initializers Date: Sat, 18 Feb 2017 21:30:44 +0100 Message-Id: <20170218203048.22276-2-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170218203048.22276-1-luc.vanoostenryck@gmail.com> References: <20170218203048.22276-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The existing test is an indirect test, using a warning about context imbalance to show that some part of code was discarded. Now that we have the minimal tools to test the output of test-linearize, use them to replace the test by a direct one. Signed-off-by: Luc Van Oostenryck --- validation/c99-for-loop.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/validation/c99-for-loop.c b/validation/c99-for-loop.c index 42246c513..427fde268 100644 --- a/validation/c99-for-loop.c +++ b/validation/c99-for-loop.c @@ -1,33 +1,21 @@ -int op(int); - -static int good(void) +int c99(void); +int c99(void) { - __context__(1); - for (int i = 0; i < 10; i++) { - if (!op(i)) { - __context__(-1); - return 0; - } - } - __context__(-1); - return 1; -} + int r = -1; -static int bad(void) -{ - __context__(1); for (int i = 0; i < 10; i++) { - if (!op(i)) { - __context__(-1); - return 0; - } + r = i; } - return 1; + + return r; } + /* * check-name: C99 for loop variable declaration + * check-command: test-linearize $file * - * check-error-start -c99-for-loop.c:16:12: warning: context imbalance in 'bad' - different lock contexts for basic block - * check-error-end + * check-output-ignore + * check-output-contains: phisrc\\. + * check-output-contains: phi\\. + * check-output-contains: add\\. */