tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: GCC g++ 4.4.7 does not accept -std=c++03



Hi,

Jonathan Perkin <jperkin%joyent.com@localhost> writes:

> * On 2019-06-28 at 09:17 BST, Ryo ONODERA wrote:
>
>> Jonathan Perkin <jperkin%joyent.com@localhost> writes:
>> 
>> > * On 2019-06-26 at 16:56 BST, Ryo ONODERA wrote:
>> >
>> >> I will commit the following patch.
>> >> 
>> >> Index: mk/compiler/gcc.mk
>> >> ===================================================================
>> >> RCS file: /cvsroot/pkgsrc/mk/compiler/gcc.mk,v
>> >> retrieving revision 1.198
>> >> diff -u -r1.198 gcc.mk
>> >> --- mk/compiler/gcc.mk	12 Nov 2018 14:22:58 -0000	1.198
>> >> +++ mk/compiler/gcc.mk	26 Jun 2019 15:55:12 -0000
>> >> @@ -185,6 +185,11 @@
>> >>  .endif
>> >>  _GCC_PKG=	gcc-${_GCC_VERSION:C/-.*$//}
>> >>  
>> >> +.if !empty(_GCC_VERSION:M[34].[1234].*)
>> >> +BUILDLINK_TRANSFORM+=	opt:-std=c++03:-std=c++0x
>> >> +BUILDLINK_TRANSFORM+=	opt:-std=gnu++03:-std=gnu++0x
>> >> +.endif
>> >> +
>> >
>> > If we're really going to do this (I don't see the point when so much
>> > software now depends on newer compilers) then please do it properly
>> > and abstract away the current _CXX_VERSION_REQD bits in mk/compiler.mk
>> > into the separate compiler files and handle the logic in gcc.mk.
>> 
>> I have no idea about an history of _CXX_VERSION_REQD.
>> However I feel that _CXX_VERSION_REQD should set GCC_REQD.
>> Do you know why the current _CXX_VERSION_REQD does not handle
>> GCC_REQD?
>
> I'll leave it to the others to answer the latter part of this, as we
> disagree on the way forward and I don't want to prejudice the
> discussion.
>
> As for _CXX_VERSION_REQD all I mean is that this should be done in the
> proper way, abstracted into the compiler-specific files, so something
> like (untested):
>
>   mk/compiler/clang.mk:
>   .for _std_ in gnu++14 c++14 gnu++11 c++11 gnu++0x c++0x gnu++03 c++03
>   _CXX_STD_FLAG.${_std}?=	-std=${_std_}
>   .endfor
>
>   mk/compiler/gcc.mk:
>   .for _std_ in gnu++14 c++14 gnu++11 c++11 gnu++0x c++0x gnu++03 c++03
>   _CXX_STD_FLAG.${_std}?=	-std=${_std_}
>   .endfor
>   .if !empty(_GCC_VERSION:M[34].[1234].*)
>   _CXX_STD_FLAG.c++03=		-std=c++0x
>   _CXX_STD_FLAG.gnu++03=	-std=gnu++0x
>   .endif
>
>   mk/compiler.mk:
>   CWRAPPERS_PREPEND.cxx+=	${_CXX_STD_FLAG.${_CXX_VERSION_REQD}}
>
> You get the idea.  This way we're cleanly setting the flag once, not
> setting it first to the wrong value in compiler.mk and then fixing it
> up with transformations later.

I had misunderstood your previous e-mail.

Your code is absolutely better than mine and it makes sense.
Thanks for your explanation.

I will create another patch like yours later.

Thank you.

> -- 
> Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com

-- 
Ryo ONODERA // ryo%tetera.org@localhost
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


Home | Main Index | Thread Index | Old Index