[cmake-developers] CheckStructHasMember does not support C++ only structs

Rolf Eike Beer eike at sf-mail.de
Fri Oct 4 06:20:03 EDT 2013


Am 04.10.2013 11:46, schrieb Daniele E. Domenichelli:
> Hello,
> 
> On 02/10/13 16:23, Brad King wrote:
>> They look good to me.  We'll see how the dashboards do.
> 
> Unfortunately one test is failing on several machines:
> 
> http://open.cdash.org/testSummary.php?project=1&name=CMakeOnly.CheckStructHasMember&date=2013-10-03
> 
> This is the test that is failing, according to my knowledge of C it
> should build, even with very old compilers...
> 
> 
> struct struct_with_member
> {
>     int foo;
> };
> 
> int main()
> {
>     struct struct_with_member *tmp;
>     tmp->foo;
>     return 0;
> }
> 
> 
> Am I missing something? Is it possible to access to the
> Tests/CMakeOnly/CheckStructHasMember-build/CMakeFiles/CMakeError.log
> files on the build machines to have a better idea of what is going on?

Just some thoughts:
-some compilers may error out because you dereference an uninitialized 
pointer
-some compilers may complain because you perform an operation that does 
nothing, maybe prepend it with a (void) to mark that as intentional

What about this:

      struct struct_with_member tmp, *tmpp;
      tmp.foo = 0;
      tmpp = &tmp;
      return tmpp->foo;

Eike



More information about the cmake-developers mailing list