This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Assertify avr
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 27 Apr 2005 18:01:29 +0100
- Subject: Assertify avr
- Organization: CodeSourcery LLC
The avr port had about 6 abort calls. Assertified thusly.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2005-04-27 Nathan Sidwell <nathan@codesourcery.com>
* config/fp-bit.c (abort): Add noreturn attribute.
* config/avr/avr.c (avr_naked_function_p): Use gcc_assert and
gcc_unreachable as appropriate.
(ptrreg_to_str, cond_string, avr_normalize_condition): Likewise.
* config/avr/avr.h (ASM_OUTPUT_REG_PUSH,
ASM_OUTPUT_REG_POP): Likewise.
Index: config/fp-bit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/fp-bit.c,v
retrieving revision 1.48
diff -c -3 -p -r1.48 fp-bit.c
*** config/fp-bit.c 8 Apr 2005 01:50:59 -0000 1.48
--- config/fp-bit.c 27 Apr 2005 09:39:07 -0000
*************** Boston, MA 02111-1307, USA. */
*** 81,87 ****
#endif
#ifdef EXTENDED_FLOAT_STUBS
! extern void abort (void);
void __extendsfxf2 (void) { abort(); }
void __extenddfxf2 (void) { abort(); }
void __truncxfdf2 (void) { abort(); }
--- 81,87 ----
#endif
#ifdef EXTENDED_FLOAT_STUBS
! extern __attribute__ ((__noreturn__)) void abort (void);
void __extendsfxf2 (void) { abort(); }
void __extenddfxf2 (void) { abort(); }
void __truncxfdf2 (void) { abort(); }
Index: config/avr/avr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/avr/avr.c,v
retrieving revision 1.133
diff -c -3 -p -r1.133 avr.c
*** config/avr/avr.c 23 Apr 2005 21:28:17 -0000 1.133
--- config/avr/avr.c 27 Apr 2005 09:39:18 -0000
*************** avr_naked_function_p (tree func)
*** 380,387 ****
{
tree a;
! if (TREE_CODE (func) != FUNCTION_DECL)
! abort ();
a = lookup_attribute ("naked", DECL_ATTRIBUTES (func));
return a != NULL_TREE;
--- 380,386 ----
{
tree a;
! gcc_assert (TREE_CODE (func) == FUNCTION_DECL);
a = lookup_attribute ("naked", DECL_ATTRIBUTES (func));
return a != NULL_TREE;
*************** ptrreg_to_str (int regno)
*** 1030,1036 ****
case REG_Y: return "Y";
case REG_Z: return "Z";
default:
! abort ();
}
return NULL;
}
--- 1029,1035 ----
case REG_Y: return "Y";
case REG_Z: return "Z";
default:
! gcc_unreachable ();
}
return NULL;
}
*************** cond_string (enum rtx_code code)
*** 1062,1068 ****
case LTU:
return "lo";
default:
! abort ();
}
}
--- 1061,1067 ----
case LTU:
return "lo";
default:
! gcc_unreachable ();
}
}
*************** avr_normalize_condition (RTX_CODE condit
*** 5534,5540 ****
case LEU:
return LTU;
default:
! abort ();
}
}
--- 5533,5539 ----
case LEU:
return LTU;
default:
! gcc_unreachable ();
}
}
Index: config/avr/avr.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/avr/avr.h,v
retrieving revision 1.113
diff -c -3 -p -r1.113 avr.h
*** config/avr/avr.h 19 Mar 2005 08:54:35 -0000 1.113
--- config/avr/avr.h 27 Apr 2005 09:39:18 -0000
*************** sprintf (STRING, "*.%s%lu", PREFIX, (uns
*** 668,682 ****
#define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
{ \
! if (REGNO > 31) \
! abort (); \
fprintf (STREAM, "\tpush\tr%d", REGNO); \
}
#define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
{ \
! if (REGNO > 31) \
! abort (); \
fprintf (STREAM, "\tpop\tr%d", REGNO); \
}
--- 668,680 ----
#define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
{ \
! gcc_assert (REGNO < 32); \
fprintf (STREAM, "\tpush\tr%d", REGNO); \
}
#define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
{ \
! gcc_assert (REGNO < 32); \
fprintf (STREAM, "\tpop\tr%d", REGNO); \
}