Commit b5037005 authored by Lisandro Dalcin's avatar Lisandro Dalcin

guard C code from inclusion of gecompanion h api code

parent f7d7598f
...@@ -112,12 +112,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -112,12 +112,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
i_code = Code.PyrexCodeWriter(result.i_file) i_code = Code.PyrexCodeWriter(result.i_file)
else: else:
i_code = None i_code = None
guard = Naming.h_guard_prefix + env.qualified_name.replace(".", "__")
h_code.put_h_guard(guard) h_guard = Naming.h_guard_prefix + self.api_name(env)
h_code.put_h_guard(h_guard)
self.generate_extern_c_macro_definition(h_code) self.generate_extern_c_macro_definition(h_code)
self.generate_type_header_code(h_types, h_code) self.generate_type_header_code(h_types, h_code)
h_code.putln("") h_code.putln("")
h_code.putln("#ifndef %s" % Naming.api_guard_prefix + self.api_name(env)) api_guard = Naming.api_guard_prefix + self.api_name(env)
h_code.putln("#ifndef %s" % api_guard)
if h_vars: if h_vars:
h_code.putln("") h_code.putln("")
for entry in h_vars: for entry in h_vars:
...@@ -685,6 +687,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -685,6 +687,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("#define _USE_MATH_DEFINES") code.putln("#define _USE_MATH_DEFINES")
code.putln("#endif") code.putln("#endif")
code.putln("#include <math.h>") code.putln("#include <math.h>")
code.putln("#define %s" % Naming.h_guard_prefix + self.api_name(env))
code.putln("#define %s" % Naming.api_guard_prefix + self.api_name(env)) code.putln("#define %s" % Naming.api_guard_prefix + self.api_name(env))
self.generate_includes(env, cimported_modules, code) self.generate_includes(env, cimported_modules, code)
code.putln("") code.putln("")
......
...@@ -19,3 +19,6 @@ cdef public void g(Blarg *x): ...@@ -19,3 +19,6 @@ cdef public void g(Blarg *x):
cdef public api void h(Zax *x): cdef public api void h(Zax *x):
pass pass
cdef extern from "a_capi.h":
pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment