diff mbox

[FFmpeg-devel] configure: force erroring out in check_disable_warning() if an option doesn't exists

Message ID 20171012213056.2296-1-jamrial@gmail.com
State Superseded
Headers show

Commit Message

James Almer Oct. 12, 2017, 9:30 p.m. UTC
Should prevent some options from being added to cflags when they
don't exist and the compiler only warns about it.

Signed-off-by: James Almer <jamrial@gmail.com>
---
I figure this is safer than adding
-Werror=unused-command-line-argument -Werror=unknown-warning-option
as Ronald suggested.

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Helmut K. C. Tessarek Oct. 12, 2017, 9:45 p.m. UTC | #1
On 2017-10-12 17:30, James Almer wrote:
> Should prevent some options from being added to cflags when they
> don't exist and the compiler only warns about it.

Just tested your patch.

Yippiieee, warnings gone!
James Almer Oct. 13, 2017, 2:14 p.m. UTC | #2
On 10/12/2017 6:30 PM, James Almer wrote:
> Should prevent some options from being added to cflags when they
> don't exist and the compiler only warns about it.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> I figure this is safer than adding
> -Werror=unused-command-line-argument -Werror=unknown-warning-option
> as Ronald suggested.
> 
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index ade67a31bb..c7962665f1 100755
> --- a/configure
> +++ b/configure
> @@ -6370,7 +6370,7 @@ fi
>  
>  check_disable_warning(){
>      warning_flag=-W${1#-Wno-}
> -    test_cflags $warning_flag && add_cflags $1
> +    test_cflags -Werror $warning_flag && add_cflags $1
>  }
>  
>  check_disable_warning -Wno-parentheses

Ping. This or a similar solution has been annoying Clang users for some
days now and should be part of the 3.4 release.
Hendrik Leppkes Oct. 13, 2017, 2:30 p.m. UTC | #3
On Fri, Oct 13, 2017 at 4:14 PM, James Almer <jamrial@gmail.com> wrote:
> On 10/12/2017 6:30 PM, James Almer wrote:
>> Should prevent some options from being added to cflags when they
>> don't exist and the compiler only warns about it.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> I figure this is safer than adding
>> -Werror=unused-command-line-argument -Werror=unknown-warning-option
>> as Ronald suggested.
>>
>>  configure | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index ade67a31bb..c7962665f1 100755
>> --- a/configure
>> +++ b/configure
>> @@ -6370,7 +6370,7 @@ fi
>>
>>  check_disable_warning(){
>>      warning_flag=-W${1#-Wno-}
>> -    test_cflags $warning_flag && add_cflags $1
>> +    test_cflags -Werror $warning_flag && add_cflags $1
>>  }
>>
>>  check_disable_warning -Wno-parentheses
>
> Ping. This or a similar solution has been annoying Clang users for some
> days now and should be part of the 3.4 release.

I wonder if a general -Werror is really "safer", do these tests really
execute without any other warnings, which might trigger a false
negative? We're not exactly making it compile a proper source file, so
it might warn about random things.

- Hendrik
wm4 Oct. 13, 2017, 3:27 p.m. UTC | #4
On Fri, 13 Oct 2017 16:30:59 +0200
Hendrik Leppkes <h.leppkes@gmail.com> wrote:

> On Fri, Oct 13, 2017 at 4:14 PM, James Almer <jamrial@gmail.com> wrote:
> > On 10/12/2017 6:30 PM, James Almer wrote:  
> >> Should prevent some options from being added to cflags when they
> >> don't exist and the compiler only warns about it.
> >>
> >> Signed-off-by: James Almer <jamrial@gmail.com>
> >> ---
> >> I figure this is safer than adding
> >> -Werror=unused-command-line-argument -Werror=unknown-warning-option
> >> as Ronald suggested.
> >>
> >>  configure | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/configure b/configure
> >> index ade67a31bb..c7962665f1 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -6370,7 +6370,7 @@ fi
> >>
> >>  check_disable_warning(){
> >>      warning_flag=-W${1#-Wno-}
> >> -    test_cflags $warning_flag && add_cflags $1
> >> +    test_cflags -Werror $warning_flag && add_cflags $1
> >>  }
> >>
> >>  check_disable_warning -Wno-parentheses  
> >
> > Ping. This or a similar solution has been annoying Clang users for some
> > days now and should be part of the 3.4 release.  
> 
> I wonder if a general -Werror is really "safer", do these tests really
> execute without any other warnings, which might trigger a false
> negative? We're not exactly making it compile a proper source file, so
> it might warn about random things.

The worst case is that warnings are not disabled, so the risk isn't too
high.

If you really wanted to, you could run the check _without_ any
arguments, to see whether this type of checking works. And if that
fails, dunno, explode?
diff mbox

Patch

diff --git a/configure b/configure
index ade67a31bb..c7962665f1 100755
--- a/configure
+++ b/configure
@@ -6370,7 +6370,7 @@  fi
 
 check_disable_warning(){
     warning_flag=-W${1#-Wno-}
-    test_cflags $warning_flag && add_cflags $1
+    test_cflags -Werror $warning_flag && add_cflags $1
 }
 
 check_disable_warning -Wno-parentheses