Sorry, found something mike@fedora1:~/git/odp$ git am ~/incoming/lng-odp_ODP-PATCHv2_ODP_Macro_for_unimplemented_functions.mbox Applying: ODP Macro for unimplemented functions /home/mike/git/odp/.git/rebase-apply/patch:123: new blank line at EOF. + warning: 1 line adds whitespace errors.
On 15 October 2014 05:14, Maxim Uvarov <[email protected]> wrote: > Looks like everything is resolved. Does somebody want to add sign-off? > > Maxim. > > > On 10/14/2014 08:18 PM, Balasubramanian Manoharan wrote: > >> This patch provides MACRO for unimplemented functions. >> This patch incorporates the review comments from the previous version. >> >> Signed-off-by: Balasubramanian Manoharan <[email protected]> >> --- >> platform/linux-generic/include/api/odp_debug.h | 54 >> ++++++++++++++++++---- >> .../linux-generic/include/api/odp_debug_internal.h | 32 +++++++++++++ >> 2 files changed, 76 insertions(+), 10 deletions(-) >> create mode 100644 platform/linux-generic/include/api/odp_debug_ >> internal.h >> >> diff --git a/platform/linux-generic/include/api/odp_debug.h >> b/platform/linux-generic/include/api/odp_debug.h >> index 344b0a9..e850bf3 100644 >> --- a/platform/linux-generic/include/api/odp_debug.h >> +++ b/platform/linux-generic/include/api/odp_debug.h >> @@ -66,30 +66,64 @@ extern "C" { >> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) >> /** >> + * ODP log level. >> + */ >> +typedef enum odp_log_level { >> + ODP_LOG_DBG, >> + ODP_LOG_ERR, >> + ODP_LOG_UNIMPLEMENTED, >> + ODP_LOG_ABORT >> +} odp_log_level_e; >> + >> +/** >> + * ODP default LOG macro. >> + */ >> +#define ODP_LOG(level, fmt, ...) \ >> +do { \ >> + switch (level) { \ >> + case ODP_LOG_ERR: \ >> + fprintf(stderr, "%s:%d:%s():" fmt, __FILE__, \ >> + __LINE__, __func__, ##__VA_ARGS__); \ >> + break; \ >> + case ODP_LOG_DBG: \ >> + if (ODP_DEBUG_PRINT == 1) \ >> + fprintf(stderr, "%s:%d:%s():" fmt, __FILE__, \ >> + __LINE__, __func__, ##__VA_ARGS__); \ >> + break; \ >> + case ODP_LOG_ABORT: \ >> + fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ >> + __LINE__, __func__, ##__VA_ARGS__); \ >> + abort(); \ >> + break; \ >> + case ODP_LOG_UNIMPLEMENTED: \ >> + fprintf(stderr, \ >> + "%s:%d:The function %s() is not implemented\n" \ >> + fmt, __FILE__, __LINE__, __func__, >> ##__VA_ARGS__); \ >> + break; \ >> + default: \ >> + fprintf(stderr, "Unknown LOG level"); \ >> + break;\ >> + } \ >> +} while (0) >> + >> +/** >> * Debug printing macro, which prints output when DEBUG flag is set. >> */ >> #define ODP_DBG(fmt, ...) \ >> - do { if (ODP_DEBUG_PRINT == 1) \ >> - printf(fmt, ##__VA_ARGS__); \ >> - } while (0) >> + ODP_LOG(ODP_LOG_DBG, fmt, ##__VA_ARGS__) >> /** >> * Print output to stderr (file, line and function). >> */ >> #define ODP_ERR(fmt, ...) \ >> -do { fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ >> - __LINE__, __func__, ##__VA_ARGS__); \ >> -} while (0) >> + ODP_LOG(ODP_LOG_ERR, fmt, ##__VA_ARGS__) >> /** >> * Print output to stderr (file, line and function), >> * then abort. >> */ >> #define ODP_ABORT(fmt, ...) \ >> -do { fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ >> - __LINE__, __func__, ##__VA_ARGS__); \ >> - abort(); \ >> -} while (0) >> + ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__) >> #ifdef __cplusplus >> } >> diff --git a/platform/linux-generic/include/api/odp_debug_internal.h >> b/platform/linux-generic/include/api/odp_debug_internal.h >> new file mode 100644 >> index 0000000..37af468 >> --- /dev/null >> +++ b/platform/linux-generic/include/api/odp_debug_internal.h >> @@ -0,0 +1,32 @@ >> +/* Copyright (c) 2014, Linaro Limited >> + * All rights reserved. >> + * >> + * SPDX-License-Identifier: BSD-3-Clause >> + */ >> +/** >> + * @file >> + * >> + * ODP debug internal >> + */ >> + >> +#ifndef ODP_DEBUG_INTERNAL_H_ >> +#define ODP_DEBUG_INTERNAL_H_ >> + >> +#ifdef __cplusplus >> +extern "C" { >> +#endif >> + >> +#include <odp_debug.h> >> + >> +/** >> + * 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__) >> + >> +#ifdef __cplusplus >> +} >> +#endif >> + >> +#endif >> + >> > > > _______________________________________________ > lng-odp mailing list > [email protected] > http://lists.linaro.org/mailman/listinfo/lng-odp > -- *Mike Holmes* Linaro Sr Technical Manager LNG - ODP
_______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
