From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NOR01-OL1-obe.outbound.protection.outlook.com (mail-ol1nor01on2044.outbound.protection.outlook.com [40.107.224.44]) by sourceware.org (Postfix) with ESMTPS id C76EE3858CDA for ; Wed, 11 Oct 2023 08:51:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C76EE3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=westcontrol.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=westcontrol.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lKjNw9plGIyZc+8ayBg77RhpgPiauHSV9FxtCRGQkq42biIz7ho6AEd8NInrE7PdYpUNk604JQy72VEIp4+WSVh5Gq8nFjmGYCXxiJV7aZEEM967AwxtTtUjeunF6y5Mu0tADxXJGEqMzBT4yEy0v+IdK+J6AvzfmqnBbhLrrEiSIAdY/LRIu1MiTtHvW1R0su15wU2a7MZOv+IsDuuYhs2i8pGelDV9IjZDpusMeLs0Ug/4fc482nQNZInPLK4DXqkkWnqaLcgWiMs8nNMTZoZLA/qu/DRH0IUQ3cP3QxQKe9UKc//myU8MWlmIx33HfpkKO3wQupiUJpQxmS5rTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vXRUnLEi6rMR6jsCuY3lgp2X1zC0+/1+nKBDOGBsn7U=; b=OM+3KYGcKeZ/foJEhP5E7DcsD7YRmjjHRDXGut78KD+8zuQRdZD0Bsw1SFEzZweNDjaQrQycj8QecNw257DuNGaKXkZ9iowTlXBPjhXLTyrnDwJI7N849BM+C+QfB45woSqSgAQZAUJq2Z8wbJJrCrG9cAj6bqLxDmUO4+FRqqKWHONJ9c2nnuB41RtX+SGcD3yJW1oFkg29kXz7S3JPiueAMHGF95Z1PAo+v9117sdCAAQUmc+ep4xC9w7Y/y4MVm7vHoUq8lSa6X8PpZGJLjcNuRXD+m7fCPngEg5Lxx4FZdCM6b6Ra2HilblnNzYR+FH8OD48cS+AEvZKh7zidA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=westcontrol.com; dmarc=pass action=none header.from=westcontrol.com; dkim=pass header.d=westcontrol.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=westcontrol.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vXRUnLEi6rMR6jsCuY3lgp2X1zC0+/1+nKBDOGBsn7U=; b=YvDdBvu+Z6K+V1NoThljkk1k/zdKpTyf2R1l119/rxjsyJL3i52yBxwbHkdjMBvkpLo3qOCfUEoK87/BCBqmFn8VEBRK9EyONDevjZH70keFMYS/c9Na7mwVWBVIcB5hoxUrotQ7yjiG5ZJ5XsK+Tnar6ISqOLS2FdXedO/n2yHEyR0s0BcEs7i+CxUELweKu6s5X2stoTI/lWwyW2aC4L5l4TPACfpWgmf2/no8yBe2UG7xdE9qStTRBiyFY3X08W8yD//dRuEhdFOPP1/lWYKcSnTGJojAGoDMgsZb1ZQSRacUNVEU6duhd84/yfAQfFchWJeuRql70rl0+oeMWg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=westcontrol.com; Received: from SV0P279MB0233.NORP279.PROD.OUTLOOK.COM (2603:10a6:f10:b::13) by SV0P279MB0028.NORP279.PROD.OUTLOOK.COM (2603:10a6:f10:9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Wed, 11 Oct 2023 08:51:39 +0000 Received: from SV0P279MB0233.NORP279.PROD.OUTLOOK.COM ([fe80::1e40:a4aa:a2b2:3c70]) by SV0P279MB0233.NORP279.PROD.OUTLOOK.COM ([fe80::1e40:a4aa:a2b2:3c70%4]) with mapi id 15.20.6863.032; Wed, 11 Oct 2023 08:51:39 +0000 Message-ID: Date: Wed, 11 Oct 2023 10:51:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: C89 question: Do we need to accept -Wint-conversion warnings Content-Language: en-GB To: Florian Weimer Cc: Jason Merrill , gcc@gcc.gnu.org References: <87h6myaf6b.fsf@oldenburg.str.redhat.com> <75b14d17-896c-db03-fad1-1931f39533e6@westcontrol.com> <8734yhy3yq.fsf@oldenburg.str.redhat.com> From: David Brown In-Reply-To: <8734yhy3yq.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SV0P279CA0053.NORP279.PROD.OUTLOOK.COM (2603:10a6:f10:13::22) To SV0P279MB0233.NORP279.PROD.OUTLOOK.COM (2603:10a6:f10:b::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SV0P279MB0233:EE_|SV0P279MB0028:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c3ed812-eb0d-4c26-59b8-08dbca37488a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 76U9WUAbrfAmJUt/f8ai10ED8TRmvpVu7NDPF7k5ozI1eKA+nl0Xz7n/JN/t6u3cRFlBokLlrQBx6tItNCGQ/jzLzC69VXFnR6z+3U6HNQlAhEIpT4VNeJVNRjeGAtkXFEKlxWWMl/2m4RcFHjuQv1L8PGWb/qYmmM82JYePFafkllifnpJHhLQMJVQPyMys3IRuCJ9dvv68fJtYKBhywGriOP4jX8SuzCoNRsC5gz2BbroP624ik5PIDat2KAugkep896C0lBXhj6AUNoaGFuQ8Fk+bo71yS2ZGCI9u8bRa/Kx2gx2Pwzh8OZxirsWTqj+gRRT1S3EnJg9i3iJxtTFtnugbBmVg+WCyGd1o6ytfoexanWexEdV5YtHxnYkeqUW4Ck7ATFlkTszKNmx12jrpt7uZjXO5E+rk7m39/T96rGGffq/TRxHFnw/jaeex0QxRTYKrAkZnhmqbJ02LKhDjrQUbV3tETmkOgI2Yit9KSDV359TlZadw6BkB52Jx1OApcoZqsf4anMMcr/4bLscawfqbiLu3weZnexmZhx35s+Mj+dX2UNhrXWoqum4E49g298PGpqel0cH5m1oLavrwRcYDWuBpiw4oG5LZhJtCAvd5dPcUL1lDjKHRnP5ax0QW91yAfMYLFD4MbzyAtQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SV0P279MB0233.NORP279.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(396003)(39840400004)(346002)(376002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(66899024)(2906002)(36756003)(86362001)(31696002)(38100700002)(26005)(4326008)(8936002)(8676002)(6512007)(6486002)(6506007)(53546011)(6916009)(31686004)(41300700001)(316002)(66476007)(66946007)(5660300002)(2616005)(83380400001)(478600001)(66556008)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N1R3MEtRV2R3eEFHOWgvT2FmME95VG1VSHM3Ymx4T3N0M0NjL0JKb2ZUajNK?= =?utf-8?B?VWNqY3ArMkV4cGhjaFpNOWFMMGJWM0g5c2Z4bU9lZ0Npb2ZOa0dHVkJ5VTha?= =?utf-8?B?eGEvU1E0RTdFYnRWYVd6ZXBBMENvNlFPZjc0ZkNFTEVnaGtkRzg3MEpLMFFL?= =?utf-8?B?dENZQ3MxOVpTL1c3UkJEZ3dETm5KWnVvNWE0SnY4UU9pNTh1MTJwUTBJV3VU?= =?utf-8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TSDRuKzY1THlLZ1hQejlWTXBvUjlLRlErRE1VcWE2?= =?utf-8?B?WllpRDV5c3pkU2ZTYWNmcnlkdEVQczk5YXN0UWI5dlNabUFScDY2WlJhY3Z5?= =?utf-8?Q?OaixuTUsQF2yaP86rfu4XrOKR?= X-OriginatorOrg: westcontrol.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c3ed812-eb0d-4c26-59b8-08dbca37488a X-MS-Exchange-CrossTenant-AuthSource: SV0P279MB0233.NORP279.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 08:51:39.3270 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: c75fbd3c-42ad-4db0-9cff-972faf83ae45 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ptt2SE58qG/Xe0TnrMkab+IFBBoDhJ8xKxCQNKQ84w1UWO5r84PX0SrkE9+DzR0pHE8kGIjmwJ3YjZd3J4KLMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SV0P279MB0028 X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,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: 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? 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. (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.) > 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. > >> I suspect (again with numbers taken from thin air) that the proportion >> of C programmers or projects that actively choose C11 or C17 modes, as >> distinct from using the compiler defaults, will be less than 1%. C99 >> (or gnu99) is the most commonly chosen standard for small-systems >> embedded programming, combining C90 libraries, stacks, and RTOS's with >> user code in C99. So again, my preference is towards stricter >> control, not more permissive tools. > > I don't think the estimate is accurate. Several upstream build systems > I've seen enable -std=gnu11 and similar options once they are supported. > Usually, it's an attempt to upgrade to newer language standards that > hasn't aged well, not a downgrade. It's probably quite bit more than > 1%. > Fair enough. My experience is mostly within a particular field that is probably more conservative than a lot of other areas of programming. David