Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8b6f5f2

Browse files
committed
Use -Wformat-security when available
1 parent6fe5e4e commit8b6f5f2

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

‎configure

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4117,6 +4117,64 @@ if test x"$pgac_cv_prog_cc_cflags__Wendif_labels" = x"yes"; then
41174117
CFLAGS="$CFLAGS -Wendif-labels"
41184118
fi
41194119

4120+
# This was included in -Wall/-Wformat in older GCC versions
4121+
{ $as_echo "$as_me:$LINENO: checking whether $CC supports -Wformat-security" >&5
4122+
$as_echo_n "checking whether $CC supports -Wformat-security... " >&6; }
4123+
if test "${pgac_cv_prog_cc_cflags__Wformat_security+set}" = set; then
4124+
$as_echo_n "(cached) " >&6
4125+
else
4126+
pgac_save_CFLAGS=$CFLAGS
4127+
CFLAGS="$pgac_save_CFLAGS -Wformat-security"
4128+
cat >conftest.$ac_ext <<_ACEOF
4129+
/* confdefs.h. */
4130+
_ACEOF
4131+
cat confdefs.h >>conftest.$ac_ext
4132+
cat >>conftest.$ac_ext <<_ACEOF
4133+
/* end confdefs.h. */
4134+
4135+
int
4136+
main ()
4137+
{
4138+
4139+
;
4140+
return 0;
4141+
}
4142+
_ACEOF
4143+
rm -f conftest.$ac_objext
4144+
if { (ac_try="$ac_compile"
4145+
case "(($ac_try" in
4146+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
4147+
*) ac_try_echo=$ac_try;;
4148+
esac
4149+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
4150+
$as_echo "$ac_try_echo") >&5
4151+
(eval "$ac_compile") 2>conftest.er1
4152+
ac_status=$?
4153+
grep -v '^ *+' conftest.er1 >conftest.err
4154+
rm -f conftest.er1
4155+
cat conftest.err >&5
4156+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
4157+
(exit $ac_status); } && {
4158+
test -z "$ac_c_werror_flag" ||
4159+
test ! -s conftest.err
4160+
} && test -s conftest.$ac_objext; then
4161+
pgac_cv_prog_cc_cflags__Wformat_security=yes
4162+
else
4163+
$as_echo "$as_me: failed program was:" >&5
4164+
sed 's/^/| /' conftest.$ac_ext >&5
4165+
4166+
pgac_cv_prog_cc_cflags__Wformat_security=no
4167+
fi
4168+
4169+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4170+
CFLAGS="$pgac_save_CFLAGS"
4171+
fi
4172+
{ $as_echo "$as_me:$LINENO: result: $pgac_cv_prog_cc_cflags__Wformat_security" >&5
4173+
$as_echo "$pgac_cv_prog_cc_cflags__Wformat_security" >&6; }
4174+
if test x"$pgac_cv_prog_cc_cflags__Wformat_security" = x"yes"; then
4175+
CFLAGS="$CFLAGS -Wformat-security"
4176+
fi
4177+
41204178
# Disable strict-aliasing rules; needed for gcc 3.3+
41214179
{ $as_echo "$as_me:$LINENO: checking whether $CC supports -fno-strict-aliasing" >&5
41224180
$as_echo_n "checking whether $CC supports -fno-strict-aliasing... " >&6; }

‎configure.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ if test "$GCC" = yes -a "$ICC" = no; then
429429
# These work in some but not all gcc versions
430430
PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
431431
PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
432+
# This was included in -Wall/-Wformat in older GCC versions
433+
PGAC_PROG_CC_CFLAGS_OPT([-Wformat-security])
432434
# Disable strict-aliasing rules; needed for gcc 3.3+
433435
PGAC_PROG_CC_CFLAGS_OPT([-fno-strict-aliasing])
434436
# Disable optimizations that assume no overflow; needed for gcc 4.3+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp