diff options
Diffstat (limited to 'source/include/acoutput.h')
-rw-r--r-- | source/include/acoutput.h | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/source/include/acoutput.h b/source/include/acoutput.h index 236124dda2781..e5da2a23501d1 100644 --- a/source/include/acoutput.h +++ b/source/include/acoutput.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2012, Intel Corp. + * Copyright (C) 2000 - 2013, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -285,7 +285,16 @@ * debug message outside of the print function itself. This improves overall * performance at a relatively small code cost. Implementation involves the * use of variadic macros supported by C99. + * + * Note: the ACPI_DO_WHILE0 macro is used to prevent some compilers from + * complaining about these constructs. On other compilers the do...while + * adds some extra code, so this feature is optional. */ +#ifdef ACPI_USE_DO_WHILE_0 +#define ACPI_DO_WHILE0(a) do a while(0) +#else +#define ACPI_DO_WHILE0(a) a +#endif /* DEBUG_PRINT functions */ @@ -294,17 +303,21 @@ /* Helper macros for DEBUG_PRINT */ -#define ACPI_DEBUG(Function, Level, Line, Filename, Modulename, Component, ...) \ - if (ACPI_IS_DEBUG_ENABLED (Level, Component)) \ - { \ - Function (Level, Line, Filename, Modulename, Component, __VA_ARGS__); \ - } +#define ACPI_DO_DEBUG_PRINT(Function, Level, Line, Filename, Modulename, Component, ...) \ + ACPI_DO_WHILE0 ({ \ + if (ACPI_IS_DEBUG_ENABLED (Level, Component)) \ + { \ + Function (Level, Line, Filename, Modulename, Component, __VA_ARGS__); \ + } \ + }) #define ACPI_ACTUAL_DEBUG(Level, Line, Filename, Modulename, Component, ...) \ - ACPI_DEBUG (AcpiDebugPrint, Level, Line, Filename, Modulename, Component, __VA_ARGS__) + ACPI_DO_DEBUG_PRINT (AcpiDebugPrint, Level, Line, \ + Filename, Modulename, Component, __VA_ARGS__) #define ACPI_ACTUAL_DEBUG_RAW(Level, Line, Filename, Modulename, Component, ...) \ - ACPI_DEBUG (AcpiDebugPrintRaw, Level, Line, Filename, Modulename, Component, __VA_ARGS__) + ACPI_DO_DEBUG_PRINT (AcpiDebugPrintRaw, Level, Line, \ + Filename, Modulename, Component, __VA_ARGS__) /* @@ -348,16 +361,7 @@ * * One of the FUNCTION_TRACE macros above must be used in conjunction * with these macros so that "_AcpiFunctionName" is defined. - * - * Note: the DO_WHILE0 macro is used to prevent some compilers from - * complaining about these constructs. On other compilers the do...while - * adds some extra code, so this feature is optional. */ -#ifdef ACPI_USE_DO_WHILE_0 -#define ACPI_DO_WHILE0(a) do a while(0) -#else -#define ACPI_DO_WHILE0(a) a -#endif /* Exit trace helper macro */ |