Skip to content

Cpp

Peter W. Draper requested to merge cpp into master

Various "fixes" required to compile swift using C++ compilers.

Many of these are real, i.e. casts to incorrect types, some are C++ specific, i.e. no void * assignments, but mostly look good hygiene.

There a couple of less benign looking issues.

  • In the file hydro_space.c an inline function is defined. That will never be used and needs moving to the header file.

  • I had to change the atomics to avoid using negative arguments to __sync_fetch_and_add() otherwise we get the warning:

    cell.c(604): warning #68: integer conversion resulted in a change of sign
    atomic_dec(&finger2->mhold);

    for all the atomic_dec() calls. No idea why that should change between languages and what is happening under the hood.

Finally there are two warnings I cannot see how to squash:

queue.c(58): error #68: integer conversion resulted in a change of sign
      const int offset = atomic_swap(&q->tid_incoming[ind], -1);
                         ^
queue.c(104): error #68: integer conversion resulted in a change of sign
    while (atomic_cas(&q->tid_incoming[ind], -1, t - q->tasks) != -1) {
           ^

A build requires --enable-compiler-warnings=yes to succeed and --disable-vec.

Edited by Peter W. Draper

Merge request reports