diff --git a/build-all.sh b/build-all.sh index ff45d826..054a4607 100755 --- a/build-all.sh +++ b/build-all.sh @@ -50,7 +50,8 @@ for f in example/*; do g++ -Wall -Werror $f/*.cc -o $f/a.out elif [ "$f" = "example/library" ]; then # example/library is unusual in that it uses separately compiled libraries - # instead of directly #include'ing Wuffs' .c files. + # (built by "wuffs genlib" above) instead of directly #include'ing Wuffs' + # .c files. gcc -Wall -Werror -static -I.. $f/*.c gen/lib/c/gcc-static/libwuffs.a -o $f/a.out elif [ -e $f/*.c ]; then gcc -Wall -Werror $f/*.c -o $f/a.out @@ -65,9 +66,9 @@ done # If you wanted to build a release edition now, do something like: # wuffs genrelease -version=0.0.0-manualtest -# Even if we don't build the release editions, check that they compile with -# -Wall -Werror. +# Even if we don't build the release editions, check that they compile without +# any warnings. for f in release/c/wuffs-*/*.c; do gcc -c -Wall -Werror -std=c99 $f -o /dev/null - g++ -c -std=c++11 $f -o /dev/null + g++ -c -Wall -Werror -std=c++11 $f -o /dev/null done diff --git a/cmd/wuffs-c/internal/cgen/builtin.go b/cmd/wuffs-c/internal/cgen/builtin.go index 0c62e42c..7acd4a47 100644 --- a/cmd/wuffs-c/internal/cgen/builtin.go +++ b/cmd/wuffs-c/internal/cgen/builtin.go @@ -445,7 +445,7 @@ func (g *gen) writeBuiltinCallSuspendibles(b *buffer, n *a.Expr, depth uint32) e return err } - b.printf("if (%s > iobounds1_src - ioptr_src) {\n", scratchName) + b.printf("if (%s > ((uint64_t)(iobounds1_src - ioptr_src))) {\n", scratchName) b.printf("%s -= iobounds1_src - ioptr_src;\n", scratchName) b.printf("ioptr_src = iobounds1_src;\n") diff --git a/gen/c/std/gif.c b/gen/c/std/gif.c index d35b11d1..231faf55 100644 --- a/gen/c/std/gif.c +++ b/gen/c/std/gif.c @@ -2906,7 +2906,7 @@ static wuffs_base__status wuffs_gif__decoder__decode_lsd( self->private_impl.c_decode_lsd[0].scratch = 2; WUFFS_BASE__COROUTINE_SUSPENSION_POINT(7); if (self->private_impl.c_decode_lsd[0].scratch > - iobounds1_src - ioptr_src) { + ((uint64_t)(iobounds1_src - ioptr_src))) { self->private_impl.c_decode_lsd[0].scratch -= iobounds1_src - ioptr_src; ioptr_src = iobounds1_src; goto short_read_src; @@ -3158,7 +3158,7 @@ static wuffs_base__status wuffs_gif__decoder__skip_blocks( self->private_impl.c_skip_blocks[0].scratch = ((uint32_t)(v_block_size)); WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3); if (self->private_impl.c_skip_blocks[0].scratch > - iobounds1_src - ioptr_src) { + ((uint64_t)(iobounds1_src - ioptr_src))) { self->private_impl.c_skip_blocks[0].scratch -= iobounds1_src - ioptr_src; ioptr_src = iobounds1_src; @@ -3255,7 +3255,7 @@ static wuffs_base__status wuffs_gif__decoder__decode_ae( self->private_impl.c_decode_ae[0].scratch = ((uint32_t)(v_block_size)); WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3); if (self->private_impl.c_decode_ae[0].scratch > - iobounds1_src - ioptr_src) { + ((uint64_t)(iobounds1_src - ioptr_src))) { self->private_impl.c_decode_ae[0].scratch -= iobounds1_src - ioptr_src; ioptr_src = iobounds1_src; @@ -3298,7 +3298,7 @@ static wuffs_base__status wuffs_gif__decoder__decode_ae( self->private_impl.c_decode_ae[0].scratch = ((uint32_t)(v_block_size)); WUFFS_BASE__COROUTINE_SUSPENSION_POINT(7); if (self->private_impl.c_decode_ae[0].scratch > - iobounds1_src - ioptr_src) { + ((uint64_t)(iobounds1_src - ioptr_src))) { self->private_impl.c_decode_ae[0].scratch -= iobounds1_src - ioptr_src; ioptr_src = iobounds1_src; @@ -3320,7 +3320,7 @@ static wuffs_base__status wuffs_gif__decoder__decode_ae( self->private_impl.c_decode_ae[0].scratch = 2; WUFFS_BASE__COROUTINE_SUSPENSION_POINT(10); if (self->private_impl.c_decode_ae[0].scratch > - iobounds1_src - ioptr_src) { + ((uint64_t)(iobounds1_src - ioptr_src))) { self->private_impl.c_decode_ae[0].scratch -= iobounds1_src - ioptr_src; ioptr_src = iobounds1_src; diff --git a/gen/c/std/gzip.c b/gen/c/std/gzip.c index cbbdd08e..f0ecad26 100644 --- a/gen/c/std/gzip.c +++ b/gen/c/std/gzip.c @@ -2529,7 +2529,8 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5); self->private_impl.c_decode[0].scratch = 6; WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6); - if (self->private_impl.c_decode[0].scratch > iobounds1_src - ioptr_src) { + if (self->private_impl.c_decode[0].scratch > + ((uint64_t)(iobounds1_src - ioptr_src))) { self->private_impl.c_decode[0].scratch -= iobounds1_src - ioptr_src; ioptr_src = iobounds1_src; goto short_read_src; @@ -2567,7 +2568,8 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, WUFFS_BASE__COROUTINE_SUSPENSION_POINT(9); self->private_impl.c_decode[0].scratch = ((uint32_t)(v_xlen)); WUFFS_BASE__COROUTINE_SUSPENSION_POINT(10); - if (self->private_impl.c_decode[0].scratch > iobounds1_src - ioptr_src) { + if (self->private_impl.c_decode[0].scratch > + ((uint64_t)(iobounds1_src - ioptr_src))) { self->private_impl.c_decode[0].scratch -= iobounds1_src - ioptr_src; ioptr_src = iobounds1_src; goto short_read_src; @@ -2610,7 +2612,8 @@ wuffs_base__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self, WUFFS_BASE__COROUTINE_SUSPENSION_POINT(13); self->private_impl.c_decode[0].scratch = 2; WUFFS_BASE__COROUTINE_SUSPENSION_POINT(14); - if (self->private_impl.c_decode[0].scratch > iobounds1_src - ioptr_src) { + if (self->private_impl.c_decode[0].scratch > + ((uint64_t)(iobounds1_src - ioptr_src))) { self->private_impl.c_decode[0].scratch -= iobounds1_src - ioptr_src; ioptr_src = iobounds1_src; goto short_read_src;