From fd3b9bbaf3a8e4c83dd18a4ce099607b38d66933 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 4 May 2023 08:51:47 +0200 Subject: Remove the useless check that the struct field visibility is the same as the struct's visibility. This is assured by syntax. See https://github.com/cython/cython/pull/5386 --- Cython/Compiler/Nodes.py | 2 +- Cython/Compiler/Symtab.py | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 8667e5c74..877e7b928 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1557,7 +1557,7 @@ class CStructOrUnionDefNode(StatNode): def analyse_declarations(self, env): scope = None if self.attributes is not None: - scope = StructOrUnionScope(self.name, self.visibility) + scope = StructOrUnionScope(self.name) self.declare(env, scope) if self.attributes is not None: if self.in_pxd and not env.in_cinclude: diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 5ca22ca86..608d68c22 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -2094,11 +2094,9 @@ class GeneratorExpressionScope(ClosureScope): class StructOrUnionScope(Scope): # Namespace of a C struct or union. - # visibility string Visibility of a C struct or union - def __init__(self, name="?", visibility='private'): - Scope.__init__(self, name, None, None) - self.visibility = visibility + def __init__(self, name="?"): + Scope.__init__(self, name, outer_scope=None, parent_scope=None) def declare_var(self, name, type, pos, cname=None, visibility='private', @@ -2125,8 +2123,6 @@ class StructOrUnionScope(Scope): elif type.needs_refcounting: if not allow_refcounted: error(pos, "C struct/union member cannot be reference-counted type '%s'" % type) - if visibility != self.visibility: - error(pos, "C struct/union visibility %s does not match the member visibility %s" % (self.visibility, visibility)) return entry def declare_cfunction(self, name, type, pos, -- cgit v1.2.1