Fix peg_generator compiler warnings under MSVC (GH-20405)

This commit is contained in:
Ammar Askar 2020-05-26 04:33:35 +00:00 committed by GitHub
parent 4a0ac42c52
commit a2bbedc8b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 8 deletions

View File

@ -32,10 +32,6 @@
|| c == '_'\ || c == '_'\
|| (c >= 128)) || (c >= 128))
extern char *PyOS_Readline(FILE *, FILE *, const char *);
/* Return malloc'ed string including trailing \n;
empty malloc'ed string for EOF;
NULL if interrupted */
/* Don't ever change this -- it would break the portability of Python code */ /* Don't ever change this -- it would break the portability of Python code */
#define TABSIZE 8 #define TABSIZE 8

View File

@ -96,21 +96,21 @@ error:
} }
static PyObject * static PyObject *
clear_memo_stats() clear_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
{ {
_PyPegen_clear_memo_statistics(); _PyPegen_clear_memo_statistics();
Py_RETURN_NONE; Py_RETURN_NONE;
} }
static PyObject * static PyObject *
get_memo_stats() get_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
{ {
return _PyPegen_get_memo_statistics(); return _PyPegen_get_memo_statistics();
} }
// TODO: Write to Python's sys.stdout instead of C's stdout. // TODO: Write to Python's sys.stdout instead of C's stdout.
static PyObject * static PyObject *
dump_memo_stats() dump_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
{ {
PyObject *list = _PyPegen_get_memo_statistics(); PyObject *list = _PyPegen_get_memo_statistics();
if (list == NULL) { if (list == NULL) {
@ -124,7 +124,7 @@ dump_memo_stats()
break; break;
} }
if (count > 0) { if (count > 0) {
printf("%4ld %9ld\n", i, count); printf("%4zd %9ld\n", i, count);
} }
} }
Py_DECREF(list); Py_DECREF(list);