X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Ftypes%2Fcpp_exp.c;h=bfff0d197d443a8a2a6c721b6bd4868b5524f1b3;hp=ded4db5b614ea86a548d3aa0a3f7dfb6f5f7154c;hb=a7ac1c0a3c855321f21682c127a4b707de33a303;hpb=47dd00ab6df0a093b13d4f573ba01c79a6bcc72f diff --git a/src/types/cpp_exp.c b/src/types/cpp_exp.c index ded4db5..bfff0d1 100644 --- a/src/types/cpp_exp.c +++ b/src/types/cpp_exp.c @@ -32,7 +32,7 @@ struct psi_cpp_exp *psi_cpp_exp_init(token_t type, void *data) { - struct psi_cpp_exp *exp = calloc(1, sizeof(*exp)); + struct psi_cpp_exp *exp = pecalloc(1, sizeof(*exp), 1); switch ((exp->type = type)) { case PSI_T_WARNING: @@ -184,7 +184,8 @@ void psi_cpp_exp_exec(struct psi_cpp_exp *exp, struct psi_cpp *cpp, struct psi_d exp->token->text->val, cpp->level, cpp->skip); #if PSI_CPP_DEBUG - psi_cpp_exp_dump(2, exp); + PSI_DEBUG_PRINT(cpp->parser, "PSI: CPP exec -> "); + PSI_DEBUG_DUMP(cpp->parser, psi_cpp_exp_dump, exp); #endif switch (exp->type) { @@ -296,21 +297,24 @@ void psi_cpp_exp_exec(struct psi_cpp_exp *exp, struct psi_cpp *cpp, struct psi_d case PSI_T_INCLUDE: if (!cpp->skip) { if (!psi_cpp_include(cpp, exp->data.tok, PSI_CPP_INCLUDE)) { - D->error(D, exp->token, PSI_WARNING, "Failed to include %s", exp->data.tok->text->val); + D->error(D, exp->token, PSI_WARNING, "Failed to include %s: %s", + exp->data.tok->text->val, strerror(errno)); } } break; case PSI_T_INCLUDE_NEXT: if (!cpp->skip) { if (!psi_cpp_include(cpp, exp->data.tok, PSI_CPP_INCLUDE_NEXT)) { - D->error(D, exp->token, PSI_WARNING, "Failed to include %s", exp->data.tok->text->val); + D->error(D, exp->token, PSI_WARNING, "Failed to include next %s: %s", + exp->data.tok->text->val, strerror(errno)); } } break; case PSI_T_IMPORT: if (!cpp->skip) { if (!psi_cpp_include(cpp, exp->data.tok, PSI_CPP_INCLUDE_ONCE)) { - D->error(D, exp->token, PSI_WARNING, "Failed to include %s", exp->data.tok->text->val); + D->error(D, exp->token, PSI_WARNING, "Failed to include once %s: %s", + exp->data.tok->text->val, strerror(errno)); } } break;