diff --git a/tools/binpac/src/pac_array.cc b/tools/binpac/src/pac_array.cc index d37a6c1a4d..82e4f8c6fb 100644 --- a/tools/binpac/src/pac_array.cc +++ b/tools/binpac/src/pac_array.cc @@ -356,7 +356,7 @@ void ArrayType::GenInitCode(Output* out_cc, Env* env) { // Do not initiate the array here // out_cc->println("%s = new %s;", lvalue(), vector_str_.c_str()); - out_cc->println("%s = 0;", lvalue()); + out_cc->println("%s = nullptr;", lvalue()); Type::GenInitCode(out_cc, env); if ( incremental_parsing() ) @@ -563,7 +563,7 @@ void ArrayType::DoGenParseCode(Output* out_cc, Env* env, const DataPtr& data, in GenUntilCheck(out_cc, env, attr_until_element_expr_, false); if ( elemtype_->IsPointerType() ) - out_cc->println("%s = 0;", env->LValue(elem_var())); + out_cc->println("%s = nullptr;", env->LValue(elem_var())); out_cc->println("}"); out_cc->dec_indent(); @@ -621,7 +621,7 @@ void ArrayType::GenUntilCheck(Output* out_cc, Env* env, Expr* until_expr, bool d if ( delete_elem ) elemtype_->GenCleanUpCode(out_cc, env); else - out_cc->println("%s = 0;", env->LValue(elem_var())); + out_cc->println("%s = nullptr;", env->LValue(elem_var())); } out_cc->println("goto %s;", end_of_array_loop_label_.c_str()); diff --git a/tools/binpac/src/pac_exttype.cc b/tools/binpac/src/pac_exttype.cc index c048acc7a6..32f896e994 100644 --- a/tools/binpac/src/pac_exttype.cc +++ b/tools/binpac/src/pac_exttype.cc @@ -42,8 +42,11 @@ string ExternType::EvalMember(const ID* member_id) const void ExternType::GenInitCode(Output* out_cc, Env* env) { - if ( IsNumericType() || IsPointerType() ) + if ( IsNumericType() ) out_cc->println("%s = 0;", env->LValue(value_var())); + else if ( IsPointerType() ) + out_cc->println("%s = nullptr;", env->LValue(value_var())); + Type::GenInitCode(out_cc, env); } diff --git a/tools/binpac/src/pac_flow.cc b/tools/binpac/src/pac_flow.cc index ddf6029b01..75a42c92fd 100644 --- a/tools/binpac/src/pac_flow.cc +++ b/tools/binpac/src/pac_flow.cc @@ -113,8 +113,8 @@ void FlowDecl::GenInitCode(Output* out_cc) { AnalyzerDecl::GenInitCode(out_cc); - out_cc->println("%s = 0;", env_->LValue(dataunit_id)); - out_cc->println("%s = 0;", env_->LValue(analyzer_context_id)); + out_cc->println("%s = nullptr;", env_->LValue(dataunit_id)); + out_cc->println("%s = nullptr;", env_->LValue(analyzer_context_id)); if ( dataunit_->type() == AnalyzerDataUnit::FLOWUNIT ) { @@ -147,7 +147,7 @@ void FlowDecl::GenEOFFunc(Output* out_h, Output* out_cc) if ( dataunit_->type() == AnalyzerDataUnit::FLOWUNIT ) { out_cc->println("%s->set_eof();", env_->LValue(flow_buffer_id)); - out_cc->println("%s(0, 0);", kNewData); + out_cc->println("%s(nullptr, nullptr);", kNewData); } out_cc->println("}"); diff --git a/tools/binpac/src/pac_paramtype.cc b/tools/binpac/src/pac_paramtype.cc index 7fe61fe128..b9d2175b65 100644 --- a/tools/binpac/src/pac_paramtype.cc +++ b/tools/binpac/src/pac_paramtype.cc @@ -154,7 +154,7 @@ bool ParameterizedType::RequiresAnalyzerContext() void ParameterizedType::GenInitCode(Output* out_cc, Env* env) { ASSERT(persistent()); - out_cc->println("%s = 0;", env->LValue(value_var())); + out_cc->println("%s = nullptr;", env->LValue(value_var())); Type::GenInitCode(out_cc, env); } @@ -165,7 +165,7 @@ void ParameterizedType::GenCleanUpCode(Output* out_cc, Env* env) out_cc->println("Unref(%s);", lvalue()); else out_cc->println("delete %s;", lvalue()); - out_cc->println("%s = 0;", lvalue()); + out_cc->println("%s = nullptr;", lvalue()); Type::GenCleanUpCode(out_cc, env); } @@ -206,7 +206,7 @@ void ParameterizedType::DoGenParseCode(Output* out_cc, Env* env, const DataPtr& { ASSERT(! ref_type->incremental_input()); parse_func = kParseFuncWithoutBuffer; - parse_params = "0, 0"; + parse_params = "nullptr, nullptr"; } else if ( ref_type->incremental_input() ) {