OpenCV variadic macro not standard compliant [closed]

asked 2012-08-16 10:47:31 -0600

jthomas gravatar image

Hi,

i just tried to compile OpenCV 2.4.2 with Oracle Studio 12 under Solaris 10 x86, but i get the following error:

... ".../OpenCV-2.4.2/modules/ts/src/ts_perf.cpp", line 115: Warning: Too few arguments in macro LOGE. ".../OpenCV-2.4.2/modules/ts/src/ts_perf.cpp", line 115: Error: Trailing comma in a parameter list. ...

As i found out LOGE is defined in modules/ts/include/opencv2/ts/ts_perf.hpp as

define LOGE(_str, ...) do{printf(_str , ## __VA_ARGS__); printf("\n");fflush(stdout);} while(0)

Here, a gcc extension ("##" - the meaning is explained in the documentation link:here. It is as an extension provided by gcc. But it is a serious problem for other compilers, because it's not standard compliant.

A detailed discussion can be found here: link:thread at stackoverflow

Any help how to solve this issue?

Thanks

Julian

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-09-27 10:18:46.333619

Comments

You could solve it cowboy-style by disabling the test module. However, if you really want to port it to a new architecture, with a new compiler, you'll have to fix much more complicated issues, like atomic oprations & Co. And those are a must-have, you won't be able to skip them.

sammy gravatar imagesammy ( 2012-08-16 14:15:15 -0600 )edit

But we can consider it as a bug possibly. Look, perf tests are working OK on Linux, Android and Windows (read: MS VS compiler). And you can see that for the LOGE definition conditional compilation is used. So, if it is broken on Solaris, #if pragmas should be updated and LOGE implementation compatible with compiler from Oracle Studio 12 is needed.

So, @jthomas if you can provide a patch which will resolve issues on Solaris, we can adopt it for OpenCV. Just say if you're ready to work on this, it shouldn't take a lot of time...

Kirill Kornyakov gravatar imageKirill Kornyakov ( 2012-08-28 08:56:55 -0600 )edit