From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28664 invoked by alias); 2 Jun 2016 02:51:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 28528 invoked by uid 89); 2 Jun 2016 02:51:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=timely X-HELO: mail-qk0-f171.google.com Received: from mail-qk0-f171.google.com (HELO mail-qk0-f171.google.com) (209.85.220.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 02 Jun 2016 02:51:33 +0000 Received: by mail-qk0-f171.google.com with SMTP id n63so29032779qkf.0 for ; Wed, 01 Jun 2016 19:51:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=hzb4uqqNLuZRy2TQxpzyCToKeY1vRHJCc2vbvECWqKE=; b=VKFXQbCGrYQnHthwle47fRMMcKj75yl1FA+NTLWRbSh8++6KmnrBHa+i/h3ZahBZlC pV8M4owiUAUS+NjrGFbTMGxZLHzxygfXy77vxkGn1lYjcLgY1bJMfNuFMHIhIC3dEgNn JGelwa1pWx63g/HCLXk2x/H5VIzluZVtmEjMvuYEczF6MgnGcmrTOv4NDBI+Di0TfmMP ruIAe5Mt4A0eH0wFXGlC0F9tow6m6soQ3RT8QgaCT7PQ/0vu8tE+Omabxu2s7P4vzy61 1aPjggLfLcQfsSaxTYgLdFXXZ5suDPmrJG/UBm+3mzpU9gmnUbNnooheVYNfBi58VTtV hksg== X-Gm-Message-State: ALyK8tLyafVKRm/FghAo+sGHyICAzh3LDsPzt4XfvP2TeQPs5+vkDubHhlaPWIcjIgV92Q== X-Received: by 10.55.40.155 with SMTP id o27mr28866216qko.165.1464835891454; Wed, 01 Jun 2016 19:51:31 -0700 (PDT) Received: from [192.168.0.26] (75-166-216-131.hlrn.qwest.net. [75.166.216.131]) by smtp.gmail.com with ESMTPSA id b20sm10548478qge.44.2016.06.01.19.51.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jun 2016 19:51:30 -0700 (PDT) Subject: Re: [PATCH] Warn about return with a void expression with -Wreturn-type. To: =?UTF-8?Q?Marcin_Baczy=c5=84ski?= References: <20160601115504.725560-1-marbacz@gmail.com> <20160601115504.725560-2-marbacz@gmail.com> <20160601120702.GO28550@tucnak.redhat.com> <20160601163915.GU28550@tucnak.redhat.com> <574F155B.6070807@gmail.com> Cc: Jakub Jelinek , gcc-patches@gcc.gnu.org From: Martin Sebor Message-ID: <574F9F31.3080203@gmail.com> Date: Thu, 02 Jun 2016 02:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00111.txt.bz2 > So here's my shot at fixing this in the documentation. Does that look okay? > It looks good to me. Just one minor point below. > @@ -4055,8 +4055,12 @@ Warn whenever a function is defined with a > return type that defaults > to @code{int}. Also warn about any @code{return} statement with no > return value in a function whose return type is not @code{void} > (falling off the end of the function body is considered returning > -without a value), and about a @code{return} statement with an > -expression in a function whose return type is @code{void}. > +without a value). > + > +For a @code{return} statement with an expression in a function whose > +return type is @code{void}, warn unless the expression type is also > +@code{void}. As a GNU extension, the latter case is accepted without a > +warning unless @option{-Wpedantic} is used. I would suggest to add that this only applies to C. Otherwise it's valid C++ so G++ accepts it without a pedantic warning. As a disclaimer, someone else endowed with those special powers will need to approve your final patch. If you don't get a timely approval please ping the patch weekly. Martin