void prt_typeof_expr(typeof_expr texpr);
void prt_typeof_type(typeof_type ttype);
void prt_gcc_attribute(gcc_attribute a);
+void prt_target_attribute(target_attribute a);
void prt_nesc_attribute(nesc_attribute a);
void prt_rid(rid r, psd_options options);
void prt_qualifier(qualifier q);
output("...");
}
-static type_element interesting_element(type_element elems)
-{
- type_element elem;
-
- scan_type_element (elem, elems)
- if (is_tag_ref(elem))
- return elem;
-
- return NULL;
-}
-
static void prt_prefix(location loc, data_declaration ddecl,
type_element modifiers)
{
prt_diff_info(d->ddecl);
prt_prefix(d->location, d->ddecl, d->modifiers);
/* gcc wants the attributes here */
- prt_type_elements(CAST(type_element, d->attributes), 0);
+ prt_type_elements(CAST(type_element, d->attributes),
+ flag_gccize ? 0 : psd_no_target_attributes);
if (ret)
{
prt_declarator(d->declarator, d->modifiers, NULL, d->ddecl,
psd_print_default);
+ if (!flag_gccize)
+ prt_type_elements(CAST(type_element, d->attributes), psd_only_target_attributes);
+
startline();
prt_parameter_declarations(d->old_parms);
extrablock = prt_network_parameter_copies(d);
else
prt_declarator(d->declarator, modifiers, NULL, d->ddecl, options);
+ if (d->asm_stmt)
+ prt_asm_stmt_plain(d->asm_stmt);
+
if (d->attributes)
{
output(" ");
prt_type_elements(CAST(type_element, d->attributes), 0);
}
- if (d->asm_stmt)
- prt_asm_stmt_plain(d->asm_stmt);
-
if (d->arg1 && !(use_nido && is_module_variable(d->ddecl)))
{
output(" = ");
bool prt_type_element(type_element em, psd_options options)
{
+ if ((options & psd_only_target_attributes) &&
+ em->kind != kind_target_attribute)
+ return FALSE;
+
+ if ((options & psd_no_target_attributes) &&
+ em->kind == kind_target_attribute)
+ return FALSE;
+
switch (em->kind)
{
case kind_component_typeref: /* fall through to prt_typename */
case kind_typeof_expr: prt_typeof_expr(CAST(typeof_expr, em)); break;
case kind_typeof_type: prt_typeof_type(CAST(typeof_type, em)); break;
case kind_gcc_attribute: prt_gcc_attribute(CAST(gcc_attribute, em)); break;
+ case kind_target_attribute:
+ if (flag_gccize)
+ prt_gcc_attribute(CAST(gcc_attribute, em));
+ else
+ prt_target_attribute(CAST(target_attribute, em));
+ break;
case kind_nesc_attribute: prt_nesc_attribute(CAST(nesc_attribute, em)); break;
case kind_qualifier: prt_qualifier(CAST(qualifier, em)); break;
case kind_rid:
switch (em->kind)
{
case kind_gcc_attribute:
+ case kind_target_attribute:
prt_gcc_attribute(CAST(gcc_attribute, em));
return TRUE;
case kind_nesc_attribute:
}
}
+void prt_target_attribute(target_attribute a)
+{
+ set_location(a->location);
+ if (!strcmp(a->word1->cstring.data, "iar_at"))
+ output("@");
+ else if (!strcmp(a->word1->cstring.data, "keil_address"))
+ output("=");
+ else
+ prt_word(a->word1);
+ if (a->args)
+ {
+ output(" ");
+ prt_expressions(a->args, TRUE);
+ }
+}
+
void prt_nesc_attribute(nesc_attribute a)
{
/* If the attribute has a macro_name, then print attribute like
}
break;
case kind_leq: case kind_geq: case kind_lt: case kind_gt:
- lpri = P_REL; pri = P_REL; rpri = P_SHIFT; break;
+ pri = P_REL;
+ if (CONSERVATIVE_PARENS)
+ lpri = rpri = P_PLUS;
+ else
+ {
+ lpri = P_REL; rpri = P_SHIFT;
+ }
+ break;
case kind_eq: case kind_ne:
- lpri = P_EQUALS; pri = P_EQUALS; rpri = P_REL; break;
+ pri = P_EQUALS;
+ if (CONSERVATIVE_PARENS)
+ lpri = rpri = P_PLUS;
+ else
+ {
+ lpri = P_EQUALS;
+ rpri = P_REL;
+ }
+ break;
case kind_bitand:
pri = P_BITAND;
if (CONSERVATIVE_PARENS)