[PATCH] trace/wscript: Improve C++ standard selection

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Aug 3 07:36:22 UTC 2023


Ping.

On 19.05.23 07:02, Sebastian Huber wrote:
> Use the latest C++ standard available up to C++20.
> 
> Close #4908.
> ---
>   trace/wscript | 18 +++++++++++++++---
>   1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/trace/wscript b/trace/wscript
> index a3dd5d5..adabd5f 100644
> --- a/trace/wscript
> +++ b/trace/wscript
> @@ -45,7 +45,14 @@ def configure(conf):
>       if conf.check(header_name='zlib.h', features='cxx', mandatory=False):
>           conf.check_cxx(lib = 'z')
>       conf.check_cxx(lib = 'ws2_32', mandatory=False)
> -    conf.check_cxx(cxxflags='-std=c++14', mandatory=False, define_name="HAVE_STD_CXX14")
> +    if conf.check_cxx(cxxflags='-std=c++20', mandatory=False, define_name="HAVE_STD_CXX20"):
> +        conf.env.append_value('CXXFLAGS', '-std=c++20')
> +    elif conf.check_cxx(cxxflags='-std=c++17', mandatory=False, define_name="HAVE_STD_CXX17"):
> +        conf.env.append_value('CXXFLAGS', '-std=c++17')
> +    elif conf.check_cxx(cxxflags='-std=c++14', mandatory=False, define_name="HAVE_STD_CXX14"):
> +        conf.env.append_value('CXXFLAGS', '-std=c++14')
> +    else:
> +        conf.env.append_value('CXXFLAGS', '-std=c++11')
>       conf.write_config_header('config.h')
>   
>   def build(bld):
> @@ -62,9 +69,14 @@ def build(bld):
>       conf['optflags'] = bld.env.C_OPTS
>       cstd = '-std=c99'
>       conf['cflags'] = [cstd] + ['-pipe', '-g'] + conf['optflags']
> -    cxxstd = '-std=c++11'
> -    if bld.env.HAVE_STD_CXX14:
> +    if bld.env.HAVE_STD_CXX20:
> +        cxxstd = '-std=c++20'
> +    elif bld.env.HAVE_STD_CXX17:
> +        cxxstd = '-std=c++17'
> +    elif bld.env.HAVE_STD_CXX14:
>           cxxstd = '-std=c++14'
> +    else:
> +        cxxstd = '-std=c++11'
>       conf['cxxflags'] = [cxxstd] + ['-pipe', '-g'] + conf['optflags']
>       conf['linkflags'] = ['-g']
>       conf['lib'] = []

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list