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
Boxiang Sun
cython
Commits
7b9b3153
Commit
7b9b3153
authored
Oct 16, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change command-line directive behaviour for 0.12
parent
422a77f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
19 deletions
+12
-19
Cython/Compiler/CmdLine.py
Cython/Compiler/CmdLine.py
+3
-7
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+9
-12
No files found.
Cython/Compiler/CmdLine.py
View file @
7b9b3153
...
...
@@ -39,12 +39,12 @@ Options:
--line-directives Produce #line directives pointing to the .pyx source
--cplus Output a c++ rather than c file.
--embed Embed the Python interpreter in a main() method.
--directive <name>=<value>[,<name=value,...] Overrides a compiler directive
-
X, -
-directive <name>=<value>[,<name=value,...] Overrides a compiler directive
"""
#The following experimental options are supported only on MacOSX:
# -C, --compile Compile generated .c file to .o file
# -
X, --link
Link .o file to produce extension module (implies -C)
# -
-link
Link .o file to produce extension module (implies -C)
# -+, --cplus Use C++ compiler for compiling and linking
# Additional .o files to link may be supplied when using -X."""
...
...
@@ -81,11 +81,7 @@ def parse_command_line(args):
options
.
use_listing_file
=
1
elif
option
in
(
"-C"
,
"--compile"
):
options
.
c_only
=
0
elif
option
in
(
"-X"
,
"--link"
):
if
option
==
"-X"
:
print
>>
sys
.
stderr
,
"Deprecation warning: The -X command line switch will be changed to a"
print
>>
sys
.
stderr
,
"shorthand for --directive in Cython 0.12. Please use --link instead."
print
>>
sys
.
stderr
elif
option
in
(
"--link"
):
options
.
c_only
=
0
options
.
obj_only
=
0
elif
option
in
(
"-+"
,
"--cplus"
):
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
7b9b3153
...
...
@@ -330,11 +330,11 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
"""
special_methods
=
set
([
'declare'
,
'union'
,
'struct'
,
'typedef'
,
'sizeof'
,
'typeof'
,
'cast'
,
'address'
,
'pointer'
,
'compiled'
,
'NULL'
])
def
__init__
(
self
,
context
,
compilation_directive_
override
s
):
def
__init__
(
self
,
context
,
compilation_directive_
default
s
):
super
(
InterpretCompilerDirectives
,
self
).
__init__
(
context
)
self
.
compilation_directive_
override
s
=
{}
for
key
,
value
in
compilation_directive_
override
s
.
iteritems
():
self
.
compilation_directive_
override
s
[
unicode
(
key
)]
=
value
self
.
compilation_directive_
default
s
=
{}
for
key
,
value
in
compilation_directive_
default
s
.
iteritems
():
self
.
compilation_directive_
default
s
[
unicode
(
key
)]
=
value
self
.
cython_module_names
=
set
()
self
.
directive_names
=
{}
...
...
@@ -349,17 +349,14 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
# Set up processing and handle the cython: comments.
def
visit_ModuleNode
(
self
,
node
):
directives
=
copy
.
copy
(
Options
.
directive_defaults
)
for
key
,
value
in
self
.
compilation_directive_overrides
.
iteritems
():
for
key
,
value
in
node
.
directive_comments
.
iteritems
():
if
not
self
.
check_directive_scope
(
node
.
pos
,
key
,
'module'
):
self
.
wrong_scope_error
(
node
.
pos
,
key
,
'module'
)
del
self
.
compilation_directive_overrides
[
key
]
continue
if
key
in
node
.
directive_comments
and
node
.
directive_comments
[
key
]
!=
value
:
warning
(
node
.
pos
,
"Compiler directive differs between environment and file header; this will change "
"in Cython 0.12. See http://article.gmane.org/gmane.comp.python.cython.devel/5233"
,
2
)
del
node
.
directive_comments
[
key
]
directives
=
copy
.
copy
(
Options
.
directive_defaults
)
directives
.
update
(
self
.
compilation_directive_defaults
)
directives
.
update
(
node
.
directive_comments
)
directives
.
update
(
self
.
compilation_directive_overrides
)
self
.
directives
=
directives
node
.
directives
=
directives
self
.
visitchildren
(
node
)
...
...
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