* any value to numerous checks of "#ifdef __GNUC__"?
@ 2008-04-04 13:18 Robert P. J. Day
2008-04-04 14:44 ` walter harms
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Robert P. J. Day @ 2008-04-04 13:18 UTC (permalink / raw)
To: kernel-janitors
there are numerous header files that contain a check of the form
#ifdef __GNUC__
but <linux/compiler.h> already insists on a GNU C-flavoured compiler:
#if __GNUC__ >= 4
# include <linux/compiler-gcc4.h>
#elif __GNUC__ = 3 && __GNUC_MINOR__ >= 2
# include <linux/compiler-gcc3.h>
#else
# error Sorry, your compiler is too old/not recognized.
#endif
so is there any point in keeping all those checks around? is it
even remotely feasible that the kernel might someday support a non-GNU
C compiler, given the numerous gcc extensions that are used?
rday
--
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.
http://crashcourse.ca Waterloo, Ontario, CANADA
====================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: any value to numerous checks of "#ifdef __GNUC__"?
2008-04-04 13:18 any value to numerous checks of "#ifdef __GNUC__"? Robert P. J. Day
@ 2008-04-04 14:44 ` walter harms
2008-04-04 15:21 ` Robert P. J. Day
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: walter harms @ 2008-04-04 14:44 UTC (permalink / raw)
To: kernel-janitors
Robert P. J. Day wrote:
> there are numerous header files that contain a check of the form
>
> #ifdef __GNUC__
>
> but <linux/compiler.h> already insists on a GNU C-flavoured compiler:
>
> #if __GNUC__ >= 4
> # include <linux/compiler-gcc4.h>
> #elif __GNUC__ = 3 && __GNUC_MINOR__ >= 2
> # include <linux/compiler-gcc3.h>
> #else
> # error Sorry, your compiler is too old/not recognized.
> #endif
>
> so is there any point in keeping all those checks around? is it
> even remotely feasible that the kernel might someday support a non-GNU
> C compiler, given the numerous gcc extensions that are used?
>
> rday
> --
>
hi,
so far i know the intel compiler can compile a linux kernel.
ntl. this is most likely crap since the compiler is checked much more early.
(or at least should).
I only reason i can think of is that this module is used in other places outside
the linux kernle tree.
re,
wh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: any value to numerous checks of "#ifdef __GNUC__"?
2008-04-04 13:18 any value to numerous checks of "#ifdef __GNUC__"? Robert P. J. Day
2008-04-04 14:44 ` walter harms
@ 2008-04-04 15:21 ` Robert P. J. Day
2008-04-04 15:28 ` Robert P. J. Day
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Robert P. J. Day @ 2008-04-04 15:21 UTC (permalink / raw)
To: kernel-janitors
On Fri, 4 Apr 2008, walter harms wrote:
> Robert P. J. Day wrote:
> > there are numerous header files that contain a check of the form
> >
> > #ifdef __GNUC__
> >
> > but <linux/compiler.h> already insists on a GNU C-flavoured compiler:
> >
> > #if __GNUC__ >= 4
> > # include <linux/compiler-gcc4.h>
> > #elif __GNUC__ = 3 && __GNUC_MINOR__ >= 2
> > # include <linux/compiler-gcc3.h>
> > #else
> > # error Sorry, your compiler is too old/not recognized.
> > #endif
> >
> > so is there any point in keeping all those checks around? is it
> > even remotely feasible that the kernel might someday support a non-GNU
> > C compiler, given the numerous gcc extensions that are used?
> >
> > rday
> > --
> >
>
> hi,
> so far i know the intel compiler can compile a linux kernel.
i know, but even the intel compiler identifies itself as
GNU-compatible by defining __GNUC__.
> ntl. this is most likely crap since the compiler is checked much
> more early. (or at least should).
it is, as i point out above: linux/compiler.h.
> I only reason i can think of is that this module is used in other
> places outside the linux kernle tree.
perhaps, but unlikely, given the amount of checking that's being done
all over the place:
$ grep -r "#if.*__GNUC__" *
and, philosophically speaking, it's not clear that source in the
kernel tree is responsible for being compatible for being used in
environments *outside* of the tree.
i'm going to go with the position that it's crap and submit a few
patches to start ripping it out.
rday
--
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.
http://crashcourse.ca Waterloo, Ontario, CANADA
====================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: any value to numerous checks of "#ifdef __GNUC__"?
2008-04-04 13:18 any value to numerous checks of "#ifdef __GNUC__"? Robert P. J. Day
2008-04-04 14:44 ` walter harms
2008-04-04 15:21 ` Robert P. J. Day
@ 2008-04-04 15:28 ` Robert P. J. Day
2008-04-05 1:05 ` Darren Jenkins
2008-04-05 12:26 ` Robert P. J. Day
4 siblings, 0 replies; 6+ messages in thread
From: Robert P. J. Day @ 2008-04-04 15:28 UTC (permalink / raw)
To: kernel-janitors
On Fri, 4 Apr 2008, walter harms wrote:
> hi, so far i know the intel compiler can compile a linux kernel.
> ntl. this is most likely crap since the compiler is checked much
> more early. (or at least should).
actually, those checks could be reasonable for content exported to
userspace, but if it's not exported, i don't see any value to those
tests.
rday
--
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.
http://crashcourse.ca Waterloo, Ontario, CANADA
====================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: any value to numerous checks of "#ifdef __GNUC__"?
2008-04-04 13:18 any value to numerous checks of "#ifdef __GNUC__"? Robert P. J. Day
` (2 preceding siblings ...)
2008-04-04 15:28 ` Robert P. J. Day
@ 2008-04-05 1:05 ` Darren Jenkins
2008-04-05 12:26 ` Robert P. J. Day
4 siblings, 0 replies; 6+ messages in thread
From: Darren Jenkins @ 2008-04-05 1:05 UTC (permalink / raw)
To: kernel-janitors
On Sat, Apr 5, 2008 at 12:18 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> is it
> even remotely feasible that the kernel might someday support a non-GNU
> C compiler, given the numerous gcc extensions that are used?
I think people are working on getting tinycc to compile an un-modified
kernel, and I think LLVM is close-ish, also some BSD guys are working
on PCC so it might be able to compile the kernel in the
(distant?)future.
It concerns me a little that GCC is the only OSS compiler that can
compile the kernel.
Darren J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: any value to numerous checks of "#ifdef __GNUC__"?
2008-04-04 13:18 any value to numerous checks of "#ifdef __GNUC__"? Robert P. J. Day
` (3 preceding siblings ...)
2008-04-05 1:05 ` Darren Jenkins
@ 2008-04-05 12:26 ` Robert P. J. Day
4 siblings, 0 replies; 6+ messages in thread
From: Robert P. J. Day @ 2008-04-05 12:26 UTC (permalink / raw)
To: kernel-janitors
On Sat, 5 Apr 2008, Darren Jenkins wrote:
> On Sat, Apr 5, 2008 at 12:18 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> > is it even remotely feasible that the kernel might someday support
> > a non-GNU C compiler, given the numerous gcc extensions that are
> > used?
>
> I think people are working on getting tinycc to compile an
> un-modified kernel, and I think LLVM is close-ish, also some BSD
> guys are working on PCC so it might be able to compile the kernel in
> the (distant?)future.
>
> It concerns me a little that GCC is the only OSS compiler that can
> compile the kernel.
well, as i mentioned earlier, the intel compiler is also officially
approved, but it defines __GNUC__ so it masquerades as gcc, anyway.
and, as a followup to my original question, once i looked closer, it
does look like most of that "#ifdef __GNUC__" checking does get
exported to userspace, quite possibly for exactly the reason darren
mentions -- to support *userspace* non-gcc compilation. i'm sure
there are *some* superfluous in-kernel __GNUC__ tests, but probably
nowhere near as many as i first suspected.
rday
--
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.
http://crashcourse.ca Waterloo, Ontario, CANADA
====================================
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-04-05 12:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-04 13:18 any value to numerous checks of "#ifdef __GNUC__"? Robert P. J. Day
2008-04-04 14:44 ` walter harms
2008-04-04 15:21 ` Robert P. J. Day
2008-04-04 15:28 ` Robert P. J. Day
2008-04-05 1:05 ` Darren Jenkins
2008-04-05 12:26 ` Robert P. J. Day
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.