Discussion:
discussion seeked for c++ variants in USE_LANGUAGES
Richard PALO
2014-07-07 05:46:04 UTC
Permalink
Not finding much discussion about c++ variants in USE_LANGUAGES, I'd
like to open this topic with a proposal to add 'c++0x', 'c++11', 'c++1y'
and probably very soon 'c++14' where the default c++ (in gcc at least)
is c++98 plus extensions (aka gnu++98.

http://www.netbsd.org/~richard/lang_c++.patch

I've tinkered mostly with g++ but clang seems straight forward.

Initial observations:
Currently when 'c99' is set in USE_LANGUAGES, it is actually 'gnu99'
that is set for 'std=' (for gcc). I followed this usage in the prototype
for the above c++ variants.

Also, many pkgsrc Makefiles use, for example :
"USE_LANGUAGES+= c99 c++"
This may be okay for clang, but probably a message or some logic that
g++ use minimally 'c++0x' or 'c++11' is at hand.

While I notice that 'c11' hasn't been added, I wonder if adding all
these variants is really necessary (maybe only 'c++11' and 'c++14')
again, not so difficult for clang, but there are a lot of gcc versions
out there... not to mention sunpro or others.
Also, I guess I left out (on purpose) c++03....

The purpose of this is for simplicity in the vast majority of the pkgsrc
Makefiles... not having any c++ variants certainly does not simplify things.
Joerg Sonnenberger
2014-07-07 09:29:04 UTC
Permalink
Post by Richard PALO
Not finding much discussion about c++ variants in USE_LANGUAGES, I'd
like to open this topic with a proposal to add 'c++0x', 'c++11',
'c++1y' and probably very soon 'c++14' where the default c++ (in gcc
at least) is c++98 plus extensions (aka gnu++98.
c++0x should not be added, at most the compiler logic should use it for
c++11. That said, I'm not sure how useful it is for older GCC version,
given that e.g. GCC 4.5 is lacking a lot of the language features.

The other consideration is whether the language standard should be
gnuc++11 or c++11.

Joerg
Richard PALO
2014-07-08 13:53:38 UTC
Permalink
Post by Joerg Sonnenberger
Post by Richard PALO
Not finding much discussion about c++ variants in USE_LANGUAGES, I'd
like to open this topic with a proposal to add 'c++0x', 'c++11',
'c++1y' and probably very soon 'c++14' where the default c++ (in gcc
at least) is c++98 plus extensions (aka gnu++98.
c++0x should not be added, at most the compiler logic should use it for
c++11. That said, I'm not sure how useful it is for older GCC version,
given that e.g. GCC 4.5 is lacking a lot of the language features.
What are the native gcc compiler versions habitually used?

Myself, I bootstrap [currently] with a gcc 4.4 compiler, then I build
pkgsrc gcc >= 4.7 so no problem there.
Post by Joerg Sonnenberger
The other consideration is whether the language standard should be
gnuc++11 or c++11.
Has anybody tried changing the c99 defaults from 'gnu99' to 'c99' to see
what blows (like during a bulk build)?
Joerg Sonnenberger
2014-07-08 14:06:20 UTC
Permalink
Post by Richard PALO
Post by Joerg Sonnenberger
c++0x should not be added, at most the compiler logic should use it for
c++11. That said, I'm not sure how useful it is for older GCC version,
given that e.g. GCC 4.5 is lacking a lot of the language features.
What are the native gcc compiler versions habitually used?
NetBSD ships with either GCC 4.5 or 4.8. To pick an example of a large
scale C++11 application, clang 3.5 will need at least GCC 4.7 to build.
Post by Richard PALO
Post by Joerg Sonnenberger
The other consideration is whether the language standard should be
gnuc++11 or c++11.
Has anybody tried changing the c99 defaults from 'gnu99' to 'c99' to
see what blows (like during a bulk build)?
Very likely a lot, both due to disabled GNU extensions and the
additional restrictions in the C namespace.

Joerg
Greg Troxel
2014-07-08 23:00:03 UTC
Permalink
Post by Joerg Sonnenberger
Post by Richard PALO
Not finding much discussion about c++ variants in USE_LANGUAGES, I'd
like to open this topic with a proposal to add 'c++0x', 'c++11',
'c++1y' and probably very soon 'c++14' where the default c++ (in gcc
at least) is c++98 plus extensions (aka gnu++98.
c++0x should not be added, at most the compiler logic should use it for
c++11. That said, I'm not sure how useful it is for older GCC version,
given that e.g. GCC 4.5 is lacking a lot of the language features.
The other consideration is whether the language standard should be
gnuc++11 or c++11.
Without really thinking too hard, it seems obvious that each language
standard should have a name, and packages should declare what they
need. Then, the compiler.mk can map those standards to the right flags
and versions, or fail.

In the case of

gnuc++11
c++11

it seems that ideally programs would be written to the standard and
c++11 would be the right name. But surely many programs rely on gnu
extensions, and they'd get gnuc++11 as a USE_LANGUAGES value.

I don't see why the set of compilers shipped with NetBSD matters much,
as this is about configuring all sorts of compilers on many systems to
compile each package.

Loading...