ACPICA: Cleanup ACPI_DEBUG_PRINT macros to fix potential build breakages.

Fix two issues with the ACPI_DEBUG_PRINT macros.
1) Add the ACPI_DO_WHILE0 macro to the main DEBUG_PRINT helper macro.
2) Rename ACPI_DEBUG macro to ACPI_DO_DEBUG_PRINT since ACPI_DEBUG
   is already commonly used by the various hosts.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Bob Moore 2013-01-08 23:46:04 +01:00 коммит произвёл Rafael J. Wysocki
Родитель f55994f205
Коммит 6e1888fdca
1 изменённых файлов: 20 добавлений и 16 удалений

Просмотреть файл

@ -281,7 +281,16 @@
* debug message outside of the print function itself. This improves overall * debug message outside of the print function itself. This improves overall
* performance at a relatively small code cost. Implementation involves the * performance at a relatively small code cost. Implementation involves the
* use of variadic macros supported by C99. * 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 */ /* DEBUG_PRINT functions */
@ -290,17 +299,21 @@
/* Helper macros for DEBUG_PRINT */ /* Helper macros for DEBUG_PRINT */
#define ACPI_DEBUG(function, level, line, filename, modulename, component, ...) \ #define ACPI_DO_DEBUG_PRINT(function, level, line, filename, modulename, component, ...) \
if (ACPI_IS_DEBUG_ENABLED (level, component)) \ ACPI_DO_WHILE0 ({ \
{ \ if (ACPI_IS_DEBUG_ENABLED (level, component)) \
function (level, line, filename, modulename, component, __VA_ARGS__); \ { \
} function (level, line, filename, modulename, component, __VA_ARGS__); \
} \
})
#define ACPI_ACTUAL_DEBUG(level, line, filename, modulename, component, ...) \ #define ACPI_ACTUAL_DEBUG(level, line, filename, modulename, component, ...) \
ACPI_DEBUG (acpi_debug_print, level, line, filename, modulename, component, __VA_ARGS__) ACPI_DO_DEBUG_PRINT (acpi_debug_print, level, line, \
filename, modulename, component, __VA_ARGS__)
#define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \ #define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \
ACPI_DEBUG (acpi_debug_print_raw, level, line, filename, modulename, component, __VA_ARGS__) ACPI_DO_DEBUG_PRINT (acpi_debug_print_raw, level, line, \
filename, modulename, component, __VA_ARGS__)
/* /*
* Function entry tracing * Function entry tracing
@ -342,16 +355,7 @@
* *
* One of the FUNCTION_TRACE macros above must be used in conjunction * One of the FUNCTION_TRACE macros above must be used in conjunction
* with these macros so that "_AcpiFunctionName" is defined. * 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 */ /* Exit trace helper macro */