Skip to content

-Wstrict-prototypes warnings on macOS #103167

@sobolevn

Description

@sobolevn

Recently, I've started noticing new issues while compiling CPython on my mac.

Something like:

Python/ceval_gil.c:470:40: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
unsigned long _PyEval_GetSwitchInterval()
                                       ^
                                        void
1 warning generated.

Details aboit -Wstrict-prototypes: https://www.cism.ucl.ac.be/Services/Formations/ICS/ics_2013.0.028/composer_xe_2013/Documentation/en_US/compiler_c/main_cls/GUID-22FD192C-4C9D-4C16-B3DE-C3629D2EE483.htm

Seems like clang now requires (void) for functions without arguments.

Other developers have also seen these. I have a PR with the fix ready.

To find functions without arguments I've used this regex: \(\)\n+\{
It showed:

» ag '\(\)\n+\{' */**/*.c      
Modules/_tkinter.c
124:_get_tcl_lib_path()
125:{

Modules/posixmodule.c
8549:win32_getppid()
8550:{
13333:check_ShellExecute()
13334:{

PC/launcher.c
452:locate_store_pythons()
453:{
469:locate_venv_python()
470:{
498:locate_all_pythons()
499:{
697:locate_wrapped_script()
698:{
1037:static void read_commands()
1038:{
1687:get_process_name()
1688:{

PC/launcher2.c
135:_getNativeMachine()
136:{
166:isAMD64Host()
167:{
173:isARM64Host()
174:{

Python/ceval_gil.c
470:unsigned long _PyEval_GetSwitchInterval()
471:{

Python/initconfig.c
2358:config_envvars_usage()
2359:{
2364:config_xoptions_usage()
2365:{

Python/sysmodule.c
1491:_sys_getwindowsversion_from_kernel32()
1492:{

Linked PRs

Metadata

Metadata

Assignees

Labels

buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions