All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [RFD] Consistent debugging output structure
@ 2003-03-19 18:32 Robert Schwebel
  2003-03-22 10:28 ` Robert Schwebel
  0 siblings, 1 reply; 19+ messages in thread
From: Robert Schwebel @ 2003-03-19 18:32 UTC (permalink / raw)
  To: u-boot

Hi, 

I would like to discuss the current state of the u-boot debug output
code. Nearly every C file in the source tree implements it's own way of
outputting debug messages during development, and most of them do it by
using Yet Another #ifdef Desert (TM). 

Therfore, I would like to propose that we add a generic header file,
something like this: 

----------8<----------
#ifndef __UDEBUG_H
#define __UDEBUG_H

#if (DEBUG > 2 )
#define DBG_PRINTF3(fmt,args...) printf(fmt ,##args)
#define DBG_PUTS3(args...) puts(args)
#else
#define DBG_PRINTF3(fmt,args...)
#define DBG_PUTS3(args...)
#endif

#if (DEBUG > 1)
#define DBG_PRINTF2(fmt,args...) printf(fmt ,##args)
#define DBG_PUTS2(args...) puts(args)
#else
#define DBG_PRINTF2(fmt,args...)
#define DBG_PUTS2(args...)
#endif

#ifdef DEBUG
#define DBG_PRINTF(fmt,args...) printf(fmt ,##args)
#define DBG_PUTS(args...) puts(args)
#else
#define DBG_PRINTF(fmt,args...)
#define DBG_PUTS(args...)
#endif

#endif /* __UDEBUG_H */
---------->8----------

which could be included by every file that wants to make debug outputs;
it just had to define the DEBUG level before it #includes udebug.h. 

The transition could be done incrementally - it just has to be
documented somewhere that this is the preferred method. 

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2003-03-24  9:19 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-19 18:32 [U-Boot-Users] [RFD] Consistent debugging output structure Robert Schwebel
2003-03-22 10:28 ` Robert Schwebel
2003-03-22 21:35   ` Vladimir Gurevich
2003-03-23  0:51     ` Vladimir Gurevich
2003-03-23 14:32   ` Wolfgang Denk
2003-03-24  6:29     ` Robert Schwebel
2003-03-24  8:14       ` Wolfgang Denk
2003-03-24  8:23         ` Robert Schwebel
2003-03-24  8:52           ` Wolfgang Denk
2003-03-24  8:59             ` Robert Schwebel
2003-03-24  9:10               ` Wolfgang Denk
2003-03-24  7:44     ` Holger Schurig
2003-03-24  8:36       ` Robert Schwebel
2003-03-24  8:57         ` Wolfgang Denk
2003-03-24  9:03           ` Robert Schwebel
2003-03-24  9:19             ` Wolfgang Denk
2003-03-24  8:50       ` Wolfgang Denk
2003-03-24  9:00         ` Robert Schwebel
2003-03-24  9:16           ` Wolfgang Denk

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.