Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.10.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      MS Windows XP
      MS Visual Studio 8 SP1
      apache-ant-1.7.0

      Description

      I get this bug at revision 598875 - I just can't build more new revision because of LOGCXX-218.

      I maked a very simple Win32 console application:

      ===
      #include "stdafx.h"

      #include <log4cxx/logger.h>

      int _tmain(int argc, _TCHAR* argv[])
      {
      return 0;
      }
      ===

      But even this simple application produce a lot of warning:

      ===
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\helpers\appenderattachableimpl.h(46) : warning C4251: 'log4cxx::helpers::AppenderAttachableImpl::appenderList' : class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'log4cxx::helpers::AppenderAttachableImpl'
      with
      [
      _Ty=log4cxx::AppenderPtr
      ]
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\helpers\appenderattachableimpl.h(111) : warning C4250: 'log4cxx::helpers::AppenderAttachableImpl' : inherits 'log4cxx::helpers::ObjectImpl::log4cxx::helpers::ObjectImpl::addRef' via dominance
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\helpers\objectimpl.h(33) : see declaration of 'log4cxx::helpers::ObjectImpl::addRef'
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\helpers\appenderattachableimpl.h(111) : warning C4250: 'log4cxx::helpers::AppenderAttachableImpl' : inherits 'log4cxx::helpers::ObjectImpl::log4cxx::helpers::ObjectImpl::releaseRef' via dominance
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\helpers\objectimpl.h(34) : see declaration of 'log4cxx::helpers::ObjectImpl::releaseRef'
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\helpers\resourcebundle.h(83) : warning C4251: 'log4cxx::helpers::ResourceBundle::parent' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to be used by clients of class 'log4cxx::helpers::ResourceBundle'
      with
      [
      T=log4cxx::helpers::ResourceBundle
      ]
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\logger.h(75) : warning C4251: 'log4cxx::Logger::level' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to be used by clients of class 'log4cxx::Logger'
      with
      [
      T=log4cxx::Level
      ]
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\logger.h(80) : warning C4251: 'log4cxx::Logger::parent' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to be used by clients of class 'log4cxx::Logger'
      with
      [
      T=log4cxx::Logger
      ]
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\logger.h(86) : warning C4251: 'log4cxx::Logger::resourceBundle' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to be used by clients of class 'log4cxx::Logger'
      with
      [
      T=log4cxx::helpers::ResourceBundle
      ]
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\logger.h(92) : warning C4251: 'log4cxx::Logger::aai' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to be used by clients of class 'log4cxx::Logger'
      with
      [
      T=log4cxx::helpers::AppenderAttachableImpl
      ]
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\logger.h(633) : warning C4250: 'log4cxx::Logger' : inherits 'log4cxx::helpers::ObjectImpl::log4cxx::helpers::ObjectImpl::addRef' via dominance
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\helpers\objectimpl.h(33) : see declaration of 'log4cxx::helpers::ObjectImpl::addRef'
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\logger.h(633) : warning C4250: 'log4cxx::Logger' : inherits 'log4cxx::helpers::ObjectImpl::log4cxx::helpers::ObjectImpl::releaseRef' via dominance
      d:\program files\development\libraries\log4cxx\log4cxx-rev598875\include\log4cxx\helpers\objectimpl.h(34) : see declaration of 'log4cxx::helpers::ObjectImpl::releaseRef'
      ===

      Maybe I get these warnings because of incorrect log4cxx distribution - I didn't find target "dist" and just make svn export for main\include\log4cxx.

      What I'm doing wrong?

        Activity

        Hide
        Curt Arnold added a comment -

        There are two distinct issues here, the C4250 dominance warnings and the C4251 exporting warnings.

        Rev 612331 should have fixed the C4250 warnings by explicitly declaring addRef and releaseRef on the classes that were generating the warnings. Those classes were inheriting the implementation of those methods from the last inherited class which is as far as I know a standardized behavior. The fix should just explicitly state the previous implied behavior in most cases. I do not believe the C4250 warnings ever represented an observable problem.

        The C4251 warnings seem more problematic. Almost all API methods that return an "object" return a instantiation of the template class log4cxx::helpers::ObjectPtrT<T>. Since VC doesn't export templated classes, that results in the receiving "smart pointer" to be implemented in the caller and the sending "smart pointer" is implemented in log4cxx. This has not been observed to cause a problem, but is not desirable. I'm going to have to experiment before I know how I will address it. The following is a link to a Microsoft KB article regarding the issue: http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b168958

        Show
        Curt Arnold added a comment - There are two distinct issues here, the C4250 dominance warnings and the C4251 exporting warnings. Rev 612331 should have fixed the C4250 warnings by explicitly declaring addRef and releaseRef on the classes that were generating the warnings. Those classes were inheriting the implementation of those methods from the last inherited class which is as far as I know a standardized behavior. The fix should just explicitly state the previous implied behavior in most cases. I do not believe the C4250 warnings ever represented an observable problem. The C4251 warnings seem more problematic. Almost all API methods that return an "object" return a instantiation of the template class log4cxx::helpers::ObjectPtrT<T>. Since VC doesn't export templated classes, that results in the receiving "smart pointer" to be implemented in the caller and the sending "smart pointer" is implemented in log4cxx. This has not been observed to cause a problem, but is not desirable. I'm going to have to experiment before I know how I will address it. The following is a link to a Microsoft KB article regarding the issue: http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b168958
        Hide
        Curt Arnold added a comment -

        Rev 617676 eliminated the dll-interface messages for VC6-8 by explicitly dll exporting the appropriate std::allocator. Unfortunately, VC9's implementation std::allocator<> has a concrete base class that is not dll-exported which means that the message can only be disabled, it can't be eliminated.

        Rev 627302 greatly reduced the frequency of those warnings, but some still get through in building log4cxx and the unit tests, however they don't appear with the examples, so it may require some pretty esoteric log4cxx use to see the warnings in client code.

        Show
        Curt Arnold added a comment - Rev 617676 eliminated the dll-interface messages for VC6-8 by explicitly dll exporting the appropriate std::allocator. Unfortunately, VC9's implementation std::allocator<> has a concrete base class that is not dll-exported which means that the message can only be disabled, it can't be eliminated. Rev 627302 greatly reduced the frequency of those warnings, but some still get through in building log4cxx and the unit tests, however they don't appear with the examples, so it may require some pretty esoteric log4cxx use to see the warnings in client code.

          People

          • Assignee:
            Curt Arnold
            Reporter:
            Alexander E. Sorokin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development