pkarashchenko commented on code in PR #8824: URL: https://github.com/apache/nuttx/pull/8824#discussion_r1141768359
########## libs/libm/newlib/0001-newlib-libm-fix-NAN-redefined-if-enable-enable-newli.patch: ########## @@ -0,0 +1,70 @@ +From 5aabcba27177c66a58f21c8d20bb133d005f36d2 Mon Sep 17 00:00:00 2001 +From: chao an <anc...@xiaomi.com> +Date: Tue, 14 Mar 2023 23:38:30 +0800 +Subject: [PATCH] newlib/libm: fix NAN redefined if enable + --enable-newlib-hw-fp + +In file included from newlib/newlib/newlib/libm/mathfp/s_tan.c:52: +newlib/newlib/newlib/libm/mathfp/zmath.h:7: warning: "NAN" redefined + 7 | #define NAN 2 + | +In file included from newlib/newlib/newlib/libm/common/fdlibm.h:15, + from newlib/newlib/newlib/libm/mathfp/s_tan.c:51: +/home/archer/code/nuttx/n5/incubator-nuttx/libs/libm/newlib/include/math.h:58: note: this is the location of the previous definition + 58 | # define NAN (__builtin_nanf("")) + | + +Signed-off-by: chao an <anc...@xiaomi.com> +--- + newlib/libm/common/math_config.h | 16 ++++++++++++---- + newlib/libm/mathfp/zmath.h | 5 ++++- + 2 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/newlib/libm/common/math_config.h newlib/newlib/newlib/libm/common/math_config.h +index 0f78b5c09..9116c754f 100644 +--- a/newlib/libm/common/math_config.h ++++ newlib/newlib/newlib/libm/common/math_config.h +@@ -253,12 +253,20 @@ eval_as_double (double x) + Review Comment: should we add `#include <nuttx/compiler.h>`? ########## libs/libm/newlib/include/ieeefp.h: ########## @@ -0,0 +1,287 @@ +/**************************************************************************** + * libs/libm/newlib/include/ieeefp.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __LIBS_LIBM_NEWLIB_INCLUDE_IEEEFP_H +#define __LIBS_LIBM_NEWLIB_INCLUDE_IEEEFP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "_ansi.h" + +#include <machine/ieeefp.h> +#include <float.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +#ifdef __IEEE_BIG_ENDIAN Review Comment: Where `__IEEE_BIG_ENDIAN` is defined? ########## libs/libm/newlib/include/_newlib_version.h: ########## @@ -0,0 +1,33 @@ +/**************************************************************************** + * libs/libm/newlib/include/_newlib_version.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __LIBS_LIBM_NEWLIB_INCLUDE__NEWLIB_VERSION_H +#define __LIBS_LIBM_NEWLIB_INCLUDE__NEWLIB_VERSION_H + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define _NEWLIB_VERSION "4.3.0" +#define __NEWLIB__ 4 +#define __NEWLIB_MINOR__ 3 +#define __NEWLIB_PATCHLEVEL__ 0 Review Comment: Maybe we can `-D` this from `libs/libm/newlib/Make.defs`? Or this file is needed inside the newly code? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org