* mingwex/feclearexcept.c (feclearexcept): Change declaration.

Do not return a value.
	* mingwex/fegetexceptflag.c (fegetexceptflag): Likewise.
	* mingwex/feraiseexcept.c (feraiseexcept): Likewise.
	* mingwex/fesetexceptflag.c (fesetexceptflag): Likewise.
	* mingwex/fegetenv.c (fegetenv): Likewise.
	* mingwex/fesetenv.c (fesetenv): Likewise.
	* mingwex/feupdateenv.c (feupdateenv): Likewise.
	* include/fenv.h (feclearexcept, fegetexceptflag, feraiseexcept,
	fesetexceptflag, fegetenv, fesetenv, feupdateenv): Correct
	prototypes.
This commit is contained in:
Danny Smith 2005-08-25 02:35:34 +00:00
parent 03ee0ba163
commit 5092e4a714
8 changed files with 14 additions and 21 deletions

View File

@ -65,10 +65,10 @@ extern "C" {
/*TODO: Some of these could be inlined */
/* 7.6.2 Exception */
extern int __cdecl feclearexcept (int);
extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts);
extern int __cdecl feraiseexcept (int excepts );
extern int __cdecl fesetexceptflag (const fexcept_t *, int);
extern void __cdecl feclearexcept (int);
extern void __cdecl fegetexceptflag (fexcept_t * flagp, int excepts);
extern void __cdecl feraiseexcept (int excepts );
extern void __cdecl fesetexceptflag (const fexcept_t *, int);
extern int __cdecl fetestexcept (int excepts);
/* 7.6.3 Rounding */
@ -78,9 +78,9 @@ extern int __cdecl fesetround (int mode);
/* 7.6.4 Environment */
extern int __cdecl fegetenv (fenv_t * envp);
extern int __cdecl fesetenv (const fenv_t * );
extern int __cdecl feupdateenv (const fenv_t *);
extern void __cdecl fegetenv (fenv_t * envp);
extern void __cdecl fesetenv (const fenv_t * );
extern void __cdecl feupdateenv (const fenv_t *);
extern int __cdecl feholdexcept (fenv_t *);
#ifdef __cplusplus

View File

@ -4,11 +4,10 @@
The feclearexcept function clears the supported exceptions
represented by its argument. */
int feclearexcept (int excepts)
void feclearexcept (int excepts)
{
fenv_t _env;
__asm__ volatile ("fnstenv %0;" : "=m" (_env)); /* get the env */
_env.__status_word &= ~(excepts & FE_ALL_EXCEPT); /* clear the except */
__asm__ volatile ("fldenv %0;" :: "m" (_env)); /*set the env */
return 0;
}

View File

@ -4,9 +4,8 @@
The fegetenv function stores the current floating-point environment
in the object pointed to by envp. */
int fegetenv (fenv_t * envp)
void fegetenv (fenv_t * envp)
{
__asm__ ("fnstenv %0;": "=m" (*envp));
return 0;
}

View File

@ -6,10 +6,9 @@
representation of the exception flags indicated by the argument
excepts in the object pointed to by the argument flagp. */
int fegetexceptflag (fexcept_t * flagp, int excepts)
void fegetexceptflag (fexcept_t * flagp, int excepts)
{
unsigned short _sw;
__asm__ ("fnstsw %%ax;": "=a" (_sw));
*flagp = _sw & excepts & FE_ALL_EXCEPT;
return 0;
}

View File

@ -8,12 +8,11 @@
the inexact exception whenever it raises the overflow
or underflow exception is implementation-defined. */
int feraiseexcept (int excepts)
void feraiseexcept (int excepts)
{
fenv_t _env;
__asm__ volatile ("fnstenv %0;" : "=m" (_env));
_env.__status_word |= excepts & FE_ALL_EXCEPT;
__asm__ volatile ("fldenv %0;"
"fwait;" : : "m" (_env));
return 0;
}

View File

@ -13,7 +13,7 @@
extern void (*_imp___fpreset)( void ) ;
int fesetenv (const fenv_t * envp)
void fesetenv (const fenv_t * envp)
{
if (envp == FE_PC64_ENV)
/*
@ -38,5 +38,4 @@ int fesetenv (const fenv_t * envp)
else
__asm__ ("fldenv %0;" : : "m" (*envp));
return 0;
}

View File

@ -9,7 +9,7 @@
represented by the argument excepts. This function does not raise
exceptions, but only sets the state of the flags. */
int fesetexceptflag (const fexcept_t * flagp, int excepts)
void fesetexceptflag (const fexcept_t * flagp, int excepts)
{
fenv_t _env;
@ -18,5 +18,4 @@ int fesetexceptflag (const fexcept_t * flagp, int excepts)
_env.__status_word &= ~excepts;
_env.__status_word |= (*flagp & excepts);
__asm__ volatile ("fldenv %0;" : : "m" (_env));
return 0;
}

View File

@ -10,11 +10,10 @@
/* FIXME: this works but surely there must be a better way. */
int feupdateenv (const fenv_t * envp)
void feupdateenv (const fenv_t * envp)
{
unsigned int _fexcept = fetestexcept (FE_ALL_EXCEPT); /*save excepts */
fesetenv (envp); /* install the env */
feraiseexcept (_fexcept); /* raise the execept */
return 0;
}