widl: Define PROXY_DELEGATION in dlldata.c when needed.
This commit is contained in:
parent
a04f73808e
commit
218b1951db
|
@ -47,6 +47,7 @@ extern int need_proxy(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_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 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);
|
||||
|
|
|
@ -781,6 +781,11 @@ int need_proxy_file(const statement_list_t *stmts)
|
|||
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)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
|
|
|
@ -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;
|
||||
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, "- Do not edit ***/\n\n");
|
||||
if (define_proxy_delegation)
|
||||
fprintf(dlldata, "#define PROXY_DELEGATION\n");
|
||||
fprintf(dlldata, "#include <objbase.h>\n");
|
||||
fprintf(dlldata, "#include <rpcproxy.h>\n\n");
|
||||
start_cplusplus_guard(dlldata);
|
||||
|
@ -380,15 +382,19 @@ static char *eat_space(char *s)
|
|||
void write_dlldata(const statement_list_t *stmts)
|
||||
{
|
||||
struct list filenames = LIST_INIT(filenames);
|
||||
int define_proxy_delegation = 0;
|
||||
filename_node_t *node;
|
||||
FILE *dlldata;
|
||||
|
||||
if (!do_dlldata || !need_proxy_file(stmts))
|
||||
return;
|
||||
|
||||
define_proxy_delegation = need_proxy_delegation(stmts);
|
||||
|
||||
dlldata = fopen(dlldata_name, "r");
|
||||
if (dlldata) {
|
||||
static char marker[] = "REFERENCE_PROXY_FILE";
|
||||
static const char delegation_define[] = "#define PROXY_DELEGATION";
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
|
@ -409,6 +415,8 @@ void write_dlldata(const statement_list_t *stmts)
|
|||
*end = '\0';
|
||||
if (start < end)
|
||||
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);
|
||||
write_dlldata_list(&filenames);
|
||||
write_dlldata_list(&filenames, define_proxy_delegation);
|
||||
free_filename_nodes(&filenames);
|
||||
}
|
||||
|
||||
|
@ -676,7 +684,7 @@ int main(int argc,char *argv[])
|
|||
for ( ; optind < argc; ++optind)
|
||||
add_filename_node(&filenames, argv[optind]);
|
||||
|
||||
write_dlldata_list(&filenames);
|
||||
write_dlldata_list(&filenames, 0 /* FIXME */ );
|
||||
free_filename_nodes(&filenames);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue