bpo-5755: Move -Wstrict-prototypes to CFLAGS_NODIST#7395
Conversation
| esac | ||
|
|
||
| OPT="$OPT $STRICT_PROTO" | ||
| OPT="$OPT" |
There was a problem hiding this comment.
Does this line make any sense now?
| case $GCC in | ||
| yes) | ||
| CFLAGS_NODIST="$CFLAGS_NODIST -std=c99" | ||
| if test "$CC" != 'g++' ; then |
There was a problem hiding this comment.
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.
Added check for -Wstrict-prototypes
|
|
||
| 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.
Is not -Werror needed?
There was a problem hiding this comment.
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.
$ 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.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
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 <methane@users.noreply.github.com>
|
Sorry, @methane, I could not cleanly backport this to |
(cherry picked from commit e336484)
). (cherry picked from commit e336484) Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
). (cherry picked from commit e336484) Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
|
GH-7438 is a backport of this pull request to the 3.6 branch. |
https://bugs.python.org/issue5755