Contiki 3.x
Macros
debug.h File Reference

Debug helpers. More...

Go to the source code of this file.

Macros

#define GLOBAL_DEBUG   0
 Globally turn debugging on and off. More...
 
#define DEBUG(fmt,...)   do { if (DEBUG_VAL) printf("%16s%-36s " fmt, AT, __func__, ## __VA_ARGS__); } while(0)
 DEBUG Printing. More...
 

Detailed Description

Debug helpers.

Define DEBUG_ON before this file is included to enable debug printing. Do not define it to disable it. Call DEBUG() to print.

Implementation note: Purpusfully not in an include guard as it should only be included by c files. This will cause a compile time error if it is included more than once.

Author
Arthur Fabre af1g1.nosp@m.2@ec.nosp@m.s.sot.nosp@m.on.a.nosp@m.c.uk

Definition in file debug.h.

Macro Definition Documentation

#define DEBUG (   fmt,
  ... 
)    do { if (DEBUG_VAL) printf("%16s%-36s " fmt, AT, __func__, ## __VA_ARGS__); } while(0)

DEBUG Printing.

Implementation note: A c and not a macro if statement is used to ensure that the print statement is passed to the compiler. This ensures that the DEBUG statement is always valid, even when debugging is disabled. If debugging is disabled this will be optimized out by the compiler. The do while loop makes the macro exapand to a proper statement (and not a conditional).

Definition at line 46 of file debug.h.

#define GLOBAL_DEBUG   0

Globally turn debugging on and off.

0: Off

Definition at line 20 of file debug.h.