]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43693: Silence some compiler warnings. (gh-26588)
authorEric Snow <ericsnowcurrently@gmail.com>
Mon, 7 Jun 2021 23:58:38 +0000 (17:58 -0600)
committerGitHub <noreply@github.com>
Mon, 7 Jun 2021 23:58:38 +0000 (17:58 -0600)
The plan is to eventually make PyCodeObject opaque in the public C-API, with the full struct moved to Include/internal/pycore_code.h. _PyLocalsPlusKinds and _PyLocalsPlusKind started off there but were needed on PyCodeObject, hence the duplication. This led to warnings with some compilers. (Apparently it does not trigger a warning on my install of GCC.)

This change eliminates the superfluous typedef.

https://bugs.python.org/issue43693

Include/cpython/code.h
Include/internal/pycore_code.h

index a3383744546ff0f16f99f9aad6fe1a057a3ac304..a3db7d9d5eff7a567fd3ced52684f346e44344d0 100644 (file)
@@ -26,7 +26,6 @@ typedef uint16_t _Py_CODEUNIT;
 typedef struct _PyOpcache _PyOpcache;
 
 
-// These are duplicated from pycore_code.h.
 typedef unsigned char _PyLocalsPlusKind;
 typedef _PyLocalsPlusKind *_PyLocalsPlusKinds;
 
index d1ff597bf54610671d62696c45b47441098a5749..2709e082b05b172506909d43b75a416a418fad24 100644 (file)
@@ -167,8 +167,8 @@ extern Py_ssize_t _Py_QuickenedCount;
  * "free" kind is mutually exclusive with both.
  */
 
-// We would use an enum if C let us specify the storage type.
-typedef unsigned char _PyLocalsPlusKind;
+// For now _PyLocalsPlusKind and _PyLocalsPlusKinds are defined
+// in Include/cpython/code.h.
 /* Note that these all fit within _PyLocalsPlusKind, as do combinations. */
 // Later, we will use the smaller numbers to differentiate the different
 // kinds of locals (e.g. pos-only arg, varkwargs, local-only).
@@ -176,8 +176,6 @@ typedef unsigned char _PyLocalsPlusKind;
 #define CO_FAST_CELL    0x40
 #define CO_FAST_FREE    0x80
 
-typedef _PyLocalsPlusKind *_PyLocalsPlusKinds;
-
 static inline int
 _PyCode_InitLocalsPlusKinds(int num, _PyLocalsPlusKinds *pkinds)
 {