widl: Define PROXY_DELEGATION in dlldata.c when needed.

This commit is contained in:
Jacek Caban 2012-11-01 12:27:32 +01:00 committed by Alexandre Julliard
parent a04f73808e
commit 218b1951db
3 changed files with 18 additions and 4 deletions

View File

@ -47,6 +47,7 @@ extern int need_proxy(const type_t *iface);
extern int need_inline_stubs(const type_t *iface); extern int need_inline_stubs(const type_t *iface);
extern int need_stub_files(const statement_list_t *stmts); extern int need_stub_files(const statement_list_t *stmts);
extern int need_proxy_file(const statement_list_t *stmts); extern int need_proxy_file(const statement_list_t *stmts);
extern int need_proxy_delegation(const statement_list_t *stmts);
extern int need_inline_stubs_file(const statement_list_t *stmts); extern int need_inline_stubs_file(const statement_list_t *stmts);
extern const var_t *is_callas(const attr_list_t *list); extern const var_t *is_callas(const attr_list_t *list);
extern void write_args(FILE *h, const var_list_t *arg, const char *name, int obj, int do_indent); extern void write_args(FILE *h, const var_list_t *arg, const char *name, int obj, int do_indent);

View File

@ -778,7 +778,12 @@ int need_stub(const type_t *iface)
int need_proxy_file(const statement_list_t *stmts) int need_proxy_file(const statement_list_t *stmts)
{ {
return does_any_iface(stmts, need_proxy); return does_any_iface(stmts, need_proxy);
}
int need_proxy_delegation(const statement_list_t *stmts)
{
return does_any_iface(stmts, need_delegation);
} }
int need_inline_stubs(const type_t *iface) int need_inline_stubs(const type_t *iface)

View File

@ -340,7 +340,7 @@ static void free_filename_nodes(struct list *list)
} }
} }
static void write_dlldata_list(struct list *filenames) static void write_dlldata_list(struct list *filenames, int define_proxy_delegation)
{ {
FILE *dlldata; FILE *dlldata;
filename_node_t *node; filename_node_t *node;
@ -351,6 +351,8 @@ static void write_dlldata_list(struct list *filenames)
fprintf(dlldata, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION); fprintf(dlldata, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
fprintf(dlldata, "- Do not edit ***/\n\n"); fprintf(dlldata, "- Do not edit ***/\n\n");
if (define_proxy_delegation)
fprintf(dlldata, "#define PROXY_DELEGATION\n");
fprintf(dlldata, "#include <objbase.h>\n"); fprintf(dlldata, "#include <objbase.h>\n");
fprintf(dlldata, "#include <rpcproxy.h>\n\n"); fprintf(dlldata, "#include <rpcproxy.h>\n\n");
start_cplusplus_guard(dlldata); start_cplusplus_guard(dlldata);
@ -380,15 +382,19 @@ static char *eat_space(char *s)
void write_dlldata(const statement_list_t *stmts) void write_dlldata(const statement_list_t *stmts)
{ {
struct list filenames = LIST_INIT(filenames); struct list filenames = LIST_INIT(filenames);
int define_proxy_delegation = 0;
filename_node_t *node; filename_node_t *node;
FILE *dlldata; FILE *dlldata;
if (!do_dlldata || !need_proxy_file(stmts)) if (!do_dlldata || !need_proxy_file(stmts))
return; return;
define_proxy_delegation = need_proxy_delegation(stmts);
dlldata = fopen(dlldata_name, "r"); dlldata = fopen(dlldata_name, "r");
if (dlldata) { if (dlldata) {
static char marker[] = "REFERENCE_PROXY_FILE"; static char marker[] = "REFERENCE_PROXY_FILE";
static const char delegation_define[] = "#define PROXY_DELEGATION";
char *line = NULL; char *line = NULL;
size_t len = 0; size_t len = 0;
@ -409,6 +415,8 @@ void write_dlldata(const statement_list_t *stmts)
*end = '\0'; *end = '\0';
if (start < end) if (start < end)
add_filename_node(&filenames, start); add_filename_node(&filenames, start);
}else if (!define_proxy_delegation && strncmp(start, delegation_define, sizeof(delegation_define)-1)) {
define_proxy_delegation = 1;
} }
} }
@ -427,7 +435,7 @@ void write_dlldata(const statement_list_t *stmts)
} }
add_filename_node(&filenames, proxy_token); add_filename_node(&filenames, proxy_token);
write_dlldata_list(&filenames); write_dlldata_list(&filenames, define_proxy_delegation);
free_filename_nodes(&filenames); free_filename_nodes(&filenames);
} }
@ -676,7 +684,7 @@ int main(int argc,char *argv[])
for ( ; optind < argc; ++optind) for ( ; optind < argc; ++optind)
add_filename_node(&filenames, argv[optind]); add_filename_node(&filenames, argv[optind]);
write_dlldata_list(&filenames); write_dlldata_list(&filenames, 0 /* FIXME */ );
free_filename_nodes(&filenames); free_filename_nodes(&filenames);
return 0; return 0;
} }