You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Thorsten Schöning (Jira)" <lo...@logging.apache.org> on 2020/08/07 16:33:00 UTC

[jira] [Resolved] (LOGCXX-341) IMPLEMENT macros in object.h are not namespace safe, i.e. it should be possible to call these MACROS from within another namespace

     [ https://issues.apache.org/jira/browse/LOGCXX-341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thorsten Schöning resolved LOGCXX-341.
--------------------------------------
    Resolution: Won't Fix

Because we are trying to reduce the backlog of open issues, I'm closing this one right now. It's not clear what the reporter actually tries to achieve and what the concrete suggested changes are. If one is interested in this wish, please take some time to make more clear what the change is and/or provide a PR at best.

> IMPLEMENT macros in object.h are not namespace safe, i.e. it should be possible to call these MACROS from within another namespace
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOGCXX-341
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-341
>             Project: Log4cxx
>          Issue Type: Wish
>    Affects Versions: 0.10.0
>         Environment: Linux 2.6.18-53.1.13x86_64 GNU/Linux, g++ (GCC) 4.1.2 20080704
>            Reporter: Abhinav Agrawal
>            Assignee: Curt Arnold
>            Priority: Major
>
> #include <log4cxx/level.h>
> using namespace log4cxx;
> using namespace log4cxx::helpers;
> namespace xyz
> {
>         class MyLevel:public log4cxx::Level
>         {
>                 DECLARE_LOG4CXX_LEVEL(MyLevel);
>         };
>        IMPLEMENT_LOG4CXX_LEVEL(MyLevel)
> }
> Above code doesn't compile and gives error as below - 
> a.cpp:13: error: âxyz::log4cxx::helpersâ has not been declared
> a.cpp:13: error: expected initializer before â&â token
> distcc[23693] ERROR: compile t.i on localhost failed
> It is because of namespace statement in MACRO  definition of IMPLEMENT_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS.
> What about replacing MACRO definition as below - 
> #define IMPLEMENT_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(object, class)\
> const log4cxx::helpers::Class& object::getClass() const { return getStaticClass(); }\
> const log4cxx::helpers::Class& object::getStaticClass() { \
>    static class theClass;                                 \
>    return theClass;                                       \
> }                                                         \
> const log4cxx::helpers::ClassRegistration& object::registerClass() {   \
>     static log4cxx::helpers::ClassRegistration classReg(object::getStaticClass); \
>     return classReg; \
> }\
> --- namespace log4cxx { namespace classes { \
> --- const log4cxx::helpers::ClassRegistration& object##Registration = object::registerClass(); \
> --- } }
> +++ const log4cxx::helpers::ClassRegistration& object##Registration = object::registerClass(); \



--
This message was sent by Atlassian Jira
(v8.3.4#803005)