(decl_attribute): Allow special names (e.g, `word') for mode

attribute.

From-SVN: r8582
This commit is contained in:
Richard Kenner 1994-11-30 15:48:00 -05:00
parent 077e4b0117
commit caab5771c8

View File

@ -297,27 +297,36 @@ found_attr:;
&& TREE_CODE (TREE_VALUE (args)) == IDENTIFIER_NODE) && TREE_CODE (TREE_VALUE (args)) == IDENTIFIER_NODE)
{ {
int i; int i;
char *specified_name char *specified_name = IDENTIFIER_POINTER (TREE_VALUE (args));
= IDENTIFIER_POINTER (TREE_VALUE (args)); enum machine_mode mode = VOIDmode;
tree typefm;
/* Give this decl a type with the specified mode. */ /* Give this decl a type with the specified mode.
for (i = 0; i < NUM_MACHINE_MODES; i++) First check for the special modes. */
if (!strcmp (specified_name, GET_MODE_NAME (i))) if (! strcmp (specified_name, "byte")
{ || ! strcmp (specified_name, "__byte__"))
tree typefm mode = byte_mode;
= type_for_mode (i, TREE_UNSIGNED (type)); else if (!strcmp (specified_name, "word")
if (typefm != 0) || ! strcmp (specified_name, "__word__"))
{ mode = word_mode;
TREE_TYPE (decl) = type = typefm; else if (! strcmp (specified_name, "pointer")
DECL_SIZE (decl) = 0; || !strcmp (specified_name, "__pointer__"))
layout_decl (decl, 0); mode = ptr_mode;
} else
else for (i = 0; i < NUM_MACHINE_MODES; i++)
error ("no data type for mode `%s'", specified_name); if (!strcmp (specified_name, GET_MODE_NAME (i)))
break; mode = (enum machine_mode) i;
}
if (i == NUM_MACHINE_MODES) if (mode == VOIDmode)
error_with_decl (decl, "unknown machine mode `%s'", specified_name); error_with_decl (decl, "unknown machine mode `%s'", specified_name);
else if ((typefm = type_for_mode (mode, TREE_UNSIGNED (type))) == 0)
error_with_decl (decl, "no data type for mode `%s'", specified_name);
else
{
TREE_TYPE (decl) = type = typefm;
DECL_SIZE (decl) = 0;
layout_decl (decl, 0);
}
} }
else if ((!strcmp (IDENTIFIER_POINTER (name), "section") else if ((!strcmp (IDENTIFIER_POINTER (name), "section")
|| !strcmp (IDENTIFIER_POINTER (name), "__section__")) || !strcmp (IDENTIFIER_POINTER (name), "__section__"))