make pascal attribute imply C linkage (fixes #75)

This commit is contained in:
Wolfgang Thaller 2019-01-21 21:42:41 +01:00
parent b6bbe4d5a4
commit 7d2fd1bf78
3 changed files with 10 additions and 1 deletions

View File

@ -156,7 +156,7 @@
builtin_assert ("machine=powerpc"); \
builtin_assert ("cpu=m68k"); \
builtin_assert ("machine=m68k"); \
builtin_define("pascal="); \
builtin_define("pascal=__attribute__((__pascal__))"); \
builtin_define("__IEEE_BIG_ENDIAN"); \
} \
while (0)

View File

@ -1547,6 +1547,9 @@ static const struct attribute_spec rs6000_attribute_table[] =
rs6000_handle_struct_attribute, NULL },
{ "gcc_struct", 0, 0, false, false, false, false,
rs6000_handle_struct_attribute, NULL },
{ "pascal", 0, 0, false, true, true, false/*don't be strict about function pointers*/,
NULL, NULL },
#ifdef SUBTARGET_ATTRIBUTE_TABLE
SUBTARGET_ATTRIBUTE_TABLE,
#endif

View File

@ -8855,6 +8855,12 @@ grokfndecl (tree ctype,
(IDENTIFIER_POINTER (declarator))))))
SET_DECL_LANGUAGE (decl, lang_c);
if (attrlist && lookup_attribute ("pascal", *attrlist))
{
// paradoxical, but true: Mac pascal function names aren't mangled.
SET_DECL_LANGUAGE (decl, lang_c);
}
/* Should probably propagate const out from type to decl I bet (mrs). */
if (staticp)
{