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 93C433858C52 for ; Wed, 11 Oct 2023 10:17:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 93C433858C52 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=1697019462; 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: in-reply-to:in-reply-to:references:references; bh=jZvLOmJvOqODRrx34xbqZ+bo4g1ZprXXBSyLNKh3KEk=; b=Cc+aDo0nURYHdTXnm9Ybgp4BuifMvpaNniBfa+L57GAm9gsZwQx3jVyRbB6UkDAuYlhz5I C6b3POuXlTUhEND6Q+Veh3/VlXbpZMSGCAjcUhhiAl1M2/562sqeO/7A7wHO+WNIWS9GFB xWwGtxPHll4fDDP9cRp/ca8tU9cEXic= 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-524-5sgYr6h5MTCqvrFVLbcznA-1; Wed, 11 Oct 2023 06:17:39 -0400 X-MC-Unique: 5sgYr6h5MTCqvrFVLbcznA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 CC3868015F8; Wed, 11 Oct 2023 10:17:38 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1EED2C5796D; Wed, 11 Oct 2023 10:17:37 +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> Date: Wed, 11 Oct 2023 12:17:36 +0200 In-Reply-To: (David Brown's message of "Wed, 11 Oct 2023 10:51:37 +0200") Message-ID: <87lec9wji7.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.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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: > On 11/10/2023 10:10, Florian Weimer wrote: >> * David Brown: >> >>> So IMHO (and as I am not a code contributor to GCC, my opinion really >>> is humble) it is better to be stricter than permissive, even in old >>> standards. It is particularly important for "-std=c89", while >>> "-std=gnu89" is naturally more permissive. (I have seen more than >>> enough terrible code in embedded programs - I don't want to make it >>> easier for them to write even worse code!) >> We can probably make (say) -std=gnu89 -fno-permissive work, in a way >> that is a bit less picky than -std=gnu89 -pedantic-errors today. >> > > The gcc manual has "-permissive" under "C++ Dialect Options". Are you > planning to have it for C as well? Yes, I've got local patches on top of Jason's permerror enhancement: [PATCH v2 RFA] diagnostic: add permerror variants with opt > That sounds like a good idea (perhaps with some examples in the > documentation?). Ideally (and I realise I like stricter checking than > many people) some long-obsolescent features like non-prototype > function declarations could be marked as errors unless "-permissive" > were used, even in C89 standards. For some of such declarations, this falls out of the implicit-int removal. 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. > (As a side note, I wonder if "-fwrapv" and "-fno-strict-aliasing" > should be listed under "C Dialect Options", as they give specific > semantics to normally undefined behaviour.) They are code generation options, too. >> And of course there's still -Werror, that's not going to go away. So if >> you are using -Werror=implicit-function-declaration today (as you >> probably should 8-), nothing changes for you in GCC 14. > > I have long lists of explicit warnings and flags in my makefiles, so I > am not concerned for my own projects. But I always worry about the > less vigilant users - the ones who don't know the details of the > language or the features of the compiler, and don't bother finding > out. I don't want default settings to be less strict for them, as it > means higher risks of bugs escaping out to released code. We have a tension regarding support for legacy software, and ongoing development. I think we should draw the line at C99. That's the first language standard that removes most of these obsolescent features, after all. Thanks, Florian