From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by sourceware.org (Postfix) with ESMTPS id BE1783858D1E for ; Thu, 22 Dec 2022 02:42:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BE1783858D1E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=kitware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kitware.com Received: by mail-qv1-xf2a.google.com with SMTP id ml19so431536qvb.11 for ; Wed, 21 Dec 2022 18:42:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kitware.com; s=google; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=MUTimgPnDkl6wM3PwSVi0TKFsMleFgOx5pRbk9IyrOQ=; b=Acrh97fDgZ4CY14vQ3PTQR/hlJL8qO5BXRlksZTsLFD6HXYs5PgXcthJ3CquDszC0q jK0u5a7tXd+7wiEFFbH7nYGjbqlSR8z+eF6UeGaNxgu2fqWELW9YPDSPEUEk+/dei9kQ KvF4U4r83oK8mlmmo7A+1SuJicPgZbAEC0yBw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MUTimgPnDkl6wM3PwSVi0TKFsMleFgOx5pRbk9IyrOQ=; b=oSQB/JJlLVtIo3phS4ujHhSWSrgDKxQOw8r07FOXiWElRFVtmf/drX2WT+pU351iGr wit2pk3w4K+Wl6lnu5aeE/IyAdVmzrl87XRDwBI9RNJ+BLWoWchOh/RYj/OjA0XFBAtL Zs9z72wnSUanepawy8BJuhSK5imXKG0jOHor2t/BFdo1+bBPKlh0lpK0UctvFSXTdkS4 auOSNipeE7Upez6QzNM8CRr3ovFL6ZSOX3XI85L7dqKgWKQI/h6uijhG6ZTqFIy+vk1L Z0AH7nHq8jkxpbuGQlY6A9O7+nQRPrIZeo+p65xHzaiqmVzXLJ0lU9RH4yGshljdCx4v XM5Q== X-Gm-Message-State: AFqh2kr2gFp+xh4kmNESwFP8jORQFw94P8NplEL2p7SrYE+NK/T72ZE/ 5qDG2jC5TOvezxiWS0QpEhLRxg== X-Google-Smtp-Source: AMrXdXvFdBqydetKw2lqXZYjlMsbdMHmudUCbifmG6OQP1cQ9Fg2xraBb7m1WVl58S3Fx/RQb60ePg== X-Received: by 2002:a05:6214:400f:b0:4dd:c2c9:6d61 with SMTP id kd15-20020a056214400f00b004ddc2c96d61mr5917727qvb.5.1671676976197; Wed, 21 Dec 2022 18:42:56 -0800 (PST) Received: from localhost (cpe-142-105-146-128.nycap.res.rr.com. [142.105.146.128]) by smtp.gmail.com with ESMTPSA id bq30-20020a05620a469e00b00704a2a40cf2sm3657461qkb.38.2022.12.21.18.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Dec 2022 18:42:55 -0800 (PST) Date: Wed, 21 Dec 2022 21:42:54 -0500 From: Ben Boeckel To: Alejandro Colomar Cc: gcc@gcc.gnu.org, Andrew Clayton Subject: Re: -minstd: Require a minimum std version, without being specific Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.9 (2022-11-12) X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 Wed, Dec 21, 2022 at 19:33:48 +0100, Alejandro Colomar via Gcc wrote: > I've long had this wish: an option similar to -std, but which would not specify > the standard. Rather, mark a requirement that the standard be at least a version. > > This would be especially useful for libraries, which might for example require > C99 or C11 to work. They would be able to specify -minstd=c11 in their pc(5) > file (for use with pkgconf(1)). That way, a program using such library, would > be free to use -std to specify the C version that the project should be compiled > with; maybe gnu17, maybe even gnu2x. But if the program tries to compile under, > say gnu89, the compiler would report an error. (FD: CMake developer, ISO C++ SG15 committee member) I'd like to see us move away from "flag soup" and instead towards more structured information here. This request corresponds to CMake's `C_STANDARD` target property[1] which CMake then puts together to mean something. Note that there are real hazards with just putting the flags like this into `.pc` files directly. If you have a C library and say "-minstd=c99" and I'm C++, what is supposed to happen with this flag for a C++ compilre? Does it translate to C++11 (which is the first C++ standard to "fully contain" C99)? What if there is no answer (e.g., `-minstd=c23`)? FWIW, my idea is to broaden the concept CMake has of "usage requirements" to not be so CMake-centered and to encompass things like "you need an rpath to X to use my libraries" or even "here's an entry for `PYTHONPATH` to use my Python code". ISO C++'s SG15 has started discussion of such things with an eye towards standardization here: https://github.com/isocpp/pkg-fmt --Ben [1]https://cmake.org/cmake/help/latest/prop_tgt/C_STANDARD.html