mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
Made cc65 properly test calling conventions when it compares forward declarations to function definitions.
This commit is contained in:
parent
e72132c8ae
commit
bbb6f89731
@ -1455,7 +1455,7 @@ static void Declarator (const DeclSpec* Spec, Declaration* D, declmode_t Mode)
|
|||||||
|
|
||||||
/* We cannot specify fastcall for variadic functions */
|
/* We cannot specify fastcall for variadic functions */
|
||||||
if ((F->Flags & FD_VARIADIC) && (Qualifiers & T_QUAL_FASTCALL)) {
|
if ((F->Flags & FD_VARIADIC) && (Qualifiers & T_QUAL_FASTCALL)) {
|
||||||
Error ("Variadic functions cannot be `__fastcall__'");
|
Error ("Variadic functions cannot be __fastcall__");
|
||||||
Qualifiers &= ~T_QUAL_FASTCALL;
|
Qualifiers &= ~T_QUAL_FASTCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +246,19 @@ static void DoCompare (const Type* lhs, const Type* rhs, typecmp_t* Result)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LeftType == T_TYPE_FUNC) {
|
||||||
|
/* If a calling convention wasn't set explicitly,
|
||||||
|
** then assume the default one.
|
||||||
|
*/
|
||||||
|
if ((LeftQual & T_QUAL_CCONV) == T_QUAL_NONE) {
|
||||||
|
LeftQual |= (AutoCDecl || IsVariadicFunc (lhs)) ? T_QUAL_CDECL : T_QUAL_FASTCALL;
|
||||||
|
}
|
||||||
|
if ((RightQual & T_QUAL_CCONV) == T_QUAL_NONE) {
|
||||||
|
RightQual |= (AutoCDecl || IsVariadicFunc (rhs)) ? T_QUAL_CDECL : T_QUAL_FASTCALL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (LeftQual != RightQual) {
|
if (LeftQual != RightQual) {
|
||||||
/* On the first indirection level, different qualifiers mean
|
/* On the first indirection level, different qualifiers mean
|
||||||
** that the types still are compatible. On the second level,
|
** that the types still are compatible. On the second level,
|
||||||
@ -272,23 +285,7 @@ static void DoCompare (const Type* lhs, const Type* rhs, typecmp_t* Result)
|
|||||||
SetResult (Result, TC_STRICT_COMPATIBLE);
|
SetResult (Result, TC_STRICT_COMPATIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LeftType != T_TYPE_FUNC) {
|
if (LeftType != T_TYPE_FUNC || (LeftQual & T_QUAL_CCONV) == (RightQual & T_QUAL_CCONV)) {
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If a calling convention wasn't set explicitly,
|
|
||||||
** then assume the default one.
|
|
||||||
*/
|
|
||||||
LeftQual &= T_QUAL_CCONV;
|
|
||||||
if (LeftQual == T_QUAL_NONE) {
|
|
||||||
LeftQual = (AutoCDecl || IsVariadicFunc (lhs)) ? T_QUAL_CDECL : T_QUAL_FASTCALL;
|
|
||||||
}
|
|
||||||
RightQual &= T_QUAL_CCONV;
|
|
||||||
if (RightQual == T_QUAL_NONE) {
|
|
||||||
RightQual = (AutoCDecl || IsVariadicFunc (rhs)) ? T_QUAL_CDECL : T_QUAL_FASTCALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LeftQual == RightQual) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* else fall through */
|
/* else fall through */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user