]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-102711: Fix warnings found by clang (#102712)
authorChenxi Mao <chenxi.mao@suse.com>
Tue, 28 Mar 2023 08:52:22 +0000 (16:52 +0800)
committerGitHub <noreply@github.com>
Tue, 28 Mar 2023 08:52:22 +0000 (10:52 +0200)
There are some warnings if build python via clang:

Parser/pegen.c:812:31: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
_PyPegen_clear_memo_statistics()
                              ^
                               void

Parser/pegen.c:820:29: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
_PyPegen_get_memo_statistics()
                            ^
                             void

Fix it to make clang happy.

Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
Misc/NEWS.d/next/Build/2023-03-15-02-03-39.gh-issue-102711.zTkjts.rst [new file with mode: 0644]
Parser/pegen.c

diff --git a/Misc/NEWS.d/next/Build/2023-03-15-02-03-39.gh-issue-102711.zTkjts.rst b/Misc/NEWS.d/next/Build/2023-03-15-02-03-39.gh-issue-102711.zTkjts.rst
new file mode 100644 (file)
index 0000000..5118439
--- /dev/null
@@ -0,0 +1 @@
+Fix ``-Wstrict-prototypes`` compiler warnings.
index 94dd9de8a431c115705f619199fe7b10ffe6fc55..b79ae4cb1fb3706e508c9558b2f9450df1efd1c6 100644 (file)
@@ -250,7 +250,7 @@ _PyPegen_fill_token(Parser *p)
 #define memo_statistics _PyRuntime.parser.memo_statistics
 
 void
-_PyPegen_clear_memo_statistics()
+_PyPegen_clear_memo_statistics(void)
 {
     for (int i = 0; i < NSTATISTICS; i++) {
         memo_statistics[i] = 0;
@@ -258,7 +258,7 @@ _PyPegen_clear_memo_statistics()
 }
 
 PyObject *
-_PyPegen_get_memo_statistics()
+_PyPegen_get_memo_statistics(void)
 {
     PyObject *ret = PyList_New(NSTATISTICS);
     if (ret == NULL) {