Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
b7a4e7ab
Commit
b7a4e7ab
authored
Oct 28, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trac #80, error on unimplemented pxd cdef functions
parent
b52aa7db
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
7 deletions
+22
-7
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+4
-4
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+2
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+16
-2
No files found.
Cython/Compiler/Main.py
View file @
b7a4e7ab
...
@@ -84,13 +84,13 @@ class Context:
...
@@ -84,13 +84,13 @@ class Context:
from
AutoDocTransforms
import
EmbedSignature
from
AutoDocTransforms
import
EmbedSignature
from
Optimize
import
FlattenInListTransform
,
SwitchTransform
,
FinalOptimizePhase
from
Optimize
import
FlattenInListTransform
,
SwitchTransform
,
FinalOptimizePhase
from
Buffer
import
IntroduceBufferAuxiliaryVars
from
Buffer
import
IntroduceBufferAuxiliaryVars
from
ModuleNode
import
check_c_
classe
s
from
ModuleNode
import
check_c_
declaration
s
if
pxd
:
if
pxd
:
_check_c_
classe
s
=
None
_check_c_
declaration
s
=
None
_specific_post_parse
=
PxdPostParse
(
self
)
_specific_post_parse
=
PxdPostParse
(
self
)
else
:
else
:
_check_c_
classes
=
check_c_classe
s
_check_c_
declarations
=
check_c_declaration
s
_specific_post_parse
=
None
_specific_post_parse
=
None
if
py
and
not
pxd
:
if
py
and
not
pxd
:
...
@@ -111,7 +111,7 @@ class Context:
...
@@ -111,7 +111,7 @@ class Context:
EmbedSignature
(
self
),
EmbedSignature
(
self
),
TransformBuiltinMethods
(
self
),
TransformBuiltinMethods
(
self
),
IntroduceBufferAuxiliaryVars
(
self
),
IntroduceBufferAuxiliaryVars
(
self
),
_check_c_
classe
s
,
_check_c_
declaration
s
,
AnalyseExpressionsTransform
(
self
),
AnalyseExpressionsTransform
(
self
),
SwitchTransform
(),
SwitchTransform
(),
FinalOptimizePhase
(
self
),
FinalOptimizePhase
(
self
),
...
...
Cython/Compiler/ModuleNode.py
View file @
b7a4e7ab
...
@@ -26,8 +26,9 @@ from Cython.Utils import open_new_file, replace_suffix, UtilityCode
...
@@ -26,8 +26,9 @@ from Cython.Utils import open_new_file, replace_suffix, UtilityCode
from
StringEncoding
import
escape_byte_string
,
EncodedString
from
StringEncoding
import
escape_byte_string
,
EncodedString
def
check_c_
classe
s
(
module_node
):
def
check_c_
declaration
s
(
module_node
):
module_node
.
scope
.
check_c_classes
()
module_node
.
scope
.
check_c_classes
()
module_node
.
scope
.
check_c_functions
()
return
module_node
return
module_node
class
ModuleNode
(
Nodes
.
Node
,
Nodes
.
BlockNode
):
class
ModuleNode
(
Nodes
.
Node
,
Nodes
.
BlockNode
):
...
...
Cython/Compiler/Symtab.py
View file @
b7a4e7ab
...
@@ -135,6 +135,7 @@ class Entry:
...
@@ -135,6 +135,7 @@ class Entry:
used = 0
used = 0
is_special = 0
is_special = 0
defined_in_pxd = 0
defined_in_pxd = 0
is_implemented = 0
api = 0
api = 0
utility_code = None
utility_code = None
is_overridable = 0
is_overridable = 0
...
@@ -445,6 +446,8 @@ class Scope:
...
@@ -445,6 +446,8 @@ class Scope:
entry.api = 1
entry.api = 1
if not defining and not in_pxd and visibility != 'extern':
if not defining and not in_pxd and visibility != 'extern':
error(pos, "
Non
-
extern
C
function
'%s'
declared
but
not
defined
" % name)
error(pos, "
Non
-
extern
C
function
'%s'
declared
but
not
defined
" % name)
if defining:
entry.is_implemented = True
return entry
return entry
def add_cfunction(self, name, type, pos, cname, visibility):
def add_cfunction(self, name, type, pos, cname, visibility):
...
@@ -1093,8 +1096,8 @@ class ModuleScope(Scope):
...
@@ -1093,8 +1096,8 @@ class ModuleScope(Scope):
for entry in self.c_class_entries:
for entry in self.c_class_entries:
if debug_check_c_classes:
if debug_check_c_classes:
print("...entry %s %s" % (entry.name, entry))
print("...entry %s %s" % (entry.name, entry))
print("......type = "
+
entry.type)
print("......type = "
,
entry.type)
print("......visibility = "
+
entry.visibility)
print("......visibility = "
,
entry.visibility)
type = entry.type
type = entry.type
name = entry.name
name = entry.name
visibility = entry.visibility
visibility = entry.visibility
...
@@ -1117,6 +1120,17 @@ class ModuleScope(Scope):
...
@@ -1117,6 +1120,17 @@ class ModuleScope(Scope):
#print "ModuleScope.check_c_classes: allocating vtable cname for", self ###
#print "ModuleScope.check_c_classes: allocating vtable cname for", self ###
type.vtable_cname = self.mangle(Naming.vtable_prefix, entry.name)
type.vtable_cname = self.mangle(Naming.vtable_prefix, entry.name)
def check_c_functions(self):
# Performs post-analysis checking making sure all
# defined c functions are actually implemented.
for name, entry in self.entries.items():
if entry.is_cfunction:
if (entry.defined_in_pxd
and entry.visibility != '
extern
'
and not entry.in_cinclude
and not entry.is_implemented):
error(entry.pos, "Non-extern C function '
%
s
' declared but not defined" % name)
def attach_var_entry_to_c_class(self, entry):
def attach_var_entry_to_c_class(self, entry):
# The name of an extension class has to serve as both a type
# The name of an extension class has to serve as both a type
# name and a variable name holding the type object. It is
# name and a variable name holding the type object. It is
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment