summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ModuleNode.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2015-08-22 18:56:09 +0200
committerStefan Behnel <stefan_ml@behnel.de>2015-08-22 18:56:09 +0200
commit3c84aafe912d6fd968f19c86e0b71d73ea10551e (patch)
tree9245c4c3f29b2310977322e8d4eae9e2c6e8a2c5 /Cython/Compiler/ModuleNode.py
parentbe7033c5714b77eb826e5a4b934ecfb012640879 (diff)
downloadcython-3c84aafe912d6fd968f19c86e0b71d73ea10551e.tar.gz
simplify option passing in CCodeWriter by moving them into a common CCodeConfig object
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r--Cython/Compiler/ModuleNode.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 0fdfbf130..53255bf75 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -139,7 +139,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if (h_types or h_vars or h_funcs or h_extension_types):
result.h_file = replace_suffix(result.c_file, ".h")
h_code = Code.CCodeWriter()
- Code.GlobalState(h_code, self)
+ Code.GlobalState(h_code, self, Code.CCodeConfig()) # FIXME: config?
if options.generate_pxi:
result.i_file = replace_suffix(result.c_file, ".pxi")
i_code = Code.PyrexCodeWriter(result.i_file)
@@ -213,7 +213,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if api_vars or api_funcs or api_extension_types:
result.api_file = replace_suffix(result.c_file, "_api.h")
h_code = Code.CCodeWriter()
- Code.GlobalState(h_code, self)
+ Code.GlobalState(h_code, self, Code.CCodeConfig()) # FIXME: config?
h_code.put_generated_by()
api_guard = Naming.api_guard_prefix + self.api_name(env)
h_code.put_h_guard(api_guard)
@@ -312,8 +312,18 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
rootwriter = Annotate.AnnotationCCodeWriter()
else:
emit_linenums = options.emit_linenums
- rootwriter = Code.CCodeWriter(emit_linenums=emit_linenums, c_line_in_traceback=options.c_line_in_traceback)
- globalstate = Code.GlobalState(rootwriter, self, emit_linenums, options.common_utility_include_dir)
+ rootwriter = Code.CCodeWriter()
+
+ c_code_config = Code.CCodeConfig(
+ emit_linenums=emit_linenums,
+ emit_code_comments=env.directives['emit_code_comments'],
+ c_line_in_traceback=options.c_line_in_traceback,
+ )
+ globalstate = Code.GlobalState(
+ rootwriter, self,
+ code_config=c_code_config,
+ common_utility_include_dir=options.common_utility_include_dir,
+ )
globalstate.initialize_main_c_code()
h_code = globalstate['h_code']