Message ID | 1417619942-14233-3-git-send-email-taras.kondratiuk@linaro.org |
---|---|
State | Accepted |
Commit | 0555b2b5c2ac3d0c5d865d987242d01ce8316a01 |
Headers | show |
On Wed, Dec 3, 2014 at 9:19 AM, Taras Kondratiuk < taras.kondratiuk@linaro.org> wrote: > Move additional functionality out of ODP_LOG. Keep only logging. > > Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> > Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > platform/linux-generic/include/api/odp_debug.h | 43 > +++++--------------- > .../linux-generic/include/odp_debug_internal.h | 6 ++- > 2 files changed, 15 insertions(+), 34 deletions(-) > > diff --git a/platform/linux-generic/include/api/odp_debug.h > b/platform/linux-generic/include/api/odp_debug.h > index aa99e29..1f5eaff 100644 > --- a/platform/linux-generic/include/api/odp_debug.h > +++ b/platform/linux-generic/include/api/odp_debug.h > @@ -102,48 +102,24 @@ extern int odp_override_log(odp_log_level_e level, > const char *fmt, ...); > * ODP LOG macro. > */ > #define ODP_LOG(level, fmt, ...) \ > -do { \ > - switch (level) { \ > - case ODP_LOG_ERR: \ > - odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ > - __LINE__, __func__, ##__VA_ARGS__); \ > - break; \ > - case ODP_LOG_DBG: \ > - if (ODP_DEBUG_PRINT == 1) \ > - odp_override_log(level, "%s:%d:%s():" fmt, > __FILE__, \ > - __LINE__, __func__, ##__VA_ARGS__); \ > - break; \ > - case ODP_LOG_PRINT: \ > - odp_override_log(level, " " fmt, ##__VA_ARGS__); \ > - break; \ > - case ODP_LOG_ABORT: \ > - odp_override_log(level, "%s:%d:%s(): " fmt, __FILE__, \ > - __LINE__, __func__, ##__VA_ARGS__); \ > - abort(); \ > - break; \ > - case ODP_LOG_UNIMPLEMENTED: \ > - odp_override_log(level, \ > - "%s:%d:The function %s() is not implemented\n" \ > - fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__); > \ > - break; \ > - default: \ > - odp_override_log(level, "Unknown LOG level"); \ > - break;\ > - } \ > -} while (0) > + 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_LOG(ODP_LOG_PRINT, fmt, ##__VA_ARGS__) > + odp_override_log(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) > > /** > * Log debug message if ODP_DEBUG_PRINT flag is set. > */ > #define ODP_DBG(fmt, ...) \ > - ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__) > + do { \ > + if (ODP_DEBUG_PRINT == 1) \ > + ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__);\ > + } while (0) > > /** > * Log error message. > @@ -156,7 +132,10 @@ do { \ > * This function should not return. > */ > #define ODP_ABORT(fmt, ...) \ > - ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__) > + do { \ > + ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \ > + abort(); \ > + } while (0) > > /** > * @} > diff --git a/platform/linux-generic/include/odp_debug_internal.h > b/platform/linux-generic/include/odp_debug_internal.h > index a87552f..ee3c543 100644 > --- a/platform/linux-generic/include/odp_debug_internal.h > +++ b/platform/linux-generic/include/odp_debug_internal.h > @@ -25,8 +25,10 @@ extern "C" { > /** > * This macro is used to indicate when a given function is not implemented > */ > -#define ODP_UNIMPLEMENTED(fmt, ...) \ > - ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__) > +#define ODP_UNIMPLEMENTED() \ > + odp_override_log(ODP_LOG_UNIMPLEMENTED, \ > + "%s:%d:The function %s() is not implemented\n", \ > + __FILE__, __LINE__, __func__) > > #ifdef __cplusplus > } > -- > 1.7.9.5 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
On 3 December 2014 at 11:57, Bill Fischofer <bill.fischofer@linaro.org> wrote: > > > On Wed, Dec 3, 2014 at 9:19 AM, Taras Kondratiuk < > taras.kondratiuk@linaro.org> wrote: > >> Move additional functionality out of ODP_LOG. Keep only logging. >> >> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> >> > > Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> > Reviewed-by: Mike Holmes <mike.holmes@linaro.org> > > >> --- >> platform/linux-generic/include/api/odp_debug.h | 43 >> +++++--------------- >> .../linux-generic/include/odp_debug_internal.h | 6 ++- >> 2 files changed, 15 insertions(+), 34 deletions(-) >> >> diff --git a/platform/linux-generic/include/api/odp_debug.h >> b/platform/linux-generic/include/api/odp_debug.h >> index aa99e29..1f5eaff 100644 >> --- a/platform/linux-generic/include/api/odp_debug.h >> +++ b/platform/linux-generic/include/api/odp_debug.h >> @@ -102,48 +102,24 @@ extern int odp_override_log(odp_log_level_e level, >> const char *fmt, ...); >> * ODP LOG macro. >> */ >> #define ODP_LOG(level, fmt, ...) \ >> -do { \ >> - switch (level) { \ >> - case ODP_LOG_ERR: \ >> - odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ >> - __LINE__, __func__, ##__VA_ARGS__); \ >> - break; \ >> - case ODP_LOG_DBG: \ >> - if (ODP_DEBUG_PRINT == 1) \ >> - odp_override_log(level, "%s:%d:%s():" fmt, >> __FILE__, \ >> - __LINE__, __func__, ##__VA_ARGS__); \ >> - break; \ >> - case ODP_LOG_PRINT: \ >> - odp_override_log(level, " " fmt, ##__VA_ARGS__); \ >> - break; \ >> - case ODP_LOG_ABORT: \ >> - odp_override_log(level, "%s:%d:%s(): " fmt, __FILE__, \ >> - __LINE__, __func__, ##__VA_ARGS__); \ >> - abort(); \ >> - break; \ >> - case ODP_LOG_UNIMPLEMENTED: \ >> - odp_override_log(level, \ >> - "%s:%d:The function %s() is not implemented\n" \ >> - fmt, __FILE__, __LINE__, __func__, >> ##__VA_ARGS__); \ >> - break; \ >> - default: \ >> - odp_override_log(level, "Unknown LOG level"); \ >> - break;\ >> - } \ >> -} while (0) >> + 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_LOG(ODP_LOG_PRINT, fmt, ##__VA_ARGS__) >> + odp_override_log(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) >> >> /** >> * Log debug message if ODP_DEBUG_PRINT flag is set. >> */ >> #define ODP_DBG(fmt, ...) \ >> - ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__) >> + do { \ >> + if (ODP_DEBUG_PRINT == 1) \ >> + ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__);\ >> + } while (0) >> >> /** >> * Log error message. >> @@ -156,7 +132,10 @@ do { \ >> * This function should not return. >> */ >> #define ODP_ABORT(fmt, ...) \ >> - ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__) >> + do { \ >> + ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \ >> + abort(); \ >> + } while (0) >> >> /** >> * @} >> diff --git a/platform/linux-generic/include/odp_debug_internal.h >> b/platform/linux-generic/include/odp_debug_internal.h >> index a87552f..ee3c543 100644 >> --- a/platform/linux-generic/include/odp_debug_internal.h >> +++ b/platform/linux-generic/include/odp_debug_internal.h >> @@ -25,8 +25,10 @@ extern "C" { >> /** >> * This macro is used to indicate when a given function is not >> implemented >> */ >> -#define ODP_UNIMPLEMENTED(fmt, ...) \ >> - ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__) >> +#define ODP_UNIMPLEMENTED() \ >> + odp_override_log(ODP_LOG_UNIMPLEMENTED, \ >> + "%s:%d:The function %s() is not implemented\n", \ >> + __FILE__, __LINE__, __func__) >> >> #ifdef __cplusplus >> } >> -- >> 1.7.9.5 >> >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> http://lists.linaro.org/mailman/listinfo/lng-odp >> > > > _______________________________________________ > 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 aa99e29..1f5eaff 100644 --- a/platform/linux-generic/include/api/odp_debug.h +++ b/platform/linux-generic/include/api/odp_debug.h @@ -102,48 +102,24 @@ extern int odp_override_log(odp_log_level_e level, const char *fmt, ...); * ODP LOG macro. */ #define ODP_LOG(level, fmt, ...) \ -do { \ - switch (level) { \ - case ODP_LOG_ERR: \ - odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case ODP_LOG_DBG: \ - if (ODP_DEBUG_PRINT == 1) \ - odp_override_log(level, "%s:%d:%s():" fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case ODP_LOG_PRINT: \ - odp_override_log(level, " " fmt, ##__VA_ARGS__); \ - break; \ - case ODP_LOG_ABORT: \ - odp_override_log(level, "%s:%d:%s(): " fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - abort(); \ - break; \ - case ODP_LOG_UNIMPLEMENTED: \ - odp_override_log(level, \ - "%s:%d:The function %s() is not implemented\n" \ - fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - default: \ - odp_override_log(level, "Unknown LOG level"); \ - break;\ - } \ -} while (0) + 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_LOG(ODP_LOG_PRINT, fmt, ##__VA_ARGS__) + odp_override_log(ODP_LOG_PRINT, " " fmt, ##__VA_ARGS__) /** * Log debug message if ODP_DEBUG_PRINT flag is set. */ #define ODP_DBG(fmt, ...) \ - ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__) + do { \ + if (ODP_DEBUG_PRINT == 1) \ + ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__);\ + } while (0) /** * Log error message. @@ -156,7 +132,10 @@ do { \ * This function should not return. */ #define ODP_ABORT(fmt, ...) \ - ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__) + do { \ + ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \ + abort(); \ + } while (0) /** * @} diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index a87552f..ee3c543 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -25,8 +25,10 @@ extern "C" { /** * This macro is used to indicate when a given function is not implemented */ -#define ODP_UNIMPLEMENTED(fmt, ...) \ - ODP_LOG(ODP_LOG_UNIMPLEMENTED, fmt, ##__VA_ARGS__) +#define ODP_UNIMPLEMENTED() \ + odp_override_log(ODP_LOG_UNIMPLEMENTED, \ + "%s:%d:The function %s() is not implemented\n", \ + __FILE__, __LINE__, __func__) #ifdef __cplusplus }
Move additional functionality out of ODP_LOG. Keep only logging. Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> --- platform/linux-generic/include/api/odp_debug.h | 43 +++++--------------- .../linux-generic/include/odp_debug_internal.h | 6 ++- 2 files changed, 15 insertions(+), 34 deletions(-)