Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124776 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 0E3491A00B7 for ; Mon, 5 Aug 2024 16:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722876275; bh=fC7xoYex+mTyX1F9bb9lUv8WbQlB9oQOmIb102l9cJI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=lUANIUz8yaDcDPSrZuvquaw/1koLySFobUesbGN2s6MjDid2Z9ml+pAjMaSdQ7/LM DVktbZxkkvmYHz5qCBBfNxzrFx0e1AGqcXKTU0xqY8ZKAlACE/+UkT4zYBIXyZimJF Oooubl113Cw/+Uks1ri9OJGzRJfJuCdyv3if1cVPiev+V0bC5M7O87cysGSYyKeZRA JxmLxJ96PcvDx2T8O228KGHe7DDVFaDq865+QhrncEMAUBea2OdPc7WsEr/s8AEIto bK0W4LCIKLvLQfcTBV4WdKeIut5El7kDog8H4dhGMAsDr8qhejBt0VufHh/O8B6qD7 nOXzHYaoWecLA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E9325180054 for ; Mon, 5 Aug 2024 16:44:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 5 Aug 2024 16:44:31 +0000 (UTC) Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-81fad534a04so378617139f.1 for ; Mon, 05 Aug 2024 09:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1722876169; x=1723480969; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fC7xoYex+mTyX1F9bb9lUv8WbQlB9oQOmIb102l9cJI=; b=LEmL2s09mQcsYRHsgvHtMqXv11K3FhYnaSD0A4UPA9y7ED06SmnFquyalmyblg21af qtNT21jFfJCfhcpua5dvwg+LFJ95XdCX6hURWVHICCX2ZyzkAzLLBS1GMRWGIVTfhRjZ HCTQ7uUw1m0seOvv2iQ8Z3bpQOB8Bojc4FbCw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722876169; x=1723480969; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fC7xoYex+mTyX1F9bb9lUv8WbQlB9oQOmIb102l9cJI=; b=gYdggm8liYRIC66n9fkI/u96K5qeIr5lYvDZzUEpENTaaMSKDQPcJ6wL83Az4/Jndd mLLw3PVKKtFANkCU/ObxtHz7B/p4m5OUdvVFRr+uKakeDEn+fmMvETZnMA/8KKQL6zSc d4dnyP5WFMWrTeH9k3MLzV9F/EtRfMNaEf4ydiw3yQ1SsPzhVMeaLpbNOjpJnKoU5c94 yPqFJ7qGq0R/7tn5awzrsSqXicLHcKsnkdHSbywttioMKOKmO3j6t6DfQQ/GwBG+OTnX KjtqM0ItvpwHqLsnFoAltQaNuRaReIPd46Uwi3+OJb9QeL6c9LK65FemNSbA6AKHGZhk +MyA== X-Forwarded-Encrypted: i=1; AJvYcCXpX2xo8wIFf5sYvTvrD65l2IdgGFpc9TWcaoWljQF60EHzMysqMmpiCM34O1HFaauoIOHf1EJZvFg1g/fQPaf56QSjUU2e0w== X-Gm-Message-State: AOJu0YzfIkVF8av2jT6t0EHIvtiG5T/HVUCLZ9eli0OKm6ZOSS4Z7WIM CRmDnHl6Ot9KrsSe+v7FbRB6lCfKoVBPRHelLFzjYfap/HoIWfP3kNgfqm8DPS1ph6HSQHUM04E BH78Lrs3DKsIA4agHL7CLZjFguBLR3ViwUSRBxQ== X-Google-Smtp-Source: AGHT+IEm4BPZ/15yMUYkF/o/7c73D63gJYyO9I7OSoHyP6r0t92P3o8/7ZOOGbhJqCe8nacDuNbCiQ7r48kz1vVyW6Q= X-Received: by 2002:a05:6602:6423:b0:7fa:2902:aec5 with SMTP id ca18e2360f4ac-81fd43f90c8mr1651751339f.17.1722876169496; Mon, 05 Aug 2024 09:42:49 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 5 Aug 2024 10:42:38 -0600 Message-ID: Subject: Re: [PHP-DEV] Require C11 in PHP 8.4 To: "Gina P. Banyard" Cc: Giovanni Giacobbi , Ilija Tovilo , PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: levi.morrison@datadoghq.com (Levi Morrison) On Sun, Aug 4, 2024 at 10:05=E2=80=AFAM Gina P. Banyard = wrote: > > > On Friday, 2 August 2024 at 14:33, Giovanni Giacobbi wrote: > > On Thu, 1 Aug 2024 at 23:57, Ilija Tovilo wrote: >> >> [...] >> I started fixing these in a PR [1] which required more changes than >> expected. After a short discourse, we were wondering whether it might >> be better to switch to a newer C standard instead. Our coding >> standards [2] currently specify that compiling php-src requires C99. >> The Unix installation page on php.net [3] claims it is ANSI C, which >> is certainly outdated. There have been suggestions to require C11 for >> a while, which should be well supported by all compilers shipped with >> maintained distributions. > > > It feels wrong to raise such an important requirement that might affect a= lot of people, including maintainers of extensions, for just one specific = problem, and 99% of the codebase would still be C99 compliant. > > I quickly put together an alternative PR (#15202) with a slightly differe= nt approach, just as a proof of concept. The idea is to move all the global= typedefs in a new include header "zend_types_defs.h" (but also zend_portab= ility.h can be reused for this purpose, as all the relevant files already i= nclude it). > > While putting together that PR, I had the feeling that this typedef redef= inition problem is in reality hiding some smelly design of header files. So= maybe, rather than requiring a compiler more tolerant to poor code, we sho= uld rather focus on getting the design right. > > > I would like to see actual factual data rather than "vibes" as to how thi= s would cause issues with third-party extensions. > php-src is not C99 pedeantic compliant and we do use GCC extenstions. > > I do agree that maybe we should go back to fixing headers, but considerin= g the drama this caused 18 months ago I do not know who here has the motiva= tion to do this. > > Ideally I feel we should target C17 as it is a "bug fix" release of C11, = but this might be impossible due to old compilers still being the default o= n LTS Distributions. > The main benefit of C11/17 in the long run are atomics, that we kinda use= already anyway. As a person who wrote some of those atomics, I would definitely prefer to move to standard C11/C17 atomics at some point in the future and remove all other fallbacks. The blocker right now is Microsoft Visual Studio. Although they added C11/C17 support a few versions back, they did not add atomics at that time. It's available now, but it is still experimental as far as I can tell. Maybe for PHP 9.0 we can address header issues and also by then VS will have a general release we can move to for atomics. One thing I feel strongly about is that we should not add flags like `-std=3Dc11`. If we check, we ought to just ensure that whatever flags the user provided, we have certain C11/C17 features. This allows for extensions to use a newer version, or a relaxed version like `-std=3Dgnu11`.