1
1
# Autoconf include file defining macros related to compile-time warnings.
2
2
3
- # Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
3
+ # Copyright 2004, 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
4
4
5
5
# This file is part of GCC.
6
6
@@ -28,7 +28,13 @@ AC_SUBST(acx_Var)dnl
28
28
m4_expand_once([ acx_Var=
29
29
] ,m4_quote ( acx_Var= ) )dnl
30
30
save_CFLAGS="$CFLAGS"
31
- for option in $1 ; do
31
+ for real_option in $1 ; do
32
+ # Do the check with the no- prefix removed since gcc silently
33
+ # accepts any -Wno-* option on purpose
34
+ case $real_option in
35
+ -Wno-*) option=-W`expr $real_option : '-Wno-\(.*\)'` ;;
36
+ *) option=$real_option ;;
37
+ esac
32
38
AS_VAR_PUSHDEF ( [ acx_Woption] , [ acx_cv_prog_cc_warning_$option] )
33
39
AC_CACHE_CHECK ( [ whether $CC supports $option] , acx_Woption ,
34
40
[ CFLAGS="$option"
@@ -37,14 +43,14 @@ for option in $1; do
37
43
[ AS_VAR_SET ( acx_Woption , no ) ] )
38
44
] )
39
45
AS_IF ( [ test AS_VAR_GET(acx_Woption) = yes] ,
40
- [ acx_Var="$acx_Var${acx_Var:+ }$option "] )
46
+ [ acx_Var="$acx_Var${acx_Var:+ }$real_option "] )
41
47
AS_VAR_POPDEF ( [ acx_Woption] ) dnl
42
48
done
43
49
CFLAGS="$save_CFLAGS"
44
50
m4_popdef ( [ acx_Var] ) dnl
45
51
] ) # ACX_PROG_CC_WARNING_OPTS
46
52
47
- # ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(WARNINGS, [VARIABLE = WARN_PEDANTIC)
53
+ # ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(WARNINGS, [VARIABLE = WARN_PEDANTIC] )
48
54
# Append to VARIABLE "-pedantic" + the argument, if the compiler is GCC
49
55
# and accepts all of those options simultaneously, otherwise to nothing.
50
56
AC_DEFUN ( [ ACX_PROG_CC_WARNING_ALMOST_PEDANTIC] ,
@@ -53,11 +59,14 @@ m4_pushdef([acx_Var], [m4_default([$2], [WARN_PEDANTIC])])dnl
53
59
AC_SUBST ( acx_Var ) dnl
54
60
m4_expand_once([ acx_Var=
55
61
] ,m4_quote ( acx_Var= ) )dnl
56
- AS_VAR_PUSHDEF ( [ acx_Pedantic] , [ acx_cv_prog_cc_pedantic_$1 ] ) dnl
62
+ # Do the check with the no- prefix removed from the warning options
63
+ # since gcc silently accepts any -Wno-* option on purpose
64
+ m4_pushdef ( [ acx_Woptions] , [ m4_bpatsubst ( [ $1 ] , [ -Wno-] , [ -W] ) ] ) dnl
65
+ AS_VAR_PUSHDEF ( [ acx_Pedantic] , [ acx_cv_prog_cc_pedantic_] acx_Woptions ) dnl
57
66
AS_IF ( [ test "$GCC" = yes] ,
58
- [ AC_CACHE_CHECK ( [ whether $CC supports -pedantic $1 ] , acx_Pedantic ,
67
+ [ AC_CACHE_CHECK ( [ whether $CC supports -pedantic ] acx_Woptions , acx_Pedantic ,
59
68
[ save_CFLAGS="$CFLAGS"
60
- CFLAGS="-pedantic $1 "
69
+ CFLAGS="-pedantic acx_Woptions "
61
70
AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ ] ,[ ] ) ] ,
62
71
[ AS_VAR_SET ( acx_Pedantic , yes ) ] ,
63
72
[ AS_VAR_SET ( acx_Pedantic , no ) ] )
@@ -66,6 +75,7 @@ AS_IF([test AS_VAR_GET(acx_Pedantic) = yes],
66
75
[ acx_Var="$acx_Var${acx_Var:+ }-pedantic $1 "] )
67
76
] )
68
77
AS_VAR_POPDEF ( [ acx_Pedantic] ) dnl
78
+ m4_popdef ( [ acx_Woptions] ) dnl
69
79
m4_popdef ( [ acx_Var] ) dnl
70
80
] ) # ACX_PROG_CC_WARNING_ALMOST_PEDANTIC
71
81
0 commit comments