New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workarounds for a bug in certain versions of Mono (3.10 and certain versions of 3.8) which stops OpenRA building #6931
Conversation
If you could leave a comment above these such as |
44b935e
to
34b0413
Compare
Good shout. I had considered it, but worried it might make the code look less clean. Updated with comment referring to the bug report for the mono bug. |
I dont agree with the comment, its unnecessary, the commit message is more than enough. New people looking in the code will wonder for what code it actually was a workaround for (o.0) Also it looks way better than the code it replaces, because this way it is clear within one second what it does as oposed to the previous cryptic (o.0) construct and, as a nice bonus this one does compile on newer mono. Back on topic: Should we make a new 20141029 release with this one cherrypicked on top of it? Maybe this bug is the one keeping arch linux from updating its package? - which in turn fragments the online community. |
? ts[i, j] : t; | ||
// Workaround for broken ternary operators in 64 bit mono: https://bugzilla.xamarin.com/show_bug.cgi?id=23319 | ||
if (i <= ts.GetUpperBound(0) && j <= ts.GetUpperBound(1)) | ||
result [i, j] = ts [i, j]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stray spaces before [
If this is all that it takes to make 3.10 compile again, then I'm all for it, 👍 . My impression was that 3.10 broke all ternary operators, not only some of them. |
Can we lean on Xamarin / mono project a bit to get a fix for this into 3.10.1? This seems ridiculous. 👍 for the fix. |
…lding on Mono 3.10 and certain versions of the 3.8 series due to a bug in Mono: https://bugzilla.xamarin.com/show_bug.cgi?id=23319
f69a1b7
to
04cbea3
Compare
Cheers guys :D. Made changes based on code reviews:
@MatthijsBenschop as an arch linux user, I ran into this mono bug while trying to manually compiling the project to play OpenRA since the package hasn't been updated, so this is perhaps the case. |
Workarounds for a bug in certain versions of Mono (3.10 and certain versions of 3.8) which stops OpenRA building
I can confirm that this fixed the Arch Linux build. https://build.opensuse.org/package/show/games:openra/development |
This is now resolved upsteam. http://www.mono-project.com/docs/about-mono/releases/3.12.0/#c-compiler-bug-fixes |
[happy0@gamma OpenRA]$ make
CSC OpenRA.Game.exe
OpenRA.Game/Exts.cs(378,6): error CS1525: Unexpected symbol `?'
Compilation failed: 1 error(s), 0 warnings
Makefile:249: recipe for target 'OpenRA.Game.exe' failed
make: *** [OpenRA.Game.exe] Error 1
[happy0@gamma OpenRA]$ mono -V
Mono JIT compiler version 3.10.0 (tarball Mon Oct 6 20:46:04 UTC 2014)
Mono bug report : https://bugzilla.xamarin.com/show_bug.cgi?id=23319 (it appears to have been resolved in master so shouldn't be present in future versions of Mono)
Mono 3.10 seems to be unhappy with ternary statements of a certain format, so I desugared those breaking the build into if statements (and OpenRA subsequently built.)
I wasn't sure whether you would accept this pull request, since I'm not sure whether changing code to work around compiler bugs is even a good idea, but I thought I'd give you guys the option anyway. Arguably the code is a bit more readable this way anyway :P. Up to you!