From 8d144a3eb868e5fea135cc87f88d0c2eda11f50a Mon Sep 17 00:00:00 2001 From: fxcoudert Date: Thu, 10 Jul 2014 08:45:38 +0000 Subject: [PATCH] * config/fpu-*.h (get_fpu_rounding_mode, set_fpu_rounding_mode, support_fpu_rounding_mode): Clean up, mark unreachable code as such. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212423 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 5 +++++ libgfortran/config/fpu-387.h | 2 +- libgfortran/config/fpu-aix.h | 10 +++++----- libgfortran/config/fpu-glibc.h | 8 +++++--- libgfortran/config/fpu-sysv.h | 20 ++++---------------- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 245e6dbed5b..db9e42bd48a 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2014-07-10 Francois-Xavier Coudert + + * config/fpu-*.h (get_fpu_rounding_mode, set_fpu_rounding_mode, + support_fpu_rounding_mode): Clean up, mark unreachable code as such. + 2014-07-09 Francois-Xavier Coudert * libgfortran.h (support_fpu_underflow_control, diff --git a/libgfortran/config/fpu-387.h b/libgfortran/config/fpu-387.h index 201173e5813..0ccd8e602c4 100644 --- a/libgfortran/config/fpu-387.h +++ b/libgfortran/config/fpu-387.h @@ -421,7 +421,7 @@ get_fpu_rounding_mode (void) case _FPU_RC_ZERO: return GFC_FPE_TOWARDZERO; default: - return GFC_FPE_INVALID; /* Should be unreachable. */ + return 0; /* Should be unreachable. */ } } diff --git a/libgfortran/config/fpu-aix.h b/libgfortran/config/fpu-aix.h index aec7756fda5..018b5ec45b5 100644 --- a/libgfortran/config/fpu-aix.h +++ b/libgfortran/config/fpu-aix.h @@ -291,8 +291,6 @@ support_fpu_flag (int flag) } - - int get_fpu_rounding_mode (void) { @@ -321,8 +319,9 @@ get_fpu_rounding_mode (void) case FE_TOWARDZERO: return GFC_FPE_TOWARDZERO; #endif + default: - return GFC_FPE_INVALID; + return 0; /* Should be unreachable. */ } } @@ -357,8 +356,9 @@ set_fpu_rounding_mode (int mode) rnd_mode = FE_TOWARDZERO; break; #endif + default: - return; + return; /* Should be unreachable. */ } fesetround (rnd_mode); @@ -399,7 +399,7 @@ support_fpu_rounding_mode (int mode) #endif default: - return 0; + return 0; /* Should be unreachable. */ } } diff --git a/libgfortran/config/fpu-glibc.h b/libgfortran/config/fpu-glibc.h index 149e8a3ac92..d1d44c09cdb 100644 --- a/libgfortran/config/fpu-glibc.h +++ b/libgfortran/config/fpu-glibc.h @@ -333,8 +333,9 @@ get_fpu_rounding_mode (void) case FE_TOWARDZERO: return GFC_FPE_TOWARDZERO; #endif + default: - return GFC_FPE_INVALID; + return 0; /* Should be unreachable. */ } } @@ -369,8 +370,9 @@ set_fpu_rounding_mode (int mode) rnd_mode = FE_TOWARDZERO; break; #endif + default: - return; + return; /* Should be unreachable. */ } fesetround (rnd_mode); @@ -411,7 +413,7 @@ support_fpu_rounding_mode (int mode) #endif default: - return 0; + return 0; /* Should be unreachable. */ } } diff --git a/libgfortran/config/fpu-sysv.h b/libgfortran/config/fpu-sysv.h index 225f591af72..b098d20d029 100644 --- a/libgfortran/config/fpu-sysv.h +++ b/libgfortran/config/fpu-sysv.h @@ -342,7 +342,7 @@ get_fpu_rounding_mode (void) case FP_RZ: return GFC_FPE_TOWARDZERO; default: - return GFC_FPE_INVALID; + return 0; /* Should be unreachable. */ } } @@ -367,28 +367,16 @@ set_fpu_rounding_mode (int mode) rnd_mode = FP_RZ; break; default: - return; + return; /* Should be unreachable. */ } fpsetround (rnd_mode); } int -support_fpu_rounding_mode (int mode) +support_fpu_rounding_mode (int mode __attribute__((unused))) { - switch (mode) - { - case GFC_FPE_TONEAREST: - return 1; - case GFC_FPE_UPWARD: - return 1; - case GFC_FPE_DOWNWARD: - return 1; - case GFC_FPE_TOWARDZERO: - return 1; - default: - return 0; - } + return 1; } -- 2.11.4.GIT