From patchwork Wed Aug 23 20:15:14 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: 9918255 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 D6266602CB for ; Wed, 23 Aug 2017 20:16:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C942228A29 for ; Wed, 23 Aug 2017 20:16:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE54928A2D; Wed, 23 Aug 2017 20:16:17 +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 7E96228A29 for ; Wed, 23 Aug 2017 20:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932600AbdHWUQR (ORCPT ); Wed, 23 Aug 2017 16:16:17 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37041 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932443AbdHWUQQ (ORCPT ); Wed, 23 Aug 2017 16:16:16 -0400 Received: by mail-wm0-f68.google.com with SMTP id v186so630144wmf.4 for ; Wed, 23 Aug 2017 13:16:15 -0700 (PDT) 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=URlmXwLbK0t0NyiRr0ri2lq5qVF3MXPPQUNaIyOdQmI=; b=nZymPvuNotQVTbBsFvYacVmnBbW446hyBqMERpOyGZCTLRVxBvt9uLGdjmkRmtDYM0 9Sj+uLrTZKi8t/Lka3RbZ7jTOOZGRyrSoqcsu3i5jsuxZrKsVehZhuMt6FrJV2WhLTKU JV76kV45lE/Ry84Zab5axqtYHOval/zJjDJxY17KSrlGzRBALsQ0fMjiHjXWCpvwuvzN 1NPCVViCH64VUnC/vH0HWuKlAinM889zgyMRGi6bjTtL+55+yLoeCW5eflefI38gcm2r Yw/RVzcDFAnRq1CD8oAj7G+FcjSbr0En2stqJuzZvxA/4GM2AP7CCN43HSWYa44QGKLf LEjw== 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=URlmXwLbK0t0NyiRr0ri2lq5qVF3MXPPQUNaIyOdQmI=; b=sanlDHa+pFNTIMAYm/pfNfRrZu4uESkC5VGqdrIJ7rU/xyJbfwONZ6WFG9rXzl9BVR o7MXzFU0u0sWHEn62cCC4s+w19+ByKMg1ycMfTsEURvIw5y55kaCQMJY0m1AkuaHxIOX PUrRQOkXK/S3i2KFmMLfM8DqEs1fu1x6bVCFQLBHfn/udmMylOZjr0YLvHnHdZFOhTOi m1cc/jJkQvQtM9SWb+YqnQ9EowTXALA5BPzdc7X0dO1Z5pasKISZp3wLD96rYaScaxXw h1dNvZeqWa2XTUMZ77HEh8ZeVzRMqrUnccFACpfmZqfBTm0bJaNBqII1LM99zZNz/8pb W+Pg== X-Gm-Message-State: AHYfb5ivArMdHLbpoM0sukbLOkb/4BQB3HBFotTMr0qppeH1J4ZaHxvp rjkqo6JIE6xYT2V0tf0= X-Received: by 10.80.162.198 with SMTP id 64mr4022615edm.168.1503519374737; Wed, 23 Aug 2017 13:16:14 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:4076:600:9020:103b:7912:3a40]) by smtp.gmail.com with ESMTPSA id e29sm1183374edd.88.2017.08.23.13.16.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Aug 2017 13:16:14 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Christopher Li , Luc Van Oostenryck Subject: [RFC PATCH 08/48] ret-void: return nothing only for void functions Date: Wed, 23 Aug 2017 22:15:14 +0200 Message-Id: <20170823201554.90551-9-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.14.0 In-Reply-To: <20170823201554.90551-1-luc.vanoostenryck@gmail.com> References: <20170823201554.90551-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 Only void functions should return nothing. Others functions should return something and if not we want to be able to emit a diagnostic. Fix this by testing the return type instead of the size of the return type. Signed-off-by: Luc Van Oostenryck --- linearize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linearize.c b/linearize.c index 298991dcd..69e4f3e8f 100644 --- a/linearize.c +++ b/linearize.c @@ -2218,7 +2218,7 @@ static struct entrypoint *linearize_fn(struct symbol *sym, struct symbol *base_t struct symbol *ret_type = base_type->ctype.base_type; struct instruction *insn = alloc_typed_instruction(OP_RET, ret_type); - if (type_size(ret_type) > 0) + if (!is_void_type(ret_type)) use_pseudo(insn, result, &insn->src); add_one_insn(ep, insn); }