- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My problem/question relates to compilation warnings. In my company, we use the '-Wall -Werr' options for g++ as standard for all our projects. Consequently, building TBB from source in our environment (MacOS/X, gcc) results in many errors. Some of these errors actually show up in TBB headers, which means that our own code can't compile with these options, for example:
/p/include/tbb/tbb_machine.h: In function 'uintptr_t __TBB_LockByte(volatile unsigned char&)':
/p/include/tbb/tbb_machine.h:485: warning: unused variable 'count'
There are many more errors that crop up however when compiling TBB's own test code (see excerpt below). Even more warnings show up, both in the headers and the testing code, if less-standard options such as -Wextra and -pedantic are chosen. While not technically a bug, I'd like to suggest for the software maintainers to fix up the code so that it compiles warning-free. It shouldn't be too hard, and will make the code much cleaner, and possibly even eliminate some bugs.
Excerpt of compiling warnings with -Wall:
make -C "../../build/macos_ia32_gcc_cc4.0.1_os10.4.8_release" -r -
f ../../build/Makefile.test cfg=release
g++ -c -MMD -O2 -DUSE_PTHREAD -Wall -I../../src -I../../include ../../
src/test/test_assembly.cpp
../../src/test/../tbb/task.cpp: In constructor
'tbb::internal::UnpaddedArenaPrefix::UnpaddedArenaPrefix(size_t,
size_t)':
../../src/test/../tbb/task.cpp:219: warning:
'tbb::internal::UnpaddedArenaPrefix::number_of_slots' will be
initialized after
../../src/test/../tbb/task.cpp:216: warning: 'int
tbb::internal::UnpaddedArenaPrefix::number_of_masters'
../../src/test/../tbb/task.cpp:237: warning: when initialized here
../../src/test/../tbb/task.cpp: In member function 'void
tbb::internal::GenericScheduler::deallocate_task(tbb::task&)':
../../src/test/../tbb/task.cpp:772: warning: unused variable 'p'
../../src/test/../tbb/task.cpp: In member function 'bool
tbb::internal::GenericScheduler::is_worker()':
../../src/test/../tbb/task.cpp:810: warning: comparison between
signed and unsigned integer expressions
../../src/test/../tbb/task.cpp: In constructor
'tbb::internal::GenericScheduler::GenericScheduler
(tbb::internal::Arena*)':
../../src/test/../tbb/task.cpp:606: warning:
'tbb::internal::GenericScheduler::random' will be initialized after
../../src/test/../tbb/task.cpp:600: warning:
'tbb::internal::UnpaddedArenaSlot*
tbb::internal::GenericScheduler::arena_slot'
../../src/test/../tbb/task.cpp:1045: warning: when initialized here
../../src/test/../tbb/task.cpp:620: warning:
'tbb::internal::GenericScheduler::ref_count' will be initialized after
../../src/test/../tbb/task.cpp:590: warning: 'tbb::internal::intptr
tbb::internal::GenericScheduler::deepest'
../../src/test/../tbb/task.cpp:1045: warning: when initialized here
../../src/test/../tbb/task.cpp: In member function 'bool
tbb::internal::GenericScheduler::assert_okay() const':
../../src/test/../tbb/task.cpp:1091: warning: comparison between
signed and unsigned integer expressions
../../src/test/../tbb/task.cpp: In member function 'tbb:: task*
tbb::internal::GenericScheduler::steal_task
(tbb::internal::UnpaddedArenaSlot&, tbb::internal::intptr)':
../../src/test/../tbb/task.cpp:1388: warning: suggest parentheses
around assignment used as truth value
../../src/test/../tbb/task.cpp: In member function 'void
tbb::internal::GenericScheduler::leave_arena(bool)':
../../src/test/../tbb/task.cpp:1687: warning: unused variable 't'
../../src/test/../tbb/task.cpp: In static member function 'static
tbb::internal::GenericScheduler*
tbb::internal::GenericScheduler::create_worker
(tbb::internal::WorkerDescriptor&)':
../../src/test/../tbb/task.cpp:1714: warning: comparison between
signed and unsigned integer expressions
../../src/test/../tbb/task.cpp:1717: warning: comparison between
signed and unsigned integer expressions
../../src/test/../tbb/task.cpp: In static member function 'static
void tbb::internal::GenericScheduler::cleanup_worker_thread(void*)':
../../src/test/../tbb/task.cpp:1799: warning: unused variable 'a'
.
.
.
.
.
.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for this feedback! We used to compile and run the tests with -Wall -Werror, so the headers were warning-free (and I believe they mostly are), but for 2.0 we temporarily turned it off. Definitely, for TBB tests (and thus headers) this mode will be back in one of the next updates, rather sooner than later.
However, basing on my experience, I would not agree that the code becomes cleaner if you fix all warnings, even at GCC recommended level -Wall, not to mention more zealous options. Such warning cleansing is a pain when done for a cross-platform code that should be built with a number of compilers, and sometimes you have to invent quite ugly workarounds to make every compiler happy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the tbb20_20070815oss development update we get rid of compilation warnings in all TBB headers and almost all tests, for the following warning levels: -Wall for g++, -w1 for Intel C++ compilers, and /W3 for Microsoft Visual C++ compilers. TBB makefiles use "warnings are errors" mode for building the tests, all buttwo due to their specific (the test_assembly.cpp that you reported isone ofthese two).
Though the library code itself is not yet warning-free, we aim to achieve this as well over time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
More news from the front of the fight against warnings :)
In the tbb20_20070927oss development update, compilation of the TBB library and tests pass the warning levels denoted in the previous post. Well, we cannot guarantee that it is warning-free on every platform and with every version of the compilers, but for the bunch of the configurations we use for testing, it should be, with the exception of the TBB scalable memory allocator library (tbbmalloc) code and its tests that still have some warnings.
Also,now we always use "warnings are errors" mode (-Werror or /WX) internally during development. The mode is controlled by tbb_strict flag which can be passed to make utility. E.g. the following command will build TBB in the strict mode:
make tbb_strict=1
While the strict warning mode is enforced for the developers, the public TBB releases will have it turned off. This way the users who build TBB on a platform or with a compiler version that we have not testedwill only see warnings, and TBB will not look "buggy" for them.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page