Message ID | 1418072550-16407-2-git-send-email-mike.holmes@linaro.org |
---|---|
State | Accepted |
Headers | show |
On Mon, Dec 8, 2014 at 11:02 PM, Mike Holmes <mike.holmes@linaro.org> wrote: > Move the macros that are not used in the API internally: > ODP_LOG > ODP_PRINT > ODP_ASSERT > ODP_DEPRICATED > ODP_UNUSED > > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-by: Ciprian Barbu <ciprian.barbu@linaro.org> > --- > platform/linux-generic/include/api/odp_debug.h | 36 ---------------- > .../linux-generic/include/odp_debug_internal.h | 50 +++++++++++++++++++++- > platform/linux-generic/odp_buffer.c | 1 + > 3 files changed, 50 insertions(+), 37 deletions(-) > > diff --git a/platform/linux-generic/include/api/odp_debug.h b/platform/linux-generic/include/api/odp_debug.h > index cb2c3e9..f5e6821 100644 > --- a/platform/linux-generic/include/api/odp_debug.h > +++ b/platform/linux-generic/include/api/odp_debug.h > @@ -12,9 +12,6 @@ > #ifndef ODP_DEBUG_H_ > #define ODP_DEBUG_H_ > > -#include <stdio.h> > -#include <stdlib.h> > -#include <stdarg.h> > > #ifdef __cplusplus > extern "C" { > @@ -27,15 +24,6 @@ extern "C" { > > #ifdef __GNUC__ > > -/** > - * Indicate deprecated variables, functions or types > - */ > -#define ODP_DEPRECATED __attribute__((__deprecated__)) > - > -/** > - * Intentionally unused variables ot functions > - */ > -#define ODP_UNUSED __attribute__((__unused__)) > > #if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) > > @@ -48,21 +36,10 @@ extern "C" { > > #endif > > -#else > > -#define ODP_DEPRECATED > -#define ODP_UNUSED > > #endif > > -/** > - * Runtime assertion-macro - aborts if 'cond' is false. > - */ > -#define ODP_ASSERT(cond, msg) \ > - do { if ((ODP_DEBUG == 1) && (!(cond))) { \ > - ODP_ERR("%s\n", msg); \ > - abort(); } \ > - } while (0) > > /** > * Compile time assertion-macro - fail compilation if cond is false. > @@ -98,19 +75,6 @@ typedef enum odp_log_level { > */ > extern int odp_override_log(odp_log_level_e level, const char *fmt, ...); > > -/** > - * ODP LOG macro. > - */ > -#define ODP_LOG(level, fmt, ...) \ > - odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ > - __LINE__, __func__, ##__VA_ARGS__) > - > -/** > - * Log print message when the application calls one of the ODP APIs > - * specifically for dumping internal data. > - */ > -#define ODP_PRINT(fmt, ...) \ > - odp_override_log(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) > > > /** > diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h > index 647ebde..f6180d1 100644 > --- a/platform/linux-generic/include/odp_debug_internal.h > +++ b/platform/linux-generic/include/odp_debug_internal.h > @@ -16,11 +16,45 @@ > #ifndef ODP_DEBUG_INTERNAL_H_ > #define ODP_DEBUG_INTERNAL_H_ > > +#include <stdio.h> > +#include <stdlib.h> > +#include <stdarg.h> > +#include <odp_debug.h> > #ifdef __cplusplus > extern "C" { > #endif > > -#include <odp_debug.h> > +/** @addtogroup odp_ver_abt_log_dbg > + * @{ > + */ > + > +#ifdef __GNUC__ > + > +/** > + * Indicate deprecated variables, functions or types > + */ > +#define ODP_DEPRECATED __attribute__((__deprecated__)) > + > +/** > + * Intentionally unused variables ot functions > + */ > +#define ODP_UNUSED __attribute__((__unused__)) > + > +#else > + > +#define ODP_DEPRECATED > +#define ODP_UNUSED > + > +#endif > + > +/** > + * Runtime assertion-macro - aborts if 'cond' is false. > + */ > +#define ODP_ASSERT(cond, msg) \ > + do { if ((ODP_DEBUG == 1) && (!(cond))) { \ > + ODP_ERR("%s\n", msg); \ > + abort(); } \ > + } while (0) > > /** > * This macro is used to indicate when a given function is not implemented > @@ -54,6 +88,20 @@ extern "C" { > abort(); \ > } while (0) > > +/** > + * ODP LOG macro. > + */ > +#define ODP_LOG(level, fmt, ...) \ > + odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ > + __LINE__, __func__, ##__VA_ARGS__) > + > +/** > + * Log print message when the application calls one of the ODP APIs > + * specifically for dumping internal data. > + */ > +#define ODP_PRINT(fmt, ...) \ > + odp_override_log(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) > + > #ifdef __cplusplus > } > #endif > diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c > index bcbb99a..df68aa9 100644 > --- a/platform/linux-generic/odp_buffer.c > +++ b/platform/linux-generic/odp_buffer.c > @@ -7,6 +7,7 @@ > #include <odp_buffer.h> > #include <odp_buffer_internal.h> > #include <odp_buffer_pool_internal.h> > +#include <odp_debug_internal.h> > > #include <string.h> > #include <stdio.h> > -- > 2.1.0 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/platform/linux-generic/include/api/odp_debug.h b/platform/linux-generic/include/api/odp_debug.h index cb2c3e9..f5e6821 100644 --- a/platform/linux-generic/include/api/odp_debug.h +++ b/platform/linux-generic/include/api/odp_debug.h @@ -12,9 +12,6 @@ #ifndef ODP_DEBUG_H_ #define ODP_DEBUG_H_ -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> #ifdef __cplusplus extern "C" { @@ -27,15 +24,6 @@ extern "C" { #ifdef __GNUC__ -/** - * Indicate deprecated variables, functions or types - */ -#define ODP_DEPRECATED __attribute__((__deprecated__)) - -/** - * Intentionally unused variables ot functions - */ -#define ODP_UNUSED __attribute__((__unused__)) #if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) @@ -48,21 +36,10 @@ extern "C" { #endif -#else -#define ODP_DEPRECATED -#define ODP_UNUSED #endif -/** - * Runtime assertion-macro - aborts if 'cond' is false. - */ -#define ODP_ASSERT(cond, msg) \ - do { if ((ODP_DEBUG == 1) && (!(cond))) { \ - ODP_ERR("%s\n", msg); \ - abort(); } \ - } while (0) /** * Compile time assertion-macro - fail compilation if cond is false. @@ -98,19 +75,6 @@ typedef enum odp_log_level { */ extern int odp_override_log(odp_log_level_e level, const char *fmt, ...); -/** - * ODP LOG macro. - */ -#define ODP_LOG(level, fmt, ...) \ - odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__) - -/** - * Log print message when the application calls one of the ODP APIs - * specifically for dumping internal data. - */ -#define ODP_PRINT(fmt, ...) \ - odp_override_log(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) /** diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index 647ebde..f6180d1 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -16,11 +16,45 @@ #ifndef ODP_DEBUG_INTERNAL_H_ #define ODP_DEBUG_INTERNAL_H_ +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <odp_debug.h> #ifdef __cplusplus extern "C" { #endif -#include <odp_debug.h> +/** @addtogroup odp_ver_abt_log_dbg + * @{ + */ + +#ifdef __GNUC__ + +/** + * Indicate deprecated variables, functions or types + */ +#define ODP_DEPRECATED __attribute__((__deprecated__)) + +/** + * Intentionally unused variables ot functions + */ +#define ODP_UNUSED __attribute__((__unused__)) + +#else + +#define ODP_DEPRECATED +#define ODP_UNUSED + +#endif + +/** + * Runtime assertion-macro - aborts if 'cond' is false. + */ +#define ODP_ASSERT(cond, msg) \ + do { if ((ODP_DEBUG == 1) && (!(cond))) { \ + ODP_ERR("%s\n", msg); \ + abort(); } \ + } while (0) /** * This macro is used to indicate when a given function is not implemented @@ -54,6 +88,20 @@ extern "C" { abort(); \ } while (0) +/** + * ODP LOG macro. + */ +#define ODP_LOG(level, fmt, ...) \ + odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ + __LINE__, __func__, ##__VA_ARGS__) + +/** + * Log print message when the application calls one of the ODP APIs + * specifically for dumping internal data. + */ +#define ODP_PRINT(fmt, ...) \ + odp_override_log(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c index bcbb99a..df68aa9 100644 --- a/platform/linux-generic/odp_buffer.c +++ b/platform/linux-generic/odp_buffer.c @@ -7,6 +7,7 @@ #include <odp_buffer.h> #include <odp_buffer_internal.h> #include <odp_buffer_pool_internal.h> +#include <odp_debug_internal.h> #include <string.h> #include <stdio.h>
Move the macros that are not used in the API internally: ODP_LOG ODP_PRINT ODP_ASSERT ODP_DEPRICATED ODP_UNUSED Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- platform/linux-generic/include/api/odp_debug.h | 36 ---------------- .../linux-generic/include/odp_debug_internal.h | 50 +++++++++++++++++++++- platform/linux-generic/odp_buffer.c | 1 + 3 files changed, 50 insertions(+), 37 deletions(-)