mirror of git://gcc.gnu.org/git/gcc.git
fpu-387.h, [...]: Use static assertions.
* config/fpu-387.h, config/fpu-aix.h, config/fpu-sysv.h, config/fpu-glibc.h: Use static assertions. From-SVN: r212323
This commit is contained in:
parent
1b38fe0e93
commit
a709346f06
|
|
@ -1,3 +1,8 @@
|
||||||
|
2014-07-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
||||||
|
|
||||||
|
* config/fpu-387.h, config/fpu-aix.h, config/fpu-sysv.h,
|
||||||
|
config/fpu-glibc.h: Use static assertions.
|
||||||
|
|
||||||
2014-07-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
2014-07-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
* configure, config.h.in: Regenerate.
|
* configure, config.h.in: Regenerate.
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ a copy of the GCC Runtime Library Exception along with this program;
|
||||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#ifndef __SSE_MATH__
|
#ifndef __SSE_MATH__
|
||||||
#include "cpuid.h"
|
#include "cpuid.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -85,6 +83,11 @@ typedef struct
|
||||||
my_fenv_t;
|
my_fenv_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Check we can actually store the FPU state in the allocated size. */
|
||||||
|
_Static_assert (sizeof(my_fenv_t) <= (size_t) GFC_FPE_STATE_BUFFER_SIZE,
|
||||||
|
"GFC_FPE_STATE_BUFFER_SIZE is too small");
|
||||||
|
|
||||||
|
|
||||||
/* Raise the supported floating-point exceptions from EXCEPTS. Other
|
/* Raise the supported floating-point exceptions from EXCEPTS. Other
|
||||||
bits in EXCEPTS are ignored. Code originally borrowed from
|
bits in EXCEPTS are ignored. Code originally borrowed from
|
||||||
libatomic/config/x86/fenv.c. */
|
libatomic/config/x86/fenv.c. */
|
||||||
|
|
@ -429,9 +432,6 @@ get_fpu_state (void *state)
|
||||||
{
|
{
|
||||||
my_fenv_t *envp = state;
|
my_fenv_t *envp = state;
|
||||||
|
|
||||||
/* Check we can actually store the FPU state in the allocated size. */
|
|
||||||
assert (sizeof(my_fenv_t) <= (size_t) GFC_FPE_STATE_BUFFER_SIZE);
|
|
||||||
|
|
||||||
__asm__ __volatile__ ("fnstenv\t%0" : "=m" (*envp));
|
__asm__ __volatile__ ("fnstenv\t%0" : "=m" (*envp));
|
||||||
|
|
||||||
/* fnstenv has the side effect of masking all exceptions, so we need
|
/* fnstenv has the side effect of masking all exceptions, so we need
|
||||||
|
|
@ -447,9 +447,6 @@ set_fpu_state (void *state)
|
||||||
{
|
{
|
||||||
my_fenv_t *envp = state;
|
my_fenv_t *envp = state;
|
||||||
|
|
||||||
/* Check we can actually store the FPU state in the allocated size. */
|
|
||||||
assert (sizeof(my_fenv_t) <= (size_t) GFC_FPE_STATE_BUFFER_SIZE);
|
|
||||||
|
|
||||||
/* glibc sources (sysdeps/x86_64/fpu/fesetenv.c) do something more
|
/* glibc sources (sysdeps/x86_64/fpu/fesetenv.c) do something more
|
||||||
complex than this, but I think it suffices in our case. */
|
complex than this, but I think it suffices in our case. */
|
||||||
__asm__ __volatile__ ("fldenv\t%0" : : "m" (*envp));
|
__asm__ __volatile__ ("fldenv\t%0" : : "m" (*envp));
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Check we can actually store the FPU state in the allocated size. */
|
||||||
|
_Static_assert (sizeof(fenv_t) <= (size_t) GFC_FPE_STATE_BUFFER_SIZE,
|
||||||
|
"GFC_FPE_STATE_BUFFER_SIZE is too small");
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
set_fpu_trap_exceptions (int trap, int notrap)
|
set_fpu_trap_exceptions (int trap, int notrap)
|
||||||
{
|
{
|
||||||
|
|
@ -403,18 +408,12 @@ support_fpu_rounding_mode (int mode)
|
||||||
void
|
void
|
||||||
get_fpu_state (void *state)
|
get_fpu_state (void *state)
|
||||||
{
|
{
|
||||||
/* Check we can actually store the FPU state in the allocated size. */
|
|
||||||
assert (sizeof(fenv_t) <= GFC_FPE_STATE_BUFFER_SIZE);
|
|
||||||
|
|
||||||
fegetenv (state);
|
fegetenv (state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
set_fpu_state (void *state)
|
set_fpu_state (void *state)
|
||||||
{
|
{
|
||||||
/* Check we can actually store the FPU state in the allocated size. */
|
|
||||||
assert (sizeof(fenv_t) <= GFC_FPE_STATE_BUFFER_SIZE);
|
|
||||||
|
|
||||||
fesetenv (state);
|
fesetenv (state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,13 +27,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||||
feenableexcept function in fenv.h to set individual exceptions
|
feenableexcept function in fenv.h to set individual exceptions
|
||||||
(there's nothing to do that in C99). */
|
(there's nothing to do that in C99). */
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_FENV_H
|
#ifdef HAVE_FENV_H
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Check we can actually store the FPU state in the allocated size. */
|
||||||
|
_Static_assert (sizeof(fenv_t) <= (size_t) GFC_FPE_STATE_BUFFER_SIZE,
|
||||||
|
"GFC_FPE_STATE_BUFFER_SIZE is too small");
|
||||||
|
|
||||||
|
|
||||||
void set_fpu_trap_exceptions (int trap, int notrap)
|
void set_fpu_trap_exceptions (int trap, int notrap)
|
||||||
{
|
{
|
||||||
#ifdef FE_INVALID
|
#ifdef FE_INVALID
|
||||||
|
|
@ -416,9 +419,6 @@ support_fpu_rounding_mode (int mode)
|
||||||
void
|
void
|
||||||
get_fpu_state (void *state)
|
get_fpu_state (void *state)
|
||||||
{
|
{
|
||||||
/* Check we can actually store the FPU state in the allocated size. */
|
|
||||||
assert (sizeof(fenv_t) <= GFC_FPE_STATE_BUFFER_SIZE);
|
|
||||||
|
|
||||||
fegetenv (state);
|
fegetenv (state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -426,9 +426,6 @@ get_fpu_state (void *state)
|
||||||
void
|
void
|
||||||
set_fpu_state (void *state)
|
set_fpu_state (void *state)
|
||||||
{
|
{
|
||||||
/* Check we can actually store the FPU state in the allocated size. */
|
|
||||||
assert (sizeof(fenv_t) <= GFC_FPE_STATE_BUFFER_SIZE);
|
|
||||||
|
|
||||||
fesetenv (state);
|
fesetenv (state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||||
|
|
||||||
/* FPU-related code for SysV platforms with fpsetmask(). */
|
/* FPU-related code for SysV platforms with fpsetmask(). */
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
/* BSD and Solaris systems have slightly different types and functions
|
/* BSD and Solaris systems have slightly different types and functions
|
||||||
naming. We deal with these here, to simplify the code below. */
|
naming. We deal with these here, to simplify the code below. */
|
||||||
|
|
||||||
|
|
@ -444,14 +442,16 @@ typedef struct
|
||||||
} fpu_state_t;
|
} fpu_state_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Check we can actually store the FPU state in the allocated size. */
|
||||||
|
_Static_assert (sizeof(fpu_state_t) <= (size_t) GFC_FPE_STATE_BUFFER_SIZE,
|
||||||
|
"GFC_FPE_STATE_BUFFER_SIZE is too small");
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
get_fpu_state (void *s)
|
get_fpu_state (void *s)
|
||||||
{
|
{
|
||||||
fpu_state_t *state = s;
|
fpu_state_t *state = s;
|
||||||
|
|
||||||
/* Check we can actually store the FPU state in the allocated size. */
|
|
||||||
assert (sizeof(fpu_state_t) <= GFC_FPE_STATE_BUFFER_SIZE);
|
|
||||||
|
|
||||||
state->mask = fpgetmask ();
|
state->mask = fpgetmask ();
|
||||||
state->sticky = fpgetsticky ();
|
state->sticky = fpgetsticky ();
|
||||||
state->round = fpgetround ();
|
state->round = fpgetround ();
|
||||||
|
|
@ -462,9 +462,6 @@ set_fpu_state (void *s)
|
||||||
{
|
{
|
||||||
fpu_state_t *state = s;
|
fpu_state_t *state = s;
|
||||||
|
|
||||||
/* Check we can actually store the FPU state in the allocated size. */
|
|
||||||
assert (sizeof(fpu_state_t) <= GFC_FPE_STATE_BUFFER_SIZE);
|
|
||||||
|
|
||||||
fpsetmask (state->mask);
|
fpsetmask (state->mask);
|
||||||
FPSETSTICKY (state->sticky);
|
FPSETSTICKY (state->sticky);
|
||||||
fpsetround (state->round);
|
fpsetround (state->round);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue