static int overrides = 0; /* number of override functions */
static int privates = 0; /* number of private data members */
+static gboolean made_aliases = FALSE; /* if we made any shorthand aliases
+ and need the REALLY UGLY HACK to
+ avoid warnings */
+
FILE *out = NULL;
FILE *outh = NULL;
FILE *outph = NULL;
print_method(out,"static ","(* ",") ","",m,TRUE);
out_printf(out," = %s_%s;\n",funcbase,m->id);
+
+ made_aliases = TRUE;
}
}
out_printf(out,"\n");
add_bad_hack_to_avoid_unused_warnings(Class *c)
{
GList *li;
+
+ /* if we haven't had any methods, just return */
+ if(!made_aliases)
+ return;
out_printf(out,"\n\n/*REALLY BAD HACK\n"
" This is to avoid unused warnings if you don't call\n"
if(m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
m->scope == PRIVATE_SIGNAL_FIRST_METHOD ||
m->scope == PRIVATE_VIRTUAL_METHOD) {
- if(m->cbuf)
+ if(m->cbuf && *m->cbuf->str)
print_method(out,"static ","_real_"," ",";\n",m,FALSE);
print_method(out,"static ",""," ",";\n",m,FALSE);
} else if(m->scope == SIGNAL_LAST_METHOD ||
m->scope == SIGNAL_FIRST_METHOD ||
m->scope == VIRTUAL_METHOD) {
- if(!m->cbuf)
+ if(!m->cbuf || !*m->cbuf->str)
return;
print_method(out,"static ","_real_"," ",";\n",m,FALSE);
} else {
out_printf(out,"\t%s_class->%s = %s_%s;\n",
s,m->id,funcbase,m->id);
} else {
- if(m->cbuf)
+ if(m->cbuf && *m->cbuf->str)
out_printf(out,"\t%s->%s = _real_%s_%s;\n",
oname,m->id,funcbase,m->id);
else
} else
continue;
- if(m->cbuf) {
+ if(m->cbuf && *m->cbuf->str) {
out_printf(out," {\n");
out_addline_infile(out,m->ccode_line);
out_printf(out,"%s\n",m->cbuf->str);
{
char *s;
int private = FALSE;
+ int is_void;
+ is_void = (strcmp(m->mtype->name,"void")==0 &&
+ m->mtype->stars == 0);
out_printf(out,"\n");
switch(m->scope) {
case PUBLIC_SCOPE:
"\treturn return_val;\n}\n");
}
- if(!m->cbuf)
+ if(!m->cbuf || !*m->cbuf->str)
break;
out_addline_infile(out,m->line_no);
print_method(out,"static ","\n_real_"," ","\n",m,FALSE);
m->onerror?m->onerror:"0");
}
- if(!m->cbuf)
+ if(!m->cbuf || !*m->cbuf->str)
break;
out_addline_infile(out,m->line_no);
print_method(out,"static ","\n_real_"," ","\n",m,FALSE);
print_method(out,"static ","\n"," ","\n",m,FALSE);
s = replace_sep(m->otype,'_');
g_strup(s);
- out_printf(out,"#define PARENT_HANDLER(args...) \\\n"
- "\t{ if(%s_CLASS(parent_class)->%s) \\\n"
- "\t\t(* %s_CLASS(parent_class)->%s)(##args); }\n",
- s,m->id,s,m->id);
+ if(is_void) {
+ out_printf(out,"#define PARENT_HANDLER(args...) \\\n"
+ "\t{ if(%s_CLASS(parent_class)->%s) \\\n"
+ "\t\t(* %s_CLASS(parent_class)->%s)(##args); }\n",
+ s,m->id,s,m->id);
+ } else {
+ out_printf(out,"#define PARENT_HANDLER(args...) \\\n"
+ "\t((%s_CLASS(parent_class)->%s)? \\\n"
+ "\t\t(* %s_CLASS(parent_class)->%s)(##args): \\\n"
+ "\t\t(",
+ s,m->id,s,m->id);
+ out_printf(out,"(");
+ print_type(out,m->mtype,TRUE);
+ out_printf(out,")%s))\n",
+ m->onerror?m->onerror:"0");
+ }
g_free(s);
print_method_body(m,TRUE);
out_printf(out,"#undef PARENT_HANDLER\n");