-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-5755: Move -Wstrict-prototypes to CFLAGS_NODIST #7395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
configure.ac
Outdated
@@ -1470,7 +1467,7 @@ then | |||
;; | |||
esac | |||
|
|||
OPT="$OPT $STRICT_PROTO" | |||
OPT="$OPT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this line make any sense now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this line
configure.ac
Outdated
@@ -1494,7 +1491,10 @@ AC_SUBST(UNIVERSAL_ARCH_FLAGS) | |||
# tweak BASECFLAGS based on compiler and platform | |||
case $GCC in | |||
yes) | |||
CFLAGS_NODIST="$CFLAGS_NODIST -std=c99" | |||
if test "$CC" != 'g++' ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have doubts that this test makes sense. First, g++ is not used for compiling the Python interpreter, because C99 constructions incompatible with C++ are used in CPython sources. Second, it doesn't work for e.g. CC=/usr/bin/x86_64-linux-gnu-g++-7
. It would be more reliable to use a test similar to tests for options -Wunused-result
etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added check for -Wstrict-prototypes
configure.ac
Outdated
@@ -1678,6 +1673,26 @@ yes) | |||
fi | |||
AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning) | |||
|
|||
AC_MSG_CHECKING(if we can turn on $CC strict-prototypes warning) | |||
ac_save_cc="$CC" | |||
CC="$CC -Wstrict-prototypes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not -Werror
needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, some other -Wxxx
checks doesn't add -Werror
.
Anyway, I can't test this checking properly with g++, because g++ doesn't support -std=c99
too.
May I remove this check and simply add -Wstrict-prototypes
in addition to -std=c99
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ g++ -Wstrict-prototypes -c x.c
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
$ echo $?
0
$ g++ -Wstrict-prototypes -Werror -c x.c
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
$ echo $?
0
$ g++ -Werror -Wstrict-prototypes -c x.c
cc1plus: error: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [-Werror]
cc1plus: all warnings being treated as errors
$ echo $?
1
It looks -Werror
is needed before -Wstrict-prototypes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not an autotools expert too, but this change LGTM.
AppVeyor failure is not related. |
Thanks @methane for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
GH-7422 is a backport of this pull request to the 3.7 branch. |
(cherry picked from commit e336484) Co-authored-by: INADA Naoki <[email protected]>
Sorry, @methane, I could not cleanly backport this to |
(cherry picked from commit e336484) Co-authored-by: INADA Naoki <[email protected]>
(cherry picked from commit e336484)
). (cherry picked from commit e336484) Co-authored-by: INADA Naoki <[email protected]>
). (cherry picked from commit e336484) Co-authored-by: INADA Naoki <[email protected]>
GH-7438 is a backport of this pull request to the 3.6 branch. |
https://bugs.python.org/issue5755