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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
e94bf900
Commit
e94bf900
authored
Jun 06, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
separate trace declarations from initialisation to fix "declaration after code" C compiler error
parent
96aafb08
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
10 deletions
+18
-10
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+5
-2
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+2
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+5
-4
Cython/Utility/Profile.c
Cython/Utility/Profile.c
+6
-3
No files found.
Cython/Compiler/Code.py
View file @
e94bf900
...
...
@@ -2202,8 +2202,11 @@ class CCodeWriter(object):
self
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"WriteUnraisableException"
,
"Exceptions.c"
))
def
put_trace_declarations
(
self
,
codeobj
=
None
,
nogil
=
False
):
self
.
putln
(
'__Pyx_TraceDeclarations(%s, %d)'
%
(
codeobj
or
'NULL'
,
nogil
))
def
put_trace_declarations
(
self
):
self
.
putln
(
'__Pyx_TraceDeclarations'
)
def
put_trace_frame_init
(
self
,
codeobj
=
None
):
self
.
putln
(
'__Pyx_TraceFrameInit(%s)'
%
(
codeobj
or
'NULL'
))
def
put_trace_call
(
self
,
name
,
pos
,
nogil
=
False
):
self
.
putln
(
'__Pyx_TraceCall("%s", %s[%s], %s, %d, %s);'
%
(
...
...
Cython/Compiler/ModuleNode.py
View file @
e94bf900
...
...
@@ -2053,7 +2053,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
put_declare_refcount_context
()
if
profile
or
linetrace
:
tempdecl_code
.
put_trace_declarations
(
None
)
tempdecl_code
.
put_trace_declarations
()
code
.
put_trace_frame_init
()
code
.
putln
(
"#if CYTHON_REFNANNY"
)
code
.
putln
(
"__Pyx_RefNanny = __Pyx_RefNannyImportAPI(
\
"
refnanny
\
"
);"
)
...
...
Cython/Compiler/Nodes.py
View file @
e94bf900
...
...
@@ -1763,10 +1763,6 @@ class FuncDefNode(StatNode, BlockNode):
tempvardecl_code
=
code
.
insertion_point
()
self
.
generate_keyword_list
(
code
)
if
profile
or
linetrace
:
code_object
=
self
.
code_object
.
calculate_result_code
(
code
)
if
self
.
code_object
else
None
code
.
put_trace_declarations
(
code_object
,
nogil
=
not
code
.
funcstate
.
gil_owned
)
# ----- Extern library function declarations
lenv
.
generate_library_function_declarations
(
code
)
...
...
@@ -1800,6 +1796,11 @@ class FuncDefNode(StatNode, BlockNode):
elif
lenv
.
nogil
and
lenv
.
has_with_gil_block
:
code
.
declare_gilstate
()
if
profile
or
linetrace
:
tempvardecl_code
.
put_trace_declarations
()
code_object
=
self
.
code_object
.
calculate_result_code
(
code
)
if
self
.
code_object
else
None
code
.
put_trace_frame_init
(
code_object
)
# ----- set up refnanny
if
use_refnanny
:
tempvardecl_code
.
put_declare_refcount_context
()
...
...
Cython/Utility/Profile.c
View file @
e94bf900
...
...
@@ -42,10 +42,12 @@
#define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
#endif
#define __Pyx_TraceDeclarations
(codeobj, nogil)
\
#define __Pyx_TraceDeclarations
\
static PyCodeObject *$frame_code_cname = NULL; \
CYTHON_FRAME_MODIFIER PyFrameObject *$frame_cname = NULL; \
int __Pyx_use_tracing = 0; \
int __Pyx_use_tracing = 0;
#define __Pyx_TraceFrameInit(codeobj) \
if (codeobj) $frame_code_cname = (PyCodeObject*) codeobj;
#ifdef WITH_THREAD
...
...
@@ -152,7 +154,8 @@
#else
#define __Pyx_TraceDeclarations(codeobj, nogil)
#define __Pyx_TraceDeclarations
#define __Pyx_TraceFrameInit(codeobj)
// mark error label as used to avoid compiler warnings
#define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) if (1); else goto_error;
#define __Pyx_TraceException()
...
...
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