deplinenoise/tundra — Issue #105: Compiling tundra on win32
Author: leidegre
Created: 2012-01-07 15:12:29+00:00
State: open

I've noticed some minor issues when compiling tundra using the MSVC toolset.

I get some compiler warnings (and since these warnings are treated as errors, it causes the following problems)

src\generic_scanner.c(131) : warning C4244: '=' : conversion from 'int' to 'unsigned char', possible loss of data

dest->is_system_include = scanner->bare_means_system;

c:\projects\github\tundra\src\generic_scanner.c(91) : warning C4701: potentially uninitialized local variable 'kw' used

This one is just sad, the compiler should be able to realize that `kw` is initialized (given that `KWSET_COUNT` is larger than zero). But MSVC doesn't.

Until now, I've just removed `/WX` from `tundra.lua` but maybe we could address these issues by ignoring the specific warnings. Or applying the following changes.

dest->is_system_include = scanner->bare_means_system;

into:

dest->is_system_include = (unsigned char)scanner->bare_means_system;

...and set `kw` to `0` from start on line 65.

No big deal really, and my C skills are not really that amazing so if there's a better way here, I'm all ears.

The last thing I've noticed is that there's appears to be alignment differences between MinGW (this is the cross compiler in question, right?) and MSVC. When I use the official tundra builds for win32 they always complain about a bad `.tundra-ancestors` file. And I've arrvied at the conclusion that this is due to compiler alignment differences (though, I could be wrong). Now I would fully expect this to be an issue between win32 and win64 builds but when talking about an official win32 builds and a MSVC build it would be nice if the `.tundra-ancestors` file could be reused. I have to perform full rebuilds when I try out things with tundra myself because of this difference.

To illustrate this point I download the source and the offical win32 build and then build tundra using tundra.

tundra win32-msvc-production-standalone

And that takes a couple of seconds but then everything is fine. But if I use the tundra.exe from `tundra-output\win32-msvc-production-standalone` now, I get the following error:

illegal ancestor file: 5360 not a multiple of 48 bytes

Maybe we could fix this with some compiler flags or metadata/attribute for forcing alignment across platforms?