This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: compiler standards (and/or min gcc version) supported withinstalled headers ?
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Andreas Jaeger <aj at suse dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 2 Jan 2013 14:57:25 +0000
- Subject: Re: compiler standards (and/or min gcc version) supported withinstalled headers ?
- References: <201212282357.52390.vapier@gentoo.org><Pine.LNX.4.64.1212291532490.13177@digraph.polyomino.org.uk><201212292022.55088.vapier@gentoo.org> <50E3EE2E.9070503@suse.com>
On Wed, 2 Jan 2013, Andreas Jaeger wrote:
> With us moving to require Linux 2.6.16 as oldest release (which is from 2006),
> we should be able to require a newer GCC version as well.
The minimum kernel version helps simplify the code and make a default
build more efficient by not including compatibility code; removing older
compiler support from installed headers (where not shared with gnulib)
doesn't give so much benefit.
I guess that in the cases where the condition is really for "compiler
supports feature X", we could move such __GNUC__ or __GNUC_PREREQ
conditions from random (not shared with gnulib) headers into sys/cdefs.h
and use appropriate feature macros / conditionals in the other headers -
and where the conditionals are on a GCC version 2.7 or earlier, they can
certainly become just __GNUC__ conditionals. And where it's of the form
"GCC version X optimizes this automatically, use a complicated macro
definition to optimize it for older versions" we could decide that inline
optimizations for older GCC aren't that important and the headers should
be simplified by eliminating them (making older GCC use the non-GCC
paths). Much the same may apply for not-fully-conforming variants for
older GCC (e.g. in bits/huge_val.h for versions not supporting
__builtin_huge_val).
In some cases conditionals on GCC should simply be removable. sys/stat.h
has a condition "#if defined __GNUC__ && __GNUC__ >= 2 && defined
__USE_EXTERN_INLINES" - but __USE_EXTERN_INLINES is only defined for GCC,
so no __GNUC__ conditions should be needed here. (The aim generally
should I think be to prefer feature conditionals over GCC ones in
individual headers.) malloc.h defines __MALLOC_P and __MALLOC_PMT
conditional on __GNUC__, but they are only used inside malloc.c, so should
simply be eliminated. There are probably other such examples as well.
Similarly to the elimination of old kernel support, it makes sense to
start by cleaning up the *really old* compiler support (pre-2.7) and GCC
conditionals in random files that aren't needed at all (or conditions that
aren't needed if you assume support for long long, for example).
> Btw. GCC 4.1 was released around the same time as Linux 2.6.16 in early 2006.
I think more of when support *ended* for a Linux kernel version as being
relevant here (July 2009 for 2.6.16, according to Wikipedia), i.e. we
might decide a certain time after the end of support for 2.6.16 that it is
no longer relevant to current glibc and move to a newer long-term-support
2.6 version such as 2.6.27 as the minimum. (I think we can move rather
sooner to increase the minimum kernel headers version - currently 2.6.19.1
- as opposed to the minimum kernel version used at runtime.)
--
Joseph S. Myers
joseph@codesourcery.com