Skip to content

Commit

Permalink
Fix the rest of the warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Aug 25, 2020
1 parent 0f29159 commit 239d673
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/bin/lfortran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ enum ASRPass {
do_loops, global_stmts
};


void section(const std::string &s)
{
std::cout << color(LFortran::style::bold) << color(LFortran::fg::blue) << s << color(LFortran::style::reset) << color(LFortran::fg::reset) << std::endl;
}

std::string remove_extension(const std::string& filename) {
size_t lastdot = filename.find_last_of(".");
if (lastdot == std::string::npos) return filename;
Expand Down Expand Up @@ -78,6 +72,12 @@ std::string get_kokkos_dir()
}

#ifdef HAVE_LFORTRAN_LLVM

void section(const std::string &s)
{
std::cout << color(LFortran::style::bold) << color(LFortran::fg::blue) << s << color(LFortran::style::reset) << color(LFortran::fg::reset) << std::endl;
}

int prompt(bool verbose)
{
std::cout << "Interactive Fortran. Experimental prototype, not ready for end users." << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions src/lfortran/pass/global_stmts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ void pass_wrap_global_stmts_into_function(Allocator &al,

ASR::ttype_t *type;
Location loc;
ASR::asr_t *return_var;
ASR::expr_t *return_var_ref;
ASR::asr_t *return_var=nullptr;
ASR::expr_t *return_var_ref=nullptr;
char *var_name;
int idx = 1;

Expand Down
7 changes: 7 additions & 0 deletions src/lfortran/semantics/ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ class BodyVisitor : public AST::BaseVisitor<BodyVisitor>
case (AST::Pow) :
op = ASR::Pow;
break;
// Fix compiler warning:
default : { LFORTRAN_ASSERT(false); op = ASR::operatorType::Pow; }
}
// Cast LHS or RHS if necessary
ASR::ttype_t *left_type = expr_type(left);
Expand Down Expand Up @@ -552,6 +554,9 @@ class BodyVisitor : public AST::BaseVisitor<BodyVisitor>
throw SemanticError("BinOp: Only Integer or Real can be on the RHS with Integer as LHS",
x.base.base.loc);
}
} else {
LFORTRAN_ASSERT(false);
type = nullptr;
}
LFORTRAN_ASSERT(expr_type(left)->type == expr_type(right)->type);
tmp = ASR::make_BinOp_t(al, x.base.base.loc,
Expand All @@ -575,6 +580,8 @@ class BodyVisitor : public AST::BaseVisitor<BodyVisitor>
case (AST::unaryopType::USub) :
op = ASR::unaryopType::USub;
break;
// Fix compiler warning:
default : { LFORTRAN_ASSERT(false); op = ASR::unaryopType::Invert; }
}
ASR::ttype_t *operand_type = expr_type(operand);
tmp = ASR::make_UnaryOp_t(al, x.base.base.loc,
Expand Down
6 changes: 3 additions & 3 deletions src/lfortran/stacktrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ struct match_data {
lib and the local address in the file.
*/
int shared_lib_callback(struct dl_phdr_info *info,
size_t size, void *_data)
size_t /* size */, void *_data)
{
struct match_data *data = (struct match_data *)_data;
for (int i=0; i < info->dlpi_phnum; i++) {
Expand Down Expand Up @@ -416,15 +416,15 @@ std::string stacktrace2str(const StacktraceAddresses &stacktrace_addresses)
}


void loc_segfault_callback_print_stack(int sig_num)
void loc_segfault_callback_print_stack(int /* sig_num */)
{
std::cerr << LFortran::get_stacktrace(1);
std::cerr << "Segfault: Signal SIGSEGV (segmentation fault) received\n";
exit(1);
}


void loc_abort_callback_print_stack(int sig_num)
void loc_abort_callback_print_stack(int /* sig_num */)
{
std::cerr << LFortran::get_stacktrace(1);
std::cerr << "Abort: Signal SIGABRT (abort) received\n\n";
Expand Down

0 comments on commit 239d673

Please sign in to comment.