projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
cpp: sizeof, anon decls, etc
[m6w6/ext-psi]
/
src
/
types
/
cpp_exp.c
diff --git
a/src/types/cpp_exp.c
b/src/types/cpp_exp.c
index 2371ae25f1047fabd6f260b97de3e522688ebc49..6e01843ac4aae08067cc765e8d5066b76b5515a9 100644
(file)
--- a/
src/types/cpp_exp.c
+++ b/
src/types/cpp_exp.c
@@
-54,7
+54,7
@@
struct psi_cpp_exp *psi_cpp_exp_init(token_t type, void *data)
break;
case PSI_T_ENDIF:
case PSI_T_ELSE:
break;
case PSI_T_ENDIF:
case PSI_T_ELSE:
- case PSI_T_ONCE:
+ case PSI_T_
PRAGMA_
ONCE:
break;
default:
assert(0);
break;
default:
assert(0);
@@
-95,7
+95,7
@@
void psi_cpp_exp_free(struct psi_cpp_exp **exp_ptr)
break;
case PSI_T_ENDIF:
case PSI_T_ELSE:
break;
case PSI_T_ENDIF:
case PSI_T_ELSE:
- case PSI_T_ONCE:
+ case PSI_T_
PRAGMA_
ONCE:
break;
default:
assert(0);
break;
default:
assert(0);
@@
-121,10
+121,16
@@
void psi_cpp_exp_dump(int fd, struct psi_cpp_exp *exp)
case PSI_T_UNDEF:
case PSI_T_IFDEF:
case PSI_T_IFNDEF:
case PSI_T_UNDEF:
case PSI_T_IFDEF:
case PSI_T_IFNDEF:
+ dprintf(fd, "%s", exp->data.tok->text);
+ break;
case PSI_T_IMPORT:
case PSI_T_INCLUDE:
case PSI_T_INCLUDE_NEXT:
case PSI_T_IMPORT:
case PSI_T_INCLUDE:
case PSI_T_INCLUDE_NEXT:
- dprintf(fd, "%s", exp->data.tok->text);
+ if (exp->data.tok->type == PSI_T_CPP_HEADER) {
+ dprintf(fd, "<%s>", exp->data.tok->text);
+ } else {
+ dprintf(fd, "\"%s\"", exp->data.tok->text);
+ }
break;
case PSI_T_DEFINE:
psi_cpp_macro_decl_dump(fd, exp->data.decl);
break;
case PSI_T_DEFINE:
psi_cpp_macro_decl_dump(fd, exp->data.decl);
@@
-135,7
+141,7
@@
void psi_cpp_exp_dump(int fd, struct psi_cpp_exp *exp)
break;
case PSI_T_ENDIF:
case PSI_T_ELSE:
break;
case PSI_T_ENDIF:
case PSI_T_ELSE:
- case PSI_T_ONCE:
+ case PSI_T_
PRAGMA_
ONCE:
break;
default:
assert(0);
break;
default:
assert(0);
@@
-296,25
+302,26
@@
void psi_cpp_exp_exec(struct psi_cpp_exp *exp, struct psi_cpp *cpp, struct psi_d
break;
case PSI_T_INCLUDE:
if (!cpp->skip) {
break;
case PSI_T_INCLUDE:
if (!cpp->skip) {
- if (!psi_cpp_include(cpp, exp->data.tok
->text
, PSI_CPP_INCLUDE)) {
+ 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);
}
}
break;
case PSI_T_INCLUDE_NEXT:
if (!cpp->skip) {
D->error(D, exp->token, PSI_WARNING, "Failed to include %s", exp->data.tok->text);
}
}
break;
case PSI_T_INCLUDE_NEXT:
if (!cpp->skip) {
- if (!psi_cpp_include(cpp, exp->data.tok
->text
, PSI_CPP_INCLUDE_NEXT)) {
+ 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);
}
}
break;
case PSI_T_IMPORT:
if (!cpp->skip) {
D->error(D, exp->token, PSI_WARNING, "Failed to include %s", exp->data.tok->text);
}
}
break;
case PSI_T_IMPORT:
if (!cpp->skip) {
- if (!psi_cpp_include(cpp, exp->data.tok
->text
, PSI_CPP_INCLUDE_ONCE)) {
+ 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);
}
}
D->error(D, exp->token, PSI_WARNING, "Failed to include %s", exp->data.tok->text);
}
}
- case PSI_T_ONCE:
+ break;
+ case PSI_T_PRAGMA_ONCE:
if (!cpp->skip) {
zend_hash_str_add_empty_element(&cpp->once, exp->token->file, strlen(exp->token->file));
}
if (!cpp->skip) {
zend_hash_str_add_empty_element(&cpp->once, exp->token->file, strlen(exp->token->file));
}