Windows, Msys with clang64 compiler

I made a few PRs to allow compilation and ctest with clang64. Only tiny changes were necessary to get this done, very nice, and the tests pass except for the known problem with Unicode code points above 0xffff.

clang produces a few warnings, I’ll check them in the next days.

1 Like

First warning: I guess q[1] < 0x80 can be removed indeed.

C:/msys64/home/Matthias/swipl-devel/src/os/windows/uxnt.c:269:28: warning: result of comparison of constant 128 with expression of type 'const char' is always true [-Wtautological-constant-out-of-range-compare]
  if ( q[0] == '/' && q[1] < 0x80 && isalpha(q[1]) && q[2] == ':' &&

Second: Appears in BUILD_TYPE=Release. I guess clang does not notice that the whole function skiplist_check is only invoked for debugging purposes. Unsure how to handle this properly.

[814/956] Building C object packages/semweb/CMakeFiles/plugin_rdf_db.dir/skiplist.c.obj
C:/msys64/home/Matthias/swipl-devel/packages/semweb/skiplist.c:370:16: warning: unused variable 'next0' [-Wunused-variable]
          { skipcell *next0 = subPointer(sc->next[i-1],
C:/msys64/home/Matthias/swipl-devel/packages/semweb/skiplist.c:372:16: warning: unused variable 'next1' [-Wunused-variable]
            skipcell *next1 = subPointer(sc->next[i],
C:/msys64/home/Matthias/swipl-devel/packages/semweb/skiplist.c:385:15: warning: variable 'pl1' set but not used [-Wunused-but-set-variable]
      { void *pl1, *pl2;
C:/msys64/home/Matthias/swipl-devel/packages/semweb/skiplist.c:385:21: warning: variable 'pl2' set but not used [-Wunused-but-set-variable]
      { void *pl1, *pl2;

Next one: This might be a mistake (consider flags & SIO_CLOSING != 0 instead of flags && SIO_CLOSING), occurs three times in total (ll. 261 and 265).

C:/msys64/home/Matthias/swipl-devel/src/pl-ntmain.c:257:31: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
       ((IOSTREAM *)v)->flags && SIO_CLOSING )
                              ^  ~~~~~~~~~~~
C:/msys64/home/Matthias/swipl-devel/src/pl-ntmain.c:257:31: note: use '&' for a bitwise operation
       ((IOSTREAM *)v)->flags && SIO_CLOSING )
C:/msys64/home/Matthias/swipl-devel/src/pl-ntmain.c:257:31: note: remove constant to silence this warning
       ((IOSTREAM *)v)->flags && SIO_CLOSING )

Thanks. Pushed fixes for these.

No. It is the wrong condition. It must validate q[1] is not a UTF-8 first byte, i.e. it must test the high bit is 0.

Standard trick is to put (void)somevar; after the place it is possibly used. That tells the compiler not to worry.

This is a mistake. Affects closedown for swipl-win.exe, but no harm was done.