diff options
author | wm4 <wm4@nowhere> | 2014-02-01 23:56:56 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-02 00:00:14 +0100 |
commit | 74b8223da65dca79b0daf2b89b8b6fb6ca81293b (patch) | |
tree | e223315a89c8c0781b3ad29a5da46b41323f4096 /waftools | |
parent | eb1778074078077d2bc0035fb402dda6b9df81a8 (diff) |
build: switch to -std=c99 for saner float semantics
This fixes a weird bug with aspect ratio handling. It has to do with
float handling: with -std=gnu99, gcc implicitly enables broken non-
standard semantics giving float variables excess precision. This can for
example make this fail in theory: "float a = 0.1; assert(a == a);"
While standard C allows excess precision _within_ expressions, it
requires truncation when storing float values in variables of types
"float" or "double". The "gnu99" mode breaks this. It can be unbroken by
using "c99", or by specifying -fexcess-precision=standard. The former
seems less likely to break compilers other than modern gcc. Note that
-ffloat-store would also fix this, but also makes float expressions less
efficient and less precise for no reason.
The code that mistakenly fails because of this is dec_video.c line 393.
It caused the container aspect to be ignored in some or all situations,
depending how the compiler optimizes. For example, on gcc-4.6 with -Os,
the aspect is always ignored.
In future, we should probably just get rid of storing aspects as floats.
Diffstat (limited to 'waftools')
-rw-r--r-- | waftools/detections/compiler.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/waftools/detections/compiler.py b/waftools/detections/compiler.py index a3ad2835d2..f473680bc6 100644 --- a/waftools/detections/compiler.py +++ b/waftools/detections/compiler.py @@ -15,7 +15,7 @@ def __add_generic_flags__(ctx): ctx.env.CFLAGS += ["-D_ISOC99_SOURCE", "-D_GNU_SOURCE", "-D_LARGEFILE_SOURCE", "-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE64_SOURCE", - "-std=gnu99", "-Wall"] + "-std=c99", "-Wall"] if ctx.is_debug_build(): ctx.env.CFLAGS += ['-g'] |