On Friday 06 October 2006 02:07, Tom Rini wrote:
> On Thu, Oct 05, 2006 at 02:30:11PM -0700, Piet Delaney wrote:
> > On Thu, 2006-10-05 at 12:17 -0700, Tom Rini wrote:
> > > On Thu, Oct 05, 2006 at 08:46:20AM -0700, George Anzinger wrote:
> > > > Tom Rini wrote:
> > > > >On Wed, Oct 04, 2006 at 08:42:04PM -0700, Piet Delaney wrote:
> > > > >>Ton, George, Amit, et. al:
> > > > >>
> > > > >>If CONFIG_KGDB isn't defined, the kernel should be exactly the
> > > > >>same as when kgdb isn't integrated. So shouldn't we should add
> > > > >>#ifdef CONFIG_KGDB in the traps.c code where the traps are
> > > > >>initialized and panic notify is registered.
> > > > >
> > > > >No, because that makes the code look way too ugly.
> >
> > I agree that it's ugly, but until stock kernel wants to
> > do it this way I suspect that we will have an easier time
> > in being assimilated into the kernel.org repository by
> > being non-invasive.
>
> Right, non-invasive like always doing something at one point and always
> doing something else at another.
>
> > We can likely avoid uglyness with cpp macros.
>
> And introduce unmaintainability.

Well, please detail what you mean with your "CPP macros make code 
unmaintainable" statement, Tom Rini. I think that Piet Delaney is totally 
right about this, and I think he refers to the official coding style (see 
below for references). Documentation/SubmittingPatches explains this (it 
should be moved in CodingStyle however!) in Section 2, point #2.

So, I do not understand why you are discussing an issue which has been 
virtually standardized.

Arguing that this style causes unmaintainability is probably a bit like 
being "heretic" (no offense intended) since, for what I learnt while becoming 
a Linux kernel hacker (i.e. the past two years, but I learned it well since 
it was my first large C project and I'm just 20 years old), this is 
the "official" style.

Look at almost any function in include/linux/security.h, for instance, say 
security_ptrace() or security_init(). They are inline functions and have 
different definitions depending on settings.

Pieces of code as:
trap_init()
#ifdef CONFIG_KGDB
    if (kgdb_early_setup)
         return; /* Already done */
#endif

are usually translated with (chosen names are examples):

header file:
#ifdef CONFIG_KGDB
static inline int trap_setup_done()
{
    return kgdb_early_setup;
}
#else
static inline int trap_setup_done()
{
    return 0;
}
#endif
...
trap_init():
    if (trap_setup_done())
         return;

Note that given the name choice I could also remove the comment because it 
became obvious (that name may be appropriate or not).

I also do not understand why I'm here, since I usually work on UML, but I like 
this.
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade

Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to