Skip to content

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

Merged
merged 4 commits into from
Jun 5, 2018

Conversation

methane
Copy link
Member

@methane methane commented Jun 4, 2018

configure.ac Outdated
@@ -1470,7 +1467,7 @@ then
;;
esac

OPT="$OPT $STRICT_PROTO"
OPT="$OPT"
Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member

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.

Copy link
Member Author

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"
Copy link
Member

@serhiy-storchaka serhiy-storchaka Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not -Werror needed?

Copy link
Member Author

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?

Copy link
Member Author

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.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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.

@serhiy-storchaka
Copy link
Member

AppVeyor failure is not related.

@methane methane merged commit e336484 into python:master Jun 5, 2018
@miss-islington
Copy link
Contributor

Thanks @methane for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-7422 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 5, 2018
@miss-islington
Copy link
Contributor

Sorry, @methane, I could not cleanly backport this to 3.6 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker e33648484775fa533fc8f1e5cc45f60061d29d54 3.6

miss-islington added a commit that referenced this pull request Jun 6, 2018
(cherry picked from commit e336484)

Co-authored-by: INADA Naoki <[email protected]>
methane added a commit to methane/cpython that referenced this pull request Jun 6, 2018
methane added a commit to methane/cpython that referenced this pull request Jun 6, 2018
methane added a commit to methane/cpython that referenced this pull request Jun 6, 2018
@bedevere-bot
Copy link

GH-7438 is a backport of this pull request to the 3.6 branch.

methane added a commit that referenced this pull request Jun 6, 2018
jdemeyer added a commit to jdemeyer/cpython that referenced this pull request Jun 7, 2018
jdemeyer added a commit to jdemeyer/cpython that referenced this pull request Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants