Skip to content

Commit 43b4a72

Browse files
committed
Fix warnings in release build
1 parent 74a65be commit 43b4a72

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/lpython/parser/parser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Result<LPython::AST::ast_t*> parse_python_file(Allocator &al,
117117
const std::string &infile,
118118
diag::Diagnostics &diagnostics,
119119
uint32_t prev_loc,
120-
bool new_parser) {
120+
[[maybe_unused]] bool new_parser) {
121121
LPython::AST::ast_t* ast;
122122
// We will be using the new parser from now on
123123
new_parser = true;

src/lpython/semantics/python_ast_to_asr.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
10091009

10101010
ASR::ttype_t* get_type_from_var_annotation(std::string var_annotation,
10111011
const Location& loc, Vec<ASR::dimension_t>& dims,
1012-
AST::expr_t** m_args=nullptr, size_t n_args=0,
1012+
AST::expr_t** m_args=nullptr, [[maybe_unused]] size_t n_args=0,
10131013
bool raise_error=true, ASR::abiType abi=ASR::abiType::Source,
10141014
bool is_argument=false) {
10151015
ASR::ttype_t* type = nullptr;
@@ -2416,7 +2416,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
24162416
result = left_value >> right_value;
24172417
break;
24182418
}
2419-
default: { LCOMPILERS_ASSERT(false); } // should never happen
2419+
default: { throw SemanticError("ICE: Unknown binary operator", loc); } // should never happen
24202420
}
24212421
value = ASR::down_cast<ASR::expr_t>(ASR::make_UnsignedIntegerConstant_t(
24222422
al, loc, result, dest_type));
@@ -2458,7 +2458,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
24582458
case (ASR::binopType::Mul): { result = left_value * right_value; break; }
24592459
case (ASR::binopType::Div): { result = left_value / right_value; break; }
24602460
case (ASR::binopType::Pow): { result = std::pow(left_value, right_value); break; }
2461-
default: { LCOMPILERS_ASSERT(false); }
2461+
default: { throw SemanticError("ICE: Unknown binary operator", loc); }
24622462
}
24632463
value = ASR::down_cast<ASR::expr_t>(ASR::make_RealConstant_t(
24642464
al, loc, result, dest_type));
@@ -3289,7 +3289,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
32893289
void visit_NamedExpr(const AST::NamedExpr_t &x) {
32903290
this->visit_expr(*x.m_target);
32913291
ASR::expr_t *target = ASRUtils::EXPR(tmp);
3292-
ASR::ttype_t *target_type = ASRUtils::expr_type(target);
3292+
[[maybe_unused]] ASR::ttype_t *target_type = ASRUtils::expr_type(target);
32933293
this->visit_expr(*x.m_value);
32943294
ASR::expr_t *value = ASRUtils::EXPR(tmp);
32953295
ASR::ttype_t *value_type = ASRUtils::expr_type(value);

0 commit comments

Comments
 (0)