From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0DE6D3858CDA for ; Wed, 11 Oct 2023 11:38:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0DE6D3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697024305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3lSvhzq63CazhefQ4JAqZffeWAMkW/XS/bzH3oH70jI=; b=L5IEc6FFjj5EySJv+WgQEGXEFeJJhvl70f3qoUZ1Tp1s3jB+NdDN4uJwNLuYBBK6qEK0hP zjh74dq4kaCpQdi2BOt32XiTtYfp5YihYcvMQNnqaKM3VBbr+ebxioE2LalTtrqqIyvHRk QLPQ5lGnZpCOrPS44qiH+ZnkBITdB1I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-70-hsE-wG0hNDm4PLhmSa4nLg-1; Wed, 11 Oct 2023 07:38:14 -0400 X-MC-Unique: hsE-wG0hNDm4PLhmSa4nLg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 497BE85A5BD; Wed, 11 Oct 2023 11:38:14 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6ACC1B94; Wed, 11 Oct 2023 11:38:13 +0000 (UTC) From: Florian Weimer To: David Brown Cc: Jason Merrill , gcc@gcc.gnu.org Subject: Re: C89 question: Do we need to accept -Wint-conversion warnings References: <87h6myaf6b.fsf@oldenburg.str.redhat.com> <75b14d17-896c-db03-fad1-1931f39533e6@westcontrol.com> <8734yhy3yq.fsf@oldenburg.str.redhat.com> <87lec9wji7.fsf@oldenburg.str.redhat.com> Date: Wed, 11 Oct 2023 13:38:12 +0200 In-Reply-To: (David Brown's message of "Wed, 11 Oct 2023 13:28:12 +0200") Message-ID: <878r89wfrv.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * David Brown: >> C23 changes meaning of of extern foo(); to match the C++ >> interpretation of extern foo(void);. I don't think we should warn >> about that. If we warn, it would be at the call site. > > I'm not sure I fully agree. "extern foo();" became invalid when > implicit int was removed in C99. But "extern T foo();", where "T" is > void or any type, has changed meaning between C17 (and before) and > C23. My concern is that the warning would not really be actionable. Encouraging programmers to change foo() to foo(void) in declarations seems merely busywork. C++ doesn't need this, and future C won't need it, either. > IMHO I think calling "foo" with parameters should definitely be a > warning, enabled by default, for at least -std=3Dc99 onwards - it is > almost certainly a mistake. (Those few people that use it as a > feature can ignore or disable the warning.) It's possible to disable this warning in C23 by declaring foo as =E2=80=9De= xtern T foo(...);=E2=80=9D. Not sure if this has ABI implications. > I would also put warnings on the declaration itself at -Wall, or at > least -Wextra (i.e., "-Wstrict-prototypes"). I think that things that > change between standards, even subtly, should be highlighted. > Remember, this concerns a syntax that was marked obsolescent some 35 > years ago, because the alternative (prototypes) was considered > "superior to the old style on every count". I still think the declaration is quite harmless if we warn at call sites. Thanks, Florian