From 7d12442c4de88a1f6236ec9256c6bb94b1d98845 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 7 Nov 2007 15:26:43 +0000 Subject: 2007-11-07 Joel Sherrill * score/include/rtems/system.h, score/include/rtems/score/interr.h: Add compiler conditional attribute for methods that do not return. This avoids gcc generating unreachable code following calls to _Internal_error_Occurred. --- cpukit/ChangeLog | 7 +++++++ cpukit/score/include/rtems/score/interr.h | 4 ++-- cpukit/score/include/rtems/system.h | 16 +++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) (limited to 'cpukit') diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 003e15b519..a9584178ae 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,10 @@ +2007-11-07 Joel Sherrill + + * score/include/rtems/system.h, score/include/rtems/score/interr.h: Add + compiler conditional attribute for methods that do not return. This + avoids gcc generating unreachable code following calls to + _Internal_error_Occurred. + 2007-11-06 Joel Sherrill * configure.ac: Add ARM/Thumb Makefile. diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h index a9fb98c0ae..d41d9cdb58 100644 --- a/cpukit/score/include/rtems/score/interr.h +++ b/cpukit/score/include/rtems/score/interr.h @@ -6,7 +6,7 @@ */ /* - * COPYRIGHT (c) 1989-2006. + * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -91,7 +91,7 @@ void _Internal_error_Occurred( Internal_errors_Source the_source, boolean is_internal, uint32_t the_error -); +) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; #ifdef __cplusplus } diff --git a/cpukit/score/include/rtems/system.h b/cpukit/score/include/rtems/system.h index d64d641f9d..7fb12a4bfb 100644 --- a/cpukit/score/include/rtems/system.h +++ b/cpukit/score/include/rtems/system.h @@ -7,7 +7,7 @@ */ /* - * COPYRIGHT (c) 1989-2006. + * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -124,6 +124,20 @@ extern "C" { #define RTEMS_COMPILER_MEMORY_BARRIER() #endif +/** + * The following macro is a compiler specific way to indicate that + * the method will NOT return to the caller. This can assist the + * compiler in code generation and avoid unreachable paths. This + * can impact the code generated following calls to + * rtems_fatal_error_occurred and _Internal_error_Occurred. + */ +#ifdef __GNUC__ + #define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE \ + __attribute__ ((noreturn)) +#else + #define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE +#endif + #ifdef RTEMS_POSIX_API /** The following is used by the POSIX implementation to catch bad paths. */ int POSIX_MP_NOT_IMPLEMENTED( void ); -- cgit v1.2.3