Commit 04a00eaf authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 42881e62
......@@ -2479,28 +2479,32 @@ class CFuncDefNode(FuncDefNode):
arg_decls.append(type.op_arg_struct.declaration_code(Naming.optional_args_cname))
if type.has_varargs:
arg_decls.append("...")
if not arg_decls:
arg_decls = ["void"]
#if not arg_decls:
# arg_decls = ["void"]
if cname is None:
cname = self.entry.func_cname
entity = type.function_header_code(cname, ', '.join(arg_decls))
if self.entry.visibility == 'private' and '::' not in cname:
storage_class = "static "
else:
storage_class = ""
# TODO(go) exported/non-exported
#if self.entry.visibility == 'private' and '::' not in cname:
# storage_class = "static "
#else:
# storage_class = ""
storage_class = ""
dll_linkage = None
modifiers = code.build_function_modifiers(self.entry.func_modifiers)
header = self.return_type.declaration_code(entity, dll_linkage=dll_linkage)
#print (storage_class, modifiers, header)
needs_proto = self.is_c_class_method
if self.template_declaration:
if needs_proto:
code.globalstate.parts['module_declarations'].putln(self.template_declaration)
code.putln(self.template_declaration)
if needs_proto:
code.globalstate.parts['module_declarations'].putln(
"%s%s%s; /* proto*/" % (storage_class, modifiers, header))
#if self.template_declaration:
# if needs_proto:
# code.globalstate.parts['module_declarations'].putln(self.template_declaration)
# code.putln(self.template_declaration)
#if needs_proto:
# code.globalstate.parts['module_declarations'].putln(
# "%s%s%s; /* proto*/" % (storage_class, modifiers, header))
code.putln("%s%s%s {" % (storage_class, modifiers, header))
def generate_argument_declarations(self, env, code):
......@@ -6011,12 +6015,12 @@ class WhileStatNode(LoopNode, StatNode):
code.mark_pos(self.pos)
old_loop_labels = code.new_loop_labels()
code.putln(
"while (1) {")
"for {")
if self.condition:
self.condition.generate_evaluation_code(code)
self.condition.generate_disposal_code(code)
code.putln(
"if (!%s) break;" % self.condition.result())
"if !%s { break }" % self.condition.result())
self.condition.free_temps(code)
self.body.generate_execution_code(code)
code.put_label(code.continue_label)
......
......@@ -60,7 +60,8 @@ class BaseType(object):
def base_declaration_code(self, base_code, entity_code):
if entity_code:
return "%s %s" % (base_code, entity_code)
#return "%s %s" % (base_code, entity_code)
return "%s %s" % (entity_code, base_code)
else:
return base_code
......
......@@ -755,12 +755,12 @@ static PyObject *__pyx_n_s_test;
*/
/* -> CFuncDefNode.generate_function_header (1, 5) */
static int __pyx_f_3sum_sumupto(int __pyx_v_n) {
__pyx_f_3sum_sumupto(__pyx_v_n int) int {
/* <- CFuncDefNode.generate_function_header (1, 5) */
int __pyx_v_res;
int __pyx_r;
__pyx_v_res int;
__pyx_r int;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__pyx_t_1 int;
__Pyx_RefNannySetupContext("sumupto", 0);
/* -> StatListNode.generate_execution_code (2, 4) */
......@@ -784,13 +784,13 @@ static int __pyx_f_3sum_sumupto(int __pyx_v_n) {
* n -= 1
*/
/* -> WhileStatNode.generate_execution_code (4, 4) */
while (1) {
for {
/* -> CoerceToTempNode.generate_evaluation_code (4, 12) */
/* -> CoerceToTempNode.generate_result_code (4, 12) */
__pyx_t_1 = ((__pyx_v_n > 0) != 0);
/* <- CoerceToTempNode.generate_result_code (4, 12) */
/* <- CoerceToTempNode.generate_evaluation_code (4, 12) */
if (!__pyx_t_1) break;
if !__pyx_t_1 { break }
/* -> StatListNode.generate_execution_code (5, 8) */
/* "sum.pyx":5
......@@ -898,7 +898,7 @@ PyMODINIT_FUNC PyInit_sum(void); /*proto*/
PyMODINIT_FUNC PyInit_sum(void)
#endif
{
PyObject *__pyx_t_1 = NULL;
*__pyx_t_1 PyObject = NULL;
__Pyx_RefNannyDeclarations
#if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
......
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