[PATCH v2 2/2] break fenv.c file to function files

Eshan Dhawan eshandhawan51 at gmail.com
Mon Jul 27 06:11:32 UTC 2020


> On 27-Jul-2020, at 10:19 AM, Sebastian Huber <sebastian.huber at embedded-brains.de> wrote:
> 
> On 25/07/2020 19:15, Eshan dhawan wrote:
> 
>> Signed-off-by: Eshan dhawan <eshandhawan51 at gmail.com>
>> ---
>>  newlib/libc/machine/arm/sys/fenv.h        |   8 +
>>  newlib/libm/machine/arm/Makefile.am       |   6 +-
>>  newlib/libm/machine/arm/Makefile.in       |  34 +++-
>>  newlib/libm/machine/arm/fe_dfl_env.c      |  38 +++-
>>  newlib/libm/machine/arm/feclearexcept.c   |  45 ++++-
>>  newlib/libm/machine/arm/fedisableexcept.c |  47 +++++
>>  newlib/libm/machine/arm/feenableexcept.c  |  48 +++++
>>  newlib/libm/machine/arm/fegetenv.c        |  42 +++-
>>  newlib/libm/machine/arm/fegetexcept.c     |  44 +++++
>>  newlib/libm/machine/arm/fegetexceptflag.c |  46 ++++-
>>  newlib/libm/machine/arm/fegetround.c      |  49 ++++-
>>  newlib/libm/machine/arm/feholdexcept.c    |  47 ++++-
>>  newlib/libm/machine/arm/fenv.c            | 223 ----------------------
>>  newlib/libm/machine/arm/feraiseexcept.c   |  44 ++++-
>>  newlib/libm/machine/arm/fesetenv.c        |  43 ++++-
>>  newlib/libm/machine/arm/fesetexceptflag.c |  47 ++++-
>>  newlib/libm/machine/arm/fesetround.c      |  46 ++++-
>>  newlib/libm/machine/arm/fetestexcept.c    |  45 ++++-
>>  newlib/libm/machine/arm/feupdateenv.c     |  50 ++++-
>>  19 files changed, 670 insertions(+), 282 deletions(-)
>>  create mode 100644 newlib/libm/machine/arm/fedisableexcept.c
>>  create mode 100644 newlib/libm/machine/arm/feenableexcept.c
>>  create mode 100644 newlib/libm/machine/arm/fegetexcept.c
>>  delete mode 100644 newlib/libm/machine/arm/fenv.c
>> 
>> diff --git a/newlib/libc/machine/arm/sys/fenv.h b/newlib/libc/machine/arm/sys/fenv.h
>> index 70bd57be4..8712b2f33 100644
>> --- a/newlib/libc/machine/arm/sys/fenv.h
>> +++ b/newlib/libc/machine/arm/sys/fenv.h
>> @@ -62,6 +62,14 @@ typedef int fexcept_t;
>>  #define    FE_DOWNWARD        0x00800000
>>  #define    FE_TOWARDZERO        0x00c00000
>>  +#ifndef __SOFTFP__
>> +#define    vmrs_fpscr(__r)    __asm __volatile("vmrs %0, fpscr" : "=&r"(__r))
>> +#define    vmsr_fpscr(__r)    __asm __volatile("vmsr fpscr, %0" : : "r"(__r))
>> +#define    _FPU_MASK_SHIFT    8
>> +#define    _ROUND_MASK    (FE_TONEAREST | FE_DOWNWARD | \
>> +             FE_UPWARD | FE_TOWARDZERO)
>> +#endif
>> +
> 
> I would still prefer to have this in an internal header file "newlib/libm/machine/arm/_fenv.h" which is included via #include "_fenv.h".
> 
> If you really want to have it visible via <fenv.h>, then the vm*() should at least be renamed to _vmrs_fpscr() and _vmsr_fpscr().
> 
I am not able to get you point could you provide a little detail 
I understood that you are saying that create an alternative _fenv.h in machine/arm in libm.
But I am not able to understand why. 
If the symbols are visible with fenv.h than does that cause any issues? 
Or how does renaming them causes any change? 
>> [...]
>> diff --git a/newlib/libm/machine/arm/fe_dfl_env.c b/newlib/libm/machine/arm/fe_dfl_env.c
>> index 8cbee7771..07aee8e7c 100644
>> --- a/newlib/libm/machine/arm/fe_dfl_env.c
>> +++ b/newlib/libm/machine/arm/fe_dfl_env.c
>> @@ -1,7 +1,37 @@
>> -/*
>> - * SPDX-License-Identifier: BSD-2-Clause
>> +/*-
>> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>>   *
>> - * (c) Copyright 2019 Joel Sherrill <joel at rtems.org>
>> + * Copyright (c) 2004-2005 David Schultz <das at FreeBSD.ORG>
>> + * Copyright (c) 2013 Andrew Turner <andrew at FreeBSD.ORG>
>> + * All rights reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> + * are met:
>> + * 1. Redistributions of source code must retain the above copyright
>> + *    notice, this list of conditions and the following disclaimer.
>> + * 2. Redistributions in binary form must reproduce the above copyright
>> + *    notice, this list of conditions and the following disclaimer in the
>> + *    documentation and/or other materials provided with the distribution.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
>> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
>> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
>> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
>> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
>> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
>> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
>> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>> + * SUCH DAMAGE.
>> + *
>> + * $FreeBSD$
>>   */
>>  -#include "../../fenv/fenv_stub.c"
>> +#include <fenv.h>
>> +
>> +  fenv_t __fe_dfl_env = { 0 };
>> +
>> +  const fenv_t *_fe_dfl_env = &__fe_dfl_env;
>> +
> 
> Why indent?
> 
> There is a blank line at the end of the file. Please remove the blank line at the end of all files from this patch.
I will correct that :)


More information about the devel mailing list