GNOME Bugzilla – Bug 760134
audioconvert test: doesn't build with clang
Last modified: 2016-01-06 01:16:44 UTC
The elements/audioconvert test doesn't build with clang 3.7.1. CC elements/elements_audioconvert-audioconvert.o elements/audioconvert.c:650:12: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (1 << 15), (-32 << 16) - (1 << 15), ~~~ ^ elements/audioconvert.c:650:37: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (1 << 15), (-32 << 16) - (1 << 15), ~~~ ^ elements/audioconvert.c:651:12: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (2 << 15), (-32 << 16) - (2 << 15), ~~~ ^ elements/audioconvert.c:651:37: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (2 << 15), (-32 << 16) - (2 << 15), ~~~ ^ elements/audioconvert.c:652:12: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) ~~~ ^ elements/audioconvert.c:673:12: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (1 << 15), (-32 << 16) - (1 << 15), ~~~ ^ elements/audioconvert.c:673:37: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (1 << 15), (-32 << 16) - (1 << 15), ~~~ ^ elements/audioconvert.c:674:12: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (2 << 15), (-32 << 16) - (2 << 15), ~~~ ^ elements/audioconvert.c:674:37: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (2 << 15), (-32 << 16) - (2 << 15), ~~~ ^ elements/audioconvert.c:675:12: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) ~~~ ^ elements/audioconvert.c:815:26: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (gdouble) (-32768L << 16) / 2147483648.0, /* ~ -1.0 */ ~~~~~~~ ^ elements/audioconvert.c:817:26: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (gdouble) (-16384L << 16) / 2147483648.0, /* ~ -0.5 */ ~~~~~~~ ^ elements/audioconvert.c:825:29: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] gint32 in[] = { 0, (-1L << 31), (1L << 30), (-1L << 30) }; ~~~ ^ elements/audioconvert.c:825:54: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] gint32 in[] = { 0, (-1L << 31), (1L << 30), (-1L << 30) }; ~~~ ^ elements/audioconvert.c:827:22: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (gdouble) (-1L << 31) / 2147483648.0, /* ~ -1.0 */ ~~~ ^ elements/audioconvert.c:829:22: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (gdouble) (-1L << 30) / 2147483648.0, /* ~ -0.5 */ ~~~ ^ elements/audioconvert.c:1070:12: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (1 << 15), (-32 << 16) - (1 << 15), ~~~ ^ elements/audioconvert.c:1070:37: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (1 << 15), (-32 << 16) - (1 << 15), ~~~ ^ elements/audioconvert.c:1071:12: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (2 << 15), (-32 << 16) - (2 << 15), ~~~ ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. Makefile:2519: recipe for target 'elements/elements_audioconvert-audioconvert.o' failed
Does changing it from "(-32 << 16)" to "(-(32 << 16))" fix the warnings? That's the intention of the code at least.
Created attachment 318288 [details] [review] patch with suggested build fix This patch with the suggested change fixes the build with clang. Sorry no git format-patch, the ident git pre-commit hook was giving me a truck load of ident changes too.
Review of attachment 318288 [details] [review]: Please re-submit using git format-path. If you believe the indent is appropriate, you can use git commit -n to skip the checks. Please mention this though while submitting, so we can have a closer look.
commit 17b16e7a8350db7d83cc94093b81c4240850140d Author: Koop Mast <kwm@FreeBSD.org> Date: Wed Jan 6 01:04:31 2016 +0000 tests: audioconvert: fix test compilation with clang With clang 3.7.1 on FreeBSD: elements/audioconvert.c:650:12: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (1 << 15), (-32 << 16) - (1 << 15), ~~~ ^ https://bugzilla.gnome.org/show_bug.cgi?id=760134 commit e5fb7275c28256974cf71f4dd51a22df61e62f9e Author: Tim-Philipp Müller <tim@centricular.com> Date: Wed Jan 6 01:06:10 2016 +0000ommit 17b16e7a8350db7d83cc94093b81c4240850140d Author: Koop Mast <kwm@FreeBSD.org> Date: Wed Jan 6 01:04:31 2016 +0000 tests: audioconvert: fix test compilation with clang With clang 3.7.1 on FreeBSD: elements/audioconvert.c:650:12: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] (-32 << 16) + (1 << 15), (-32 << 16) - (1 << 15), ~~~ ^ https://bugzilla.gnome.org/show_bug.cgi?id=760134 commit e5fb7275c28256974cf71f4dd51a22df61e62f9e Author: Tim-Philipp Müller <tim@centricular.com> Date: Wed Jan 6 01:06:10 2016 +0000 tests: fix indentation of various unit tests tests: fix indentation of various unit tests