*/
static void print_function_type_pre(const function_type_t *type, bool top)
{
- if (type->linkage != NULL) {
- fputs("extern \"", out);
- fputs(type->linkage->string, out);
- fputs("\" ", out);
+ switch (type->linkage) {
+ case LINKAGE_INVALID:
+ break;
+
+ case LINKAGE_C:
+ if (c_mode & _CXX)
+ fputs("extern \"C\" ", out);
+ break;
+
+ case LINKAGE_CXX:
+ if (!(c_mode & _CXX))
+ fputs("extern \"C++\" ", out);
+ break;
}
print_type_qualifiers(type->base.qualifiers);
intern_print_type_pre(type->return_type, false);
-#if 0
- /* TODO: revive with linkage */
- switch (type->linkage) {
- case CC_CDECL:
- fputs("__cdecl ", out);
- break;
- case CC_STDCALL:
- fputs("__stdcall ", out);
- break;
- case CC_FASTCALL:
- fputs("__fastcall ", out);
- break;
- case CC_THISCALL:
- fputs("__thiscall ", out);
- break;
- case CC_DEFAULT:
- break;
+ switch (type->calling_convention) {
+ case CC_CDECL: fputs("__cdecl ", out); break;
+ case CC_STDCALL: fputs("__stdcall ", out); break;
+ case CC_FASTCALL: fputs("__fastcall ", out); break;
+ case CC_THISCALL: fputs("__thiscall ", out); break;
+ case CC_DEFAULT: break;
}
-#endif
/* don't emit parenthesis if we're the toplevel type... */
if (!top)
if (func1->linkage != func2->linkage)
return false;
+ if (func1->calling_convention != func2->calling_convention)
+ return false;
+
/* can parameters be compared? */
if (func1->unspecified_parameters || func2->unspecified_parameters)
return true;