Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • hadsellJuly 15, 2009 11:07 AM PDT   
    tbb_exception.h compiler warnings

    We have started to use tbb_exception and have immediately encountered a warning everytime a source file includes the header:

    .../tbb/tbb_exception.h: In copy constructor ‘tbb::captured_exception::captured_exception(const tbb::captured_exception&)’:
    .../tbb/tbb_exception.h:108: warning: base class ‘class tbb::tbb_exception’ should be explicitly initialized in the copy constructor

    We are using tbb21_017oss.  (CHANGES indicates that this is "TBB 2.1 Update 4 commercial-aligned release.")

    The compiler is g++ 4.1.2 (gcc version 4.1.2 20070502 (Red Hat 4.1.2-12)) running on 64-bit Fedora 7 Linux.  We use -Wall when compiling debug versions.

    We prefer to see no warnings when we compile our code, so the presence of this warning from tbb_exception.h for every file that includes it makes it difficult to find problems that we introduce ourselves.

    Is there any chance that this might get fixed in the next release?  If there is, when might that be?


    Alexey Kukanov (Intel)July 15, 2009 3:39 PM PDT
    Rate
     
    Re: tbb_exception.h compiler warnings

    TBB headers compile cleanly with -Wall. This warning is enabled by -Wextra, which is beyond our target for warnings. It is unfeasible to clean every warning of every compiler, especially with some warning workarounds just adding code clutter for no good reason.

    I will check with the team whether it makes sense to fix this particular warning. Chances are that we will do that, solely because tbb_exception inherits std::exception, which has a copy constructor. tbb_exception by itself is an abstract class without any additional state, and so does not need any constructor on its own.


    hadsellJuly 16, 2009 7:46 AM PDT
    Rate
     
    Re: tbb_exception.h compiler warnings

    TBB headers compile cleanly with -Wall. This warning is enabled by -Wextra, which is beyond our target for warnings. It is unfeasible to clean every warning of every compiler, especially with some warning workarounds just adding code clutter for no good reason.

    I will check with the team whether it makes sense to fix this particular warning. Chances are that we will do that, solely because tbb_exception inherits std::exception, which has a copy constructor. tbb_exception by itself is an abstract class without any additional state, and so does not need any constructor on its own.
    Thanks for checking.  Yes, we are using -W (aka -Wextra) as well as -Wall.

    Since you mention tbb_exception not needing a copy constructor, I should clarify that the warning arises with classes derived from tbb_exception, e.g., captured_exception.  It is this class's copy constructor that could explicitly initialize its tbb_exception base.  The movable_exception template class could do the same.

    Of course, I can fix the problem in our copy of TBB, but it would be nicer not to do this for every new release.


    Alexey Kukanov (Intel)July 17, 2009 4:27 AM PDT
    Rate
     
    Re: tbb_exception.h compiler warnings

    Quoting - hadsell
    Since you mention tbb_exception not needing a copy constructor, I should clarify that the warning arises with classes derived from tbb_exception, e.g., captured_exception.  It is this class's copy constructor that could explicitly initialize its tbb_exception base.  The movable_exception template class could do the same.

    Right. But to do explicit initialization of tbb_exception, you need a constructor of it. Fortunately, compiler should generate a copy constructor for it which will do just the right thing of calling copy constructor for its base class, std::exception. So we decided to add the call there, not in order to have no warning but to have the std::exception part copy-constructed correctly. If tbb_exception would not inherit std::exception, there would be no sense in calling its constructor, since it would basically be a no-op.

    The change was committed to TBB mainline, so sooner or later it will appear in releases (including COM-aligned).

Forum jump:  

Intel Software Network Forums Statistics

17,025 users have contributed to 48,321 threads and 172,753 posts to date.

In the past 24 hours, we have 16 new thread(s) 57 new posts(s), and 54 new user(s).

In the past 3 days, the most popular thread for everyone has been How to manage rounding by IVF ?? The most posts were made to Most likely, the issue is that The post with the most views is Optimalization of sine function\'s taylor expansion

Please welcome our newest member redfruit83


For more complete information about compiler optimizations, see our Optimization Notice.