220 19419 <mpb9cr$bat$1@ger.gmane.org> article
Path: news.gmane.org!not-for-mail
From: Matthew Woehlke <mwoehlke.floss@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Testing for supported features: Per-feature
 macros? Sentinel compilation?
Date: Wed, 29 Jul 2015 15:26:19 -0400
Lines: 60
Approved: news@gmane.org
Message-ID: <mpb9cr$bat$1@ger.gmane.org>
References: <e5919c40-d35e-4309-b5b8-6525a4eb443c@isocpp.org> <47831edb-dbc1-413e-9886-95e357c3bf20@isocpp.org> <255fd5fb-cf04-431f-a576-d30926b86674@isocpp.org> <1646231.xfnxM1QXYz@tjmaciei-mobl4> <d3f56319-8403-47db-a048-7bcbeeec85ed@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1438198008 12159 80.91.229.3 (29 Jul 2015 19:26:48 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 29 Jul 2015 19:26:48 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC37LBFWUIFBB3GR4SWQKGQEEB4GS3I@isocpp.org Wed Jul 29 21:26:40 2015
Return-path: <std-proposals+bncBC37LBFWUIFBB3GR4SWQKGQEEB4GS3I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f200.google.com ([209.85.217.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC37LBFWUIFBB3GR4SWQKGQEEB4GS3I@isocpp.org>)
	id 1ZKWzv-0004kL-GH
	for gclcip-std-proposals@m.gmane.org; Wed, 29 Jul 2015 21:26:39 +0200
Original-Received: by lbcjf8 with SMTP id jf8sf7078444lbc.0
        for <gclcip-std-proposals@m.gmane.org>; Wed, 29 Jul 2015 12:26:39 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:content-type:user-agent:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=wYi38JnCZ7FU4VbYwUEqwsJzcfv7UyUtLRd58kdMA/s=;
        b=eD5mkIX7AlHNEqnPJ588l5oaW+cLYpTMH16e1j8XRNuXtIHJhk3m37W6fjka16k6kJ
         qOLBOd0M49IKnuTBxPV5BPAvInOwsJLHJQSzySNL3mRlOftKZTM77EgzLQAjbUbwgz2P
         S73Vqr/NliEljpRZEyE58UKXLLKgWmmROBwldcbtRnNRbrwnAosgpxBTotZGP68SbE81
         r4P4b0WEiqGTrIP21rYZtIvliH15eraROBaUc8s8glorf0CZRrE+7egPZlJ6N3fpgD3M
         XGFZPIgffzgo3W15pYvLr/QnfFVGXEje253E83gWL40JWh49hc3rodC0kE9qf9n3H/nx
         
X-Gm-Message-State: ALoCoQnEIz4PXGsx3gV3uW6oc1RIGGv2etNRVgJjSKu0eUo86DlN0WyVWqySac0kLqc7dGiEvtl3
X-Received: by 10.112.99.37 with SMTP id en5mr16415333lbb.7.1438197998955;
        Wed, 29 Jul 2015 12:26:38 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.204.40 with SMTP id kv8ls83601lac.94.gmail; Wed, 29 Jul
 2015 12:26:36 -0700 (PDT)
X-Received: by 10.112.124.164 with SMTP id mj4mr40020302lbb.3.1438197996239;
        Wed, 29 Jul 2015 12:26:36 -0700 (PDT)
Original-Received: from plane.gmane.org (plane.gmane.org. [80.91.229.3])
        by mx.google.com with ESMTPS id la8si22307735lac.132.2015.07.29.12.26.36
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Wed, 29 Jul 2015 12:26:36 -0700 (PDT)
Received-SPF: pass (google.com: domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as permitted sender) client-ip=80.91.229.3;
Original-Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1ZKWzq-0004hm-3A
	for std-proposals@isocpp.org; Wed, 29 Jul 2015 21:26:34 +0200
Original-Received: from tripoint.kitware.com ([66.194.253.20])
        by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Wed, 29 Jul 2015 21:26:34 +0200
Original-Received: from mwoehlke.floss by tripoint.kitware.com with local (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Wed, 29 Jul 2015 21:26:34 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 51
Original-X-Complaints-To: usenet@ger.gmane.org
X-Gmane-NNTP-Posting-Host: tripoint.kitware.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To: <d3f56319-8403-47db-a048-7bcbeeec85ed@isocpp.org>
X-Original-Sender: mwoehlke.floss@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as
 permitted sender) smtp.mail=gclcip-std-proposals@m.gmane.org;
       dmarc=fail (p=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:19419
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19419>

On 2015-07-27 00:15, denis bider wrote:
> On 2015-07-26 23:21, Thiago Macieira wrote:
>> I'm skeptical how much the compiler could recover in case
>> of a syntax it does not understand with your proposal. 
> 
> If it cannot parse something within the block, it would note that as a test 
> block error (not a compilation error); skip the current line, and skip any 
> further lines until the first one that's a preprocessor directive.
> 
> The first line that's a preprocessor directive marks the end of the test 
> block.

You do realize that by the time the compiler sees the code, the PP has
already run?

You would need something other than PP markup to denote the beginning
and end of feature-test blocks.

TBH I think the idea is interesting, but I just don't see how it would
ever work except to have the compiler interrupt compiling, spin up a
separate "process" (not necessarily in the POSIX sense) to attempt to
compile some external, self-contained hunk of code, and act on the
result. The problem there is that the standard has strongly resisted
specifying anything about how the compiler interacts with the system,
i.e. anything beyond it consuming text from an input stream. Ergo I
think you would have a serious uphill battle to get such a feature
accepted. (Similarly, there is a lot of resistance to any PP changes.)

> If I have control over the build system, I don't have the problem to begin 
> with. In that case, I can also choose the compiler, and I know what 
> features it implements and what it doesn't.
> 
> The problem mainly exists for libraries; especially cross-platform 
> libraries, and such a library can't rely on a single build system.

I take it you are talking about the case of your library headers being
used by some consumer? Is that even *wise* to be changing your build
configuration at that point? In my experience, it's more typical that
users are required to use a compiler at least as capable as the one used
to build the library, and the library hard-codes what features were
enabled when it was built. (Some may even attempt to force matching
compiler abilities.)

Incidentally, CMake-based projects certainly encourage consumers to also
use CMake :-). (And CMake has feature tests. You can even arrange for
requests to use your library - i.e. by the consumer's build - to re-run
feature tests in the consumer's environment and propagate the results to
anyone using your library.)

-- 
Matthew

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.
