diff --git a/Cargo.toml b/Cargo.toml index e5d19f0dd2c5e3db8d304dc979408f8f9c2fba95..258a30287cfdafbbc1e850669b231fda1cbb8fe4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ lazy_static = "1.4.0" crate-type = ["cdylib"] [features] -default = ["ffi", "session_optimization", "ffi_pseudo_socket_api"] +default = ["ffi", "session_optimization"] ffi = [] # see src/ffi/mod.rs ffi_pseudo_socket_api = ["ffi", "libc", "os_socketaddr"]# see src/ffi/pseudo_socket_api.rs endpoint_logging = [] # see src/macros.rs diff --git a/reowolf.h b/reowolf.h index c40c2585c23b94293a65fad9442bf4876e5ed53a..a889f774ede6e40b1b87fffcdf0276e5cea897f0 100644 --- a/reowolf.h +++ b/reowolf.h @@ -47,9 +47,7 @@ typedef uint32_t U32Suffix; typedef struct { ConnectorId connector_id; U32Suffix u32_suffix; -} Id; - -typedef Id PortId; +} PortId; typedef struct { uint8_t ipv4[4]; diff --git a/src/protocol/ast.rs b/src/protocol/ast.rs index 560ffe71caf14fc10a9c50fbb723d3b565fb0f25..6df72ed25770718b6ba4d0726a6d91f057bad956 100644 --- a/src/protocol/ast.rs +++ b/src/protocol/ast.rs @@ -2099,27 +2099,27 @@ impl Statement { } pub fn link_next(&mut self, next: StatementId) { match self { - Statement::Block(stmt) => panic!(), + Statement::Block(_) => todo!(), Statement::Local(stmt) => match stmt { LocalStatement::Channel(stmt) => stmt.next = Some(next), LocalStatement::Memory(stmt) => stmt.next = Some(next), }, Statement::Skip(stmt) => stmt.next = Some(next), - Statement::Labeled(stmt) => panic!(), - Statement::If(stmt) => panic!(), Statement::EndIf(stmt) => stmt.next = Some(next), - Statement::While(stmt) => panic!(), // although while has a next field, it is linked manually Statement::EndWhile(stmt) => stmt.next = Some(next), - Statement::Break(stmt) => panic!(), - Statement::Continue(stmt) => panic!(), - Statement::Synchronous(stmt) => panic!(), Statement::EndSynchronous(stmt) => stmt.next = Some(next), - Statement::Return(stmt) => panic!(), Statement::Assert(stmt) => stmt.next = Some(next), - Statement::Goto(stmt) => panic!(), Statement::New(stmt) => stmt.next = Some(next), Statement::Put(stmt) => stmt.next = Some(next), Statement::Expression(stmt) => stmt.next = Some(next), + Statement::Return(_) + | Statement::Break(_) + | Statement::Continue(_) + | Statement::Synchronous(_) + | Statement::Goto(_) + | Statement::While(_) + | Statement::Labeled(_) + | Statement::If(_) => unreachable!(), } } } diff --git a/src/protocol/eval.rs b/src/protocol/eval.rs index a7c48c03b853995812717b481c17f850ca2d9b5d..98ac5816ce85366414d4bd5075963fe5bd1b81eb 100644 --- a/src/protocol/eval.rs +++ b/src/protocol/eval.rs @@ -1558,7 +1558,7 @@ impl Store { Ok(value) } Expression::Indexing(expr) => self.get(h, ctx, expr.this.upcast()), - Expression::Slicing(expr) => unimplemented!(), + Expression::Slicing(_expr) => unimplemented!(), Expression::Select(expr) => self.get(h, ctx, expr.this.upcast()), Expression::Array(expr) => { let mut elements = Vec::new(); @@ -1590,7 +1590,7 @@ impl Store { Some(result) => Ok(result), } } - Method::Symbolic(symbol) => unimplemented!(), + Method::Symbolic(_symbol) => unimplemented!(), }, Expression::Variable(expr) => self.get(h, ctx, expr.this.upcast()), } @@ -1771,37 +1771,36 @@ impl Prompt { } Statement::Expression(stmt) => { // Evaluate expression - let value = self.store.eval(h, ctx, stmt.expression)?; + let _value = self.store.eval(h, ctx, stmt.expression)?; // Continue to next statement self.position = stmt.next; Err(EvalContinuation::Stepping) } } } - fn compute_function(_h: &Heap, _fun: FunctionId, _args: &Vec) -> Option { - todo!() - // let mut prompt = Self::new(h, fun.upcast(), args); - // let mut context = EvalContext::None; - // loop { - // let result = prompt.step(h, &mut context); - // match result { - // Ok(val) => return Some(val), - // Err(cont) => match cont { - // EvalContinuation::Stepping => continue, - // EvalContinuation::Inconsistent => return None, - // // Functions never terminate without returning - // EvalContinuation::Terminal => unreachable!(), - // // Functions never encounter any blocking behavior - // EvalContinuation::SyncBlockStart => unreachable!(), - // EvalContinuation::SyncBlockEnd => unreachable!(), - // EvalContinuation::NewComponent(_, _) => unreachable!(), - // EvalContinuation::BlockFires(val) => unreachable!(), - // EvalContinuation::BlockGet(val) => unreachable!(), - // EvalContinuation::Put(port, msg) => unreachable!(), - // }, - // } - // } - } + // fn compute_function(_h: &Heap, _fun: FunctionId, _args: &Vec) -> Option { + // let mut prompt = Self::new(h, fun.upcast(), args); + // let mut context = EvalContext::None; + // loop { + // let result = prompt.step(h, &mut context); + // match result { + // Ok(val) => return Some(val), + // Err(cont) => match cont { + // EvalContinuation::Stepping => continue, + // EvalContinuation::Inconsistent => return None, + // // Functions never terminate without returning + // EvalContinuation::Terminal => unreachable!(), + // // Functions never encounter any blocking behavior + // EvalContinuation::SyncBlockStart => unreachable!(), + // EvalContinuation::SyncBlockEnd => unreachable!(), + // EvalContinuation::NewComponent(_, _) => unreachable!(), + // EvalContinuation::BlockFires(val) => unreachable!(), + // EvalContinuation::BlockGet(val) => unreachable!(), + // EvalContinuation::Put(port, msg) => unreachable!(), + // }, + // } + // } + // } } // #[cfg(test)] diff --git a/src/protocol/parser.rs b/src/protocol/parser.rs index f8b5e1b5b17f47d05fffa08762dd912cf6ca5257..8f4fa8489d1bfbc65775d07ac695adfc49e6428c 100644 --- a/src/protocol/parser.rs +++ b/src/protocol/parser.rs @@ -294,19 +294,19 @@ fn recursive_statement(this: &mut T, h: &mut Heap, stmt: StatementId Statement::Skip(stmt) => this.visit_skip_statement(h, stmt.this), Statement::Labeled(stmt) => this.visit_labeled_statement(h, stmt.this), Statement::If(stmt) => this.visit_if_statement(h, stmt.this), - Statement::EndIf(stmt) => unreachable!(), // pseudo-statement Statement::While(stmt) => this.visit_while_statement(h, stmt.this), - Statement::EndWhile(stmt) => unreachable!(), // pseudo-statement Statement::Break(stmt) => this.visit_break_statement(h, stmt.this), Statement::Continue(stmt) => this.visit_continue_statement(h, stmt.this), Statement::Synchronous(stmt) => this.visit_synchronous_statement(h, stmt.this), - Statement::EndSynchronous(stmt) => unreachable!(), // pseudo-statement Statement::Return(stmt) => this.visit_return_statement(h, stmt.this), Statement::Assert(stmt) => this.visit_assert_statement(h, stmt.this), Statement::Goto(stmt) => this.visit_goto_statement(h, stmt.this), Statement::New(stmt) => this.visit_new_statement(h, stmt.this), Statement::Put(stmt) => this.visit_put_statement(h, stmt.this), Statement::Expression(stmt) => this.visit_expression_statement(h, stmt.this), + Statement::EndSynchronous(_) | Statement::EndWhile(_) | Statement::EndIf(_) => { + unreachable!() // pseudo-statement + } } } @@ -796,7 +796,7 @@ impl Visitor for BuildSymbolDeclarations { h[pd].declarations.append(&mut self.declarations); Ok(()) } - fn visit_import(&mut self, h: &mut Heap, import: ImportId) -> VisitorResult { + fn visit_import(&mut self, _h: &mut Heap, _import: ImportId) -> VisitorResult { todo!() // let vec = library::get_declarations(h, import)?; // // Destructively iterate over the vector @@ -926,7 +926,7 @@ impl Visitor for BuildScope { self.scope = old; Ok(()) } - fn visit_expression(&mut self, h: &mut Heap, expr: ExpressionId) -> VisitorResult { + fn visit_expression(&mut self, _h: &mut Heap, _expr: ExpressionId) -> VisitorResult { Ok(()) } } @@ -1007,7 +1007,7 @@ impl Visitor for ResolveVariables { recursive_memory_statement(self, h, stmt)?; // Finally, we may add the variable to the scope, which is guaranteed to be a block { - let mut block = &mut h[self.scope.unwrap().to_block()]; + let block = &mut h[self.scope.unwrap().to_block()]; block.locals.push(var); } Ok(()) @@ -1022,7 +1022,7 @@ impl Visitor for ResolveVariables { if check_duplicate.is_some() { return Err(ParseError::new(h[id].position, "Declared variable clash")); } - let mut block = &mut h[self.scope.unwrap().to_block()]; + let block = &mut h[self.scope.unwrap().to_block()]; block.locals.push(var); } // Then handle the to variable (which may not be the same as the from) @@ -1033,7 +1033,7 @@ impl Visitor for ResolveVariables { if check_duplicate.is_some() { return Err(ParseError::new(h[id].position, "Declared variable clash")); } - let mut block = &mut h[self.scope.unwrap().to_block()]; + let block = &mut h[self.scope.unwrap().to_block()]; block.locals.push(var); } Ok(()) @@ -1179,33 +1179,33 @@ impl Visitor for LinkStatements { self.prev = Some(UniqueStatementId(pseudo)); Ok(()) } - fn visit_return_statement(&mut self, h: &mut Heap, stmt: ReturnStatementId) -> VisitorResult { + fn visit_return_statement(&mut self, _h: &mut Heap, _stmt: ReturnStatementId) -> VisitorResult { Ok(()) } - fn visit_assert_statement(&mut self, h: &mut Heap, stmt: AssertStatementId) -> VisitorResult { + fn visit_assert_statement(&mut self, _h: &mut Heap, stmt: AssertStatementId) -> VisitorResult { self.prev = Some(UniqueStatementId(stmt.upcast())); Ok(()) } fn visit_goto_statement(&mut self, _h: &mut Heap, _stmt: GotoStatementId) -> VisitorResult { Ok(()) } - fn visit_new_statement(&mut self, h: &mut Heap, stmt: NewStatementId) -> VisitorResult { + fn visit_new_statement(&mut self, _h: &mut Heap, stmt: NewStatementId) -> VisitorResult { self.prev = Some(UniqueStatementId(stmt.upcast())); Ok(()) } - fn visit_put_statement(&mut self, h: &mut Heap, stmt: PutStatementId) -> VisitorResult { + fn visit_put_statement(&mut self, _h: &mut Heap, stmt: PutStatementId) -> VisitorResult { self.prev = Some(UniqueStatementId(stmt.upcast())); Ok(()) } fn visit_expression_statement( &mut self, - h: &mut Heap, + _h: &mut Heap, stmt: ExpressionStatementId, ) -> VisitorResult { self.prev = Some(UniqueStatementId(stmt.upcast())); Ok(()) } - fn visit_expression(&mut self, h: &mut Heap, expr: ExpressionId) -> VisitorResult { + fn visit_expression(&mut self, _h: &mut Heap, _expr: ExpressionId) -> VisitorResult { Ok(()) } } @@ -1253,7 +1253,7 @@ impl Visitor for BuildLabels { self.sync_enclosure = None; Ok(()) } - fn visit_expression(&mut self, h: &mut Heap, expr: ExpressionId) -> VisitorResult { + fn visit_expression(&mut self, _h: &mut Heap, _expr: ExpressionId) -> VisitorResult { Ok(()) } } @@ -1436,7 +1436,7 @@ impl Visitor for ResolveLabels { h[stmt].target = Some(target); Ok(()) } - fn visit_expression(&mut self, h: &mut Heap, expr: ExpressionId) -> VisitorResult { + fn visit_expression(&mut self, _h: &mut Heap, _expr: ExpressionId) -> VisitorResult { Ok(()) } } @@ -1564,8 +1564,8 @@ impl Visitor for AssignableExpressions { } fn visit_variable_expression( &mut self, - h: &mut Heap, - expr: VariableExpressionId, + _h: &mut Heap, + _expr: VariableExpressionId, ) -> VisitorResult { Ok(()) } diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs index 4ff25bc6eefbe4e62f889614e0892c06528cbde5..91b233b0363546af1d305a65d0f98362829e89a4 100644 --- a/src/runtime/mod.rs +++ b/src/runtime/mod.rs @@ -625,10 +625,6 @@ impl SpecVal { self == Self::FIRING // all else treated as SILENT } - fn nth_domain_element(n: usize) -> Self { - let n: u16 = n.try_into().unwrap(); - SpecVal(n) - } fn iter_domain() -> impl Iterator { (0..).map(SpecVal) }