From nobody Mon Aug 15 21:23:06 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M66hF0fvHz4Z05x for ; Mon, 15 Aug 2022 21:23:09 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M66hF0Fy6z3dZt for ; Mon, 15 Aug 2022 21:23:09 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f47.google.com with SMTP id n4so10393801wrp.10 for ; Mon, 15 Aug 2022 14:23:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc; bh=2q2ediucDEM2oxCgbLu8/DBTLO6LRnxlHoPZDjFHQbA=; b=F0WrJ4RQ1sJ/rjIILlCbBc5Czslg7uQaOG4IPGqoTDejD6uVMabfEHwqe9046zxfQY WY/Jech2fu8jyoIx7woVnrtMhQIkweoUTu/3WLuLYJjqoxicIT4gBRBAuN38SAHrExBa mnSmU3nd9VA7hG2i3O0x0PeW7sFqrau6kvO5Qq/5I9qS1WRwAITGqGxMC+UHX3R2B63l CTrvCwpRpApVZDJQJR6BcLQEvEK846MCHC53rwSLQzoncuz9AIH1r7goXDlbwYoLkUp1 7TNVnUOt97ZWDsPsRvKxFym/1DBo/vZyr4KKPgrlI+IHqew3Gd8HDKTkDjisBaUs/pKE NCTA== X-Gm-Message-State: ACgBeo0lL/YD6oCraN/W50UlVyvKq1WIrx0bTMjFAMwxMH6wV/Q87lB6 COJRquv+zoWv/HPKFy+4LFMe1A== X-Google-Smtp-Source: AA6agR5lzdVWAy0g6sou64i4YOuHQ9sIxf6CuFNIk0CMRrHRnM/6fEerr44qpVKLQp487ERw8Qi7AA== X-Received: by 2002:adf:ce89:0:b0:220:6cc5:aff8 with SMTP id r9-20020adfce89000000b002206cc5aff8mr9860412wrn.396.1660598587605; Mon, 15 Aug 2022 14:23:07 -0700 (PDT) Received: from smtpclient.apple (global-5-141.n-2.net.cam.ac.uk. [131.111.5.141]) by smtp.gmail.com with ESMTPSA id g17-20020a5d5551000000b0021f0af83142sm8260654wrw.91.2022.08.15.14.23.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Aug 2022 14:23:07 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Subject: Re: git: 402dbdd98acc - main - Adjust function definition in arm's mv_common.c to avoid clang 15 warning From: Jessica Clarke In-Reply-To: Date: Mon, 15 Aug 2022 22:23:06 +0100 Cc: Dimitry Andric , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202208151849.27FInHmh027652@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3696.80.82.1.1) X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Rspamd-Queue-Id: 4M66hF0Fy6z3dZt X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N =3DOn 15 Aug 2022, at 22:07, Konstantin Belousov = wrote: >=20 > On Mon, Aug 15, 2022 at 06:49:17PM +0000, Dimitry Andric wrote: >> The branch main has been updated by dim: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D402dbdd98acc7fa94d1d4cd01903e987= d2409336 >>=20 >> commit 402dbdd98acc7fa94d1d4cd01903e987d2409336 >> Author: Dimitry Andric >> AuthorDate: 2022-08-15 18:02:13 +0000 >> Commit: Dimitry Andric >> CommitDate: 2022-08-15 18:48:33 +0000 >>=20 >> Adjust function definition in arm's mv_common.c to avoid clang 15 = warning >>=20 >> With clang 15, the following -Werror warning is produced: >>=20 >> sys/arm/mv/mv_common.c:414:20: error: a function declaration = without a prototype is deprecated in all versions of C = [-Werror,-Wstrict-prototypes] >> mv_check_soc_family() >> ^ >> void >>=20 >> This is because mv_check_soc_family() is declared with a (void) = argument >> list, but defined with an empty argument list. Make the definition = match >> the declaration. >>=20 >> MFC after: 3 days >> --- >> sys/arm/mv/mv_common.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >>=20 >> diff --git a/sys/arm/mv/mv_common.c b/sys/arm/mv/mv_common.c >> index 6e1d12f8c7a7..c2e25c686583 100644 >> --- a/sys/arm/mv/mv_common.c >> +++ b/sys/arm/mv/mv_common.c >> @@ -411,7 +411,7 @@ static int mv_win_cesa_attr_armadaxp(int eng_sel) >> } >>=20 >> enum soc_family >> -mv_check_soc_family() >> +mv_check_soc_family(void) >> { >> uint32_t dev, rev; >>=20 > I am actually curious about this and other commits. =46rom the = ISO/IEC 9899:2023 > draft N3047, 6.7.6.3 Function declarators, clause 13: >=20 > For a function declarator without a parameter type list: the effect > is as if it were declared with a parameter type list consisting of > the keyword void. A function declarator provides a prototype for the > function 177). >=20 > Then the note 177: > This implies that a function definition without a parameter list > provides a prototype, and that subsequent calls to that function in = the > same translation unit are constrained not to provide any argument to = the > function call. Thus a definition of a function without parameter list > and one that has such a list consisting of the keyword void are fully > equivalent. >=20 > And more, in the 6.9.1 Function definitions clause 13, there is an = example: > typedef int F(void); // type F is "function with no parameters > // returning int" > int g() { /* ... */ } // RIGHT: g has type compatible with F >=20 > So why does clang enforce the warning? I=E2=80=99m not sure why this is a warning; an empty parameter list in a function declaration that is part of a definition has always been the same as (void) (unless you have K&R-style arguments, which the compiler can also see). C99 6.11.6 Function declarators does however say: > 1 The use of function declarators with empty parentheses (not > prototype-format parameter type declarators) is an obsolescent = feature. So technically warning for pre-C23 is compliant with that, though a bit annoying in the definition case given the semantics have stayed the same and been un-deprecated. Regardless, it=E2=80=99s probably best = practice to be consistent and use (void) in the definitions so it matches any declarations rather than have this be a special case that can differ. Jess