Error in ts_perf.hpp Prevents Compilation (Bug #3179)


Added by Marcus Urban over 11 years ago. Updated over 11 years ago.


Status:Done Start date:2013-07-28
Priority:Normal Due date:
Assignee:Victor Kocheganov % Done:

0%

Category:ts
Target version:2.4.7
Affected version:2.4.6 (latest release) Operating System:Mac OSX
Difficulty:Medium HW Platform:x64
Pull request:https://github.com/Itseez/opencv/pull/1244

Description

In the file ts_perf.hpp, there is a work-around for a bug in VS 2005:

while (++argc >= (--argc,-1)) {__VA_ARGS__; break;} /*this ugly construction is needed for VS 2005*/\

However, the above code breaks the sequencing rules for C++, as the order in which ++argc and --argc are evaluated is undefined. Clang does detect the error and does not compile the code:

/Users/marcus/Downloads/opencv-2.4.6.1/modules/core/perf/perf_main.cpp:3:1: error:
multiple unsequenced modifications to 'argc' [-Werror,-Wunsequenced]
CV_PERF_TEST_MAIN(core)
^~~~~~~~~~~~~~~~~~~~~
/Users/marcus/Downloads/opencv-2.4.6.1/modules/ts/include/opencv2/ts/ts_perf.hpp:501:5: note:
expanded from macro 'CV_PERF_TEST_MAIN'
CV_PERF_TEST_MAIN_INTERNALS(modulename, plain_only, VA_ARGS)\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marcus/Downloads/opencv-2.4.6.1/modules/ts/include/opencv2/ts/ts_perf.hpp:480:12: note:
expanded from macro 'CV_PERF_TEST_MAIN_INTERNALS'
while (++argc >= (--argc,-1)) {__VA_ARGS__; break;} /*this ugly cons...
^ ~~

The work-around for the VS 2005 bug was added in commit 7267d518d5d6979bd33cdd6dd7fda1075f6017e0. If there is a macro to detect VS 2005, that would be one way of fixing it. Otherwise, it appears to be a choice between compiling with Apple's Clang compiler or VS 2005.


Related issues

duplicated by Bug #3289: OpenCV 2.4.6 (from ROS released tar) fails to compile on ... Cancelled 2013-09-26

Associated revisions

Revision e4b201be
Added by kocheganovvm over 11 years ago

Fix unsequenced modifications (Bug #3179).

Revision 6c3dd498
Added by Vadim Pisarevsky over 10 years ago

Merge pull request #3179 from alekcac:update_in_youtube_url

History

Updated by Victor Kocheganov over 11 years ago

Hello Marcus,

thank you for reporting the issue!
I'll handle it.

Regards,
Victor Kocheganov

  • Status changed from New to Open
  • Category set to ts
  • Pull request set to https://github.com/Itseez/opencv/pull/1229
  • Assignee set to Victor Kocheganov

Updated by Victor Kocheganov over 11 years ago

  • Pull request changed from https://github.com/Itseez/opencv/pull/1229 to https://github.com/Itseez/opencv/pull/1244

Updated by Victor Kocheganov over 11 years ago

  • Status changed from Open to Done

Also available in: Atom PDF