Message ID | 1413303512-9326-1-git-send-email-bala.manoharan@linaro.org |
---|---|
State | New |
Headers | show |
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 <bala.manoharan@linaro.org> > --- > 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 > +
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 <maxim.uvarov@linaro.org> 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 <bala.manoharan@linaro.org> >> --- >> 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 > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
On 15 October 2014 09:57, Mike Holmes <mike.holmes@linaro.org> wrote: > 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 <maxim.uvarov@linaro.org> 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 <bala.manoharan@linaro.org> >>> --- >>> 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 >>> >> This is true for most of our header files, the description does little more than repeat the filename, some times that is all that can be said I agree. But in this case maybe say. This file contains implementer support functions for the debugging capabilities of ODP @warning These definitions are not part of the ODP API, they are for implementers use only and are thus considered "internal" they should not be called from from any other scope. > + */ >>> + >>> +#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 >> lng-odp@lists.linaro.org >> http://lists.linaro.org/mailman/listinfo/lng-odp >> > > > > -- > *Mike Holmes* > Linaro Sr Technical Manager > LNG - ODP >
On 15 October 2014 19:27, Mike Holmes <mike.holmes@linaro.org> wrote: > 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. > This was not found in ./scripts/checkpatch.pl and maybe an error in checkpatch script. Regards, Bala > > > On 15 October 2014 05:14, Maxim Uvarov <maxim.uvarov@linaro.org> 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 <bala.manoharan@linaro.org> >>> --- >>> 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 >> lng-odp@lists.linaro.org >> http://lists.linaro.org/mailman/listinfo/lng-odp >> > > > > -- > *Mike Holmes* > Linaro Sr Technical Manager > LNG - ODP > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp > >
On 16 October 2014 02:39, Bala Manoharan <bala.manoharan@linaro.org> wrote: > > > On 15 October 2014 19:27, Mike Holmes <mike.holmes@linaro.org> wrote: > >> 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. >> > This was not found in ./scripts/checkpatch.pl and maybe an error in > checkpatch script. > Ack, Maybe it is time we updated our copy of checkpatch. > Regards, > Bala > >> >> >> On 15 October 2014 05:14, Maxim Uvarov <maxim.uvarov@linaro.org> 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 <bala.manoharan@linaro.org> >>>> --- >>>> 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 >>> lng-odp@lists.linaro.org >>> http://lists.linaro.org/mailman/listinfo/lng-odp >>> >> >> >> >> -- >> *Mike Holmes* >> Linaro Sr Technical Manager >> 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 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 +
This patch provides MACRO for unimplemented functions. This patch incorporates the review comments from the previous version. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> --- 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