On 1/7/2012 6:12 AM, Rolf Eike Beer wrote:
This has changed. It fails now for vs11-x64 on amber10 and for Linux64-
bullseye-cov on hythloth. amber10 seems to have an unrelated, general problem.
What's wrong with the bullseye I have no idea, but this goes wrong for the C++
test and some others, too.

Ignore amber10.  The machine has some corruption on it.  We've been working
to move those builds to some clean machines or VMs.

I wonder if the BullsEye coverage tool ends up leaving errno set to non-zero
after program startup.  By returning it directly the return code from the test
executable ends up as non-zero so CTest thinks it failed.  This works around
the problem:

diff --git a/Tests/Module/CheckSymbolExists/errno.c 
b/Tests/Module/CheckSymbolExists/errno.c
index 6010f7c..da78f02 100644
--- a/Tests/Module/CheckSymbolExists/errno.c
+++ b/Tests/Module/CheckSymbolExists/errno.c
@@ -2,5 +2,6 @@

 int main()
 {
+  errno = 0;
   return errno;
 }

However the CheckCXXSymbolExist test fails:

For the bullseye (see above) and because the dummy executable fails for
Borland C++. "return errno;" doesn't work in C++ mode, I have no idea what's
that for a screwup. And especially why searching for that symbol using
CheckCXXSymbolExists works but using it doesn't.

When you use <cerrno> shouldn't you reference "std::errno" and not "errno"?
However, even that doesn't work because Borland's treatment of errno in
<cerrno> ends up preprocessing to

 namespace std { extern "C" { extern  int * __cdecl  __errno(void); } }
 int main() { return (*__errno()); }

and __errno() is not visible outside std::.  Adding std:: would end up
giving "return std::(*__errno())" which of course doesn't work.  What works
is "return (*std::__errno())" but they do not define the macro that way ;)

Using just <errno.h> works for Borland.

-Brad


diff --git a/Tests/Module/CheckCXXSymbolExists/CMakeLists.txt 
b/Tests/Module/CheckCXXSymbolExists/CMakeLists.txt
index c55c05d..0e57bab 100644
--- a/Tests/Module/CheckCXXSymbolExists/CMakeLists.txt
+++ b/Tests/Module/CheckCXXSymbolExists/CMakeLists.txt
@@ -31,9 +31,10 @@ endforeach()
 set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
 unset(CSE_RESULT_ERRNO_CERRNO CACHE)

-MESSAGE(STATUS "Checking <cerrno>")
-
-check_cxx_symbol_exists(errno "cerrno" CSE_RESULT_ERRNO_CERRNO)
+if(NOT BORLAND)
+  MESSAGE(STATUS "Checking <cerrno>")
+  check_cxx_symbol_exists(errno "cerrno" CSE_RESULT_ERRNO_CERRNO)
+endif()

 IF (NOT CSE_RESULT_ERRNO_CERRNO)
   unset(CSE_RESULT_ERRNO_ERRNOH CACHE)
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to