diff mbox

[11/11] configure: Check for -Werror causing failures when compiling tests

Message ID CAAu8pHu1gRD3MLP1wfHDmwjQJxHAacUqo_DtaKrMnC5iKO7+Fg@mail.gmail.com
State New
Headers show

Commit Message

Blue Swirl Aug. 4, 2012, 5:57 p.m. UTC
On Sat, Jul 28, 2012 at 1:48 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 28 July 2012 13:31, Blue Swirl <blauwirbel@gmail.com> wrote:
>> I'm getting this error, probably because now Valgrind support is enabled:
>>   CC    coroutine-ucontext.o
>> cc1: warnings being treated as errors
>> /src/qemu/coroutine-ucontext.c:204: error: unknown option after
>> '#pragma GCC diagnostic' kind
>> /src/qemu/coroutine-ucontext.c:209: error: unknown option after
>> '#pragma GCC diagnostic' kind
>>
>> Maybe the compiler does not understand this pragma and Valgrind check
>> should also fail in that case.
>
> Yeah, I think this is one of the few tests which want to explicitly
> check "is this construct going to provoke a compiler warning" --
> fix is for that test to explictly put -Werror in the cflags in
> the compile_prog line.

Now with your Xen configure patches in place, I'm not getting errors
with this applied except for Clang (which I didn't test earlier).
Maybe this should be applied.

clang -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall
-Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing
-fstack-protector-all -Wendif-labels -Wmissing-include-dirs
-Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k
-Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits
-I/usr/include/libpng12 -o /tmp/qemu-conf--25992-.exe
/tmp/qemu-conf--25992-.c -Wl,-z,relro -Wl,-z,now -pie -m64 -g
/tmp/qemu-conf--25992-.c:4:32: warning: self-comparison always
evaluates to true [-Wtautological-compare]
int main(void) { return preadv == preadv; }
                               ^
1 warning generated.
clang -Werror -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall
-Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing
-fstack-protector-all -Wendif-labels -Wmissing-include-dirs
-Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k
-Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits
-I/usr/include/libpng12 -o /tmp/qemu-conf--25992-.exe
/tmp/qemu-conf--25992-.c -Wl,-z,relro -Wl,-z,now -pie -m64 -g
/tmp/qemu-conf--25992-.c:4:32: error: self-comparison always evaluates
to true [-Werror,-Wtautological-compare]
int main(void) { return preadv == preadv; }
                               ^
1 error generated.
ERROR: configure test passed without -Werror but failed with -Werror.

clang -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall
-Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing
-fstack-protector-all -Wendif-labels -Wmissing-include-dirs
-Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k
-Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits
-I/usr/include/libpng12 -o /tmp/qemu-conf--25992-.exe
/tmp/qemu-conf--25992-.c -Wl,-z,relro -Wl,-z,now -pie -m64 -g
/tmp/qemu-conf--25992-.c:13:26: warning: self-comparison always
evaluates to true [-Wtautological-compare]
    return epoll_create1 == epoll_create1;
                         ^
1 warning generated.
clang -Werror -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall
-Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing
-fstack-protector-all -Wendif-labels -Wmissing-include-dirs
-Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k
-Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits
-I/usr/include/libpng12 -o /tmp/qemu-conf--25992-.exe
/tmp/qemu-conf--25992-.c -Wl,-z,relro -Wl,-z,now -pie -m64 -g
/tmp/qemu-conf--25992-.c:13:26: error: self-comparison always
evaluates to true [-Werror,-Wtautological-compare]
    return epoll_create1 == epoll_create1;
                         ^
1 error generated.
ERROR: configure test passed without -Werror but failed with -Werror.

clang -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall
-Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing
-fstack-protector-all -Wendif-labels -Wmissing-include-dirs
-Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k
-Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits
-I/usr/include/libpng12 -I/usr/include/nss -I/usr/include/nspr
-pthread -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -o
/tmp/qemu-conf--25992-.exe /tmp/qemu-conf--25992-.c -Wl,-z,relro
-Wl,-z,now -pie -m64 -g
/tmp/qemu-conf--25992-.c:3:13: warning: explicitly assigning a
variable of type 'char **' to itself [-Wself-assign]
    environ = environ;
    ~~~~~~~ ^ ~~~~~~~
1 warning generated.
clang -Werror -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall
-Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing
-fstack-protector-all -Wendif-labels -Wmissing-include-dirs
-Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k
-Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits
-I/usr/include/libpng12 -I/usr/include/nss -I/usr/include/nspr
-pthread -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -o
/tmp/qemu-conf--25992-.exe /tmp/qemu-conf--25992-.c -Wl,-z,relro
-Wl,-z,now -pie -m64 -g
/tmp/qemu-conf--25992-.c:3:13: error: explicitly assigning a variable
of type 'char **' to itself [-Werror,-Wself-assign]
    environ = environ;
    ~~~~~~~ ^ ~~~~~~~
1 error generated.
ERROR: configure test passed without -Werror but failed with -Werror.

I used this hack to get more than one warning:
+#    exit 1
 }

 compile_object() {

>
> -- PMM

Comments

Peter Maydell Aug. 9, 2012, 6:24 p.m. UTC | #1
On 4 August 2012 18:57, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Sat, Jul 28, 2012 at 1:48 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 28 July 2012 13:31, Blue Swirl <blauwirbel@gmail.com> wrote:
>>> I'm getting this error, probably because now Valgrind support is enabled:
>>>   CC    coroutine-ucontext.o
>>> cc1: warnings being treated as errors
>>> /src/qemu/coroutine-ucontext.c:204: error: unknown option after
>>> '#pragma GCC diagnostic' kind
>>> /src/qemu/coroutine-ucontext.c:209: error: unknown option after
>>> '#pragma GCC diagnostic' kind
>>>
>>> Maybe the compiler does not understand this pragma and Valgrind check
>>> should also fail in that case.
>>
>> Yeah, I think this is one of the few tests which want to explicitly
>> check "is this construct going to provoke a compiler warning" --
>> fix is for that test to explictly put -Werror in the cflags in
>> the compile_prog line.
>
> Now with your Xen configure patches in place, I'm not getting errors
> with this applied except for Clang (which I didn't test earlier).
> Maybe this should be applied.

Yes, I think that (assuming we are going to go down this route at all)
it would be good to apply this 11/11 patch now in good time before
the freeze. Does anybody want to object?

thanks
-- PMM
Blue Swirl Aug. 9, 2012, 8:15 p.m. UTC | #2
On Thu, Aug 9, 2012 at 6:24 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 4 August 2012 18:57, Blue Swirl <blauwirbel@gmail.com> wrote:
>> On Sat, Jul 28, 2012 at 1:48 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> On 28 July 2012 13:31, Blue Swirl <blauwirbel@gmail.com> wrote:
>>>> I'm getting this error, probably because now Valgrind support is enabled:
>>>>   CC    coroutine-ucontext.o
>>>> cc1: warnings being treated as errors
>>>> /src/qemu/coroutine-ucontext.c:204: error: unknown option after
>>>> '#pragma GCC diagnostic' kind
>>>> /src/qemu/coroutine-ucontext.c:209: error: unknown option after
>>>> '#pragma GCC diagnostic' kind
>>>>
>>>> Maybe the compiler does not understand this pragma and Valgrind check
>>>> should also fail in that case.
>>>
>>> Yeah, I think this is one of the few tests which want to explicitly
>>> check "is this construct going to provoke a compiler warning" --
>>> fix is for that test to explictly put -Werror in the cflags in
>>> the compile_prog line.
>>
>> Now with your Xen configure patches in place, I'm not getting errors
>> with this applied except for Clang (which I didn't test earlier).
>> Maybe this should be applied.
>
> Yes, I think that (assuming we are going to go down this route at all)
> it would be good to apply this 11/11 patch now in good time before
> the freeze. Does anybody want to object?

I'll send a patch that fixes configure with Clang.

>
> thanks
> -- PMM
diff mbox

Patch

diff --git a/configure b/configure
index d8ec050..eb2ed2f 100755
--- a/configure
+++ b/configure
@@ -46,11 +46,11 @@  do_cc() {
     esac
     echo $cc -Werror "$@" >> config.log
     $cc -Werror "$@" >> config.log 2>&1 && return $?
-    echo "ERROR: configure test passed without -Werror but failed
with -Werror."
-    echo "This is probably a bug in the configure script. The failing command"
-    echo "will be at the bottom of config.log."
-    echo "You can run configure with --disable-werror to bypass this check."
-    exit 1
+    echo "ERROR: configure test passed without -Werror but failed
with -Werror." >> config.log
+    echo "This is probably a bug in the configure script. The failing
command" >> config.log
+    echo "will be at the bottom of config.log." >> config.log
+    echo "You can run configure with --disable-werror to bypass this
check." >> config.log