kerncraft/kernel.py
def _build_dummy_calls(self):
        """
        Generate false if branch with dummy calls

        Requires kerncraft.h to be included, which defines dummy(...) and var_false.

        :return: dummy statement
        """
        # Make sure nothing gets removed by inserting dummy calls
        dummy_calls = []
        for d in self.kernel_ast.block_items:
            # Only consider toplevel declarations from kernel ast
            if type(d) is not c_ast.Decl: continue
            if type(d.type) is c_ast.ArrayDecl:
                dummy_calls.append(c_ast.FuncCall(
                    c_ast.ID('dummy'),
                    c_ast.ExprList([c_ast.ID(d.name)])))
            else:
                dummy_calls.append(c_ast.FuncCall(
                    c_ast.ID('dummy'),
                    c_ast.ExprList([c_ast.UnaryOp('&', c_ast.ID(d.name))])))
        dummy_stmt = c_ast.If(
            cond=c_ast.ID('var_false'),
            iftrue=c_ast.Compound(dummy_calls),
            iffalse=None)
        return dummy_stmt
def _build_dummy_calls(self):
        # Make sure nothing gets removed by inserting dummy calls
        dummy_calls = []
        for d in self.kernel_ast.block_items:
            # Only consider toplevel declarations from kernel ast
            if type(d) is not c_ast.Decl: continue
            if type(d.type) is c_ast.ArrayDecl:
                dummy_calls.append(c_ast.FuncCall(
                    c_ast.ID('dummy'),
                    c_ast.ExprList([c_ast.ID(d.name)])))
            else:
                dummy_calls.append(c_ast.FuncCall(
                    c_ast.ID('dummy'),
                    c_ast.ExprList([c_ast.UnaryOp('&', c_ast.ID(d.name))])))
        dummy_stmt = c_ast.If(
            cond=c_ast.ID('var_false'),
            iftrue=c_ast.Compound(dummy_calls),
            iffalse=None)
        return dummy_stmt
def _build_dummy_calls ( self ) : # Make sure nothing gets removed by inserting dummy calls dummy_calls = [ ] for d in self . kernel_ast . block_items : # Only consider toplevel declarations from kernel ast if type ( d ) is not c_ast . Decl : continue if type ( d . type ) is c_ast . ArrayDecl : dummy_calls . append ( c_ast . FuncCall ( c_ast . ID ( 'dummy' ) , c_ast . ExprList ( [ c_ast . ID ( d . name ) ] ) ) ) else : dummy_calls . append ( c_ast . FuncCall ( c_ast . ID ( 'dummy' ) , c_ast . ExprList ( [ c_ast . UnaryOp ( '&' , c_ast . ID ( d . name ) ) ] ) ) ) dummy_stmt = c_ast . If ( cond = c_ast . ID ( 'var_false' ) , iftrue = c_ast . Compound ( dummy_calls ) , iffalse = None ) return dummy_stmt
Generate false if branch with dummy calls

        Requires kerncraft.h to be included, which defines dummy(...) and var_false.

        :return: dummy statement
Generate false if branch with dummy calls