Web lists-archives.com

Re: Mandates explicit -std=c++XY for c++ projects




On Tue, Oct 10, 2017 at 9:05 AM, Julien Cristau <jcristau@xxxxxxxxxx> wrote:
> On Tue, Oct 10, 2017 at 08:45:49 +0200, Mathieu Malaterre wrote:
>
>> Dear all,
>>
>> Since the GCC 6 release [1], the default mode for C++ is now
>> -std=gnu++14 instead of -std=gnu++98. What this means is that upon
>> (re)compilation a library written for c++98 will be recompiled using a
>> different c++ standard (c++14 in this case), unless of course the
>> upstream package explicitly set the -std= flags with the appropriate
>> c++ version.
>>
>> The ISO committee generally describe the change in between different
>> standards [2] and in some case, one can find examples of subtle change
>> in behaviors [3] and [4].
>>
>> With this mind I'd like to make mandatory the -std=c++XY flags when
>> compiling either a c++ library or a stand-alone c++ program:
>>
>> 1. Either upstream define the explicit -std=c++XY flags by mean of its
>> build system,
>> 2. Or the package maintainers needs to explicit change the CXXFLAGS to
>> pass the appropriate version of the c++ standard. In which case this
>> should be documented in the README.Debian file.
>> 3. As a fallback, dh should initialize the CXXFLAGS with -std=gnu++98
>>
> It might be useful to explain what problem you think that would fix.
> The above sounds to me like a step backwards.

You removed the links. But I assumed you saw there were removed and
deprecated features. Which means using this explicit mechanism a
Debian package will not FTBFS -say- whenever the next GCC release jump
from -std=gnu++14 to -std=gnu++17. This also clearly defines the ABI
of the shared libraries which IMHO is also a good things (with regards
to symbols). And to a lesser extend the subttle difference in between
c++98 / c++11 and C++14 are clearly avoided (while I admit no sane
person will provide a c++ project using an examples from the provided
SO links I sent).

>> If there is a consensus on the following change, I'll go ahead and
>> also file a bug for lintian to scan the compilation logs in search for
>> missing -std=c++ expression when g++ command line are issued.
>>
> lintian doesn't scan build logs, it scans source and binary packages.

Right. I always forgot that. What is the mechanism used for
shlib-calls-exit, does it rely on source parsing ?