I’m impressed

I’ve been working on getting the build files up to date.

I’ve been working thi morning on the WDK 7.1 build.

I’ve made it compile for ARM and IA64 – i.e. sorted out the porting abstraction layers for these processors, which is really nice.

However, the IA64 build was failing to compile – claimed unreachable code in the ringbuffer init.

I’ve just figured out why – and I’m impressed by the compiler.

IA64 does not support DWCAS. As such, the dummy DWCAS macro is in use. The macro takes an argument, result, which normally is set to 1 or 0, but in the dummy macro, is simply set to itself to remove a compiler warning.

The ringbuffer init, inits and then pushes elements to a freelist. The lfds700_freelist_push() function calls the DWCAS macro, from the inside of a loop, where the loop only ends if result is set to 1.

The compiler noticed result would never be set to 1, and was calling – rightly – unreachable code in the ringbuffer init function!