You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by li...@apache.org on 2024/10/11 13:39:28 UTC

(nuttx-apps) branch revert-2679-remove_gccver created (now ce56c6c01)

This is an automated email from the ASF dual-hosted git repository.

ligd pushed a change to branch revert-2679-remove_gccver
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


      at ce56c6c01 Revert "libuv: Remove GCCVER and add compilation options directly."

This branch includes the following new commits:

     new ce56c6c01 Revert "libuv: Remove GCCVER and add compilation options directly."

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(nuttx-apps) 01/01: Revert "libuv: Remove GCCVER and add compilation options directly."

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ligd pushed a commit to branch revert-2679-remove_gccver
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit ce56c6c010e12dd9be93dc2be4b1534be48e1795
Author: GUIDINGLI <49...@users.noreply.github.com>
AuthorDate: Fri Oct 11 21:39:23 2024 +0800

    Revert "libuv: Remove GCCVER and add compilation options directly."
    
    This reverts commit 13ce4707ffbf4bfb28b7a81b29c7adfeb917042b.
---
 system/libuv/CMakeLists.txt | 16 ++++++++++++----
 system/libuv/Makefile       |  9 ++++++++-
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/system/libuv/CMakeLists.txt b/system/libuv/CMakeLists.txt
index 60a389cc2..205eeae7c 100644
--- a/system/libuv/CMakeLists.txt
+++ b/system/libuv/CMakeLists.txt
@@ -44,15 +44,23 @@ if(CONFIG_LIBUV)
     endif()
   endif()
 
+  if(NOT DEFINED GCCVER)
+    execute_process(COMMAND ${CMAKE_C_COMPILER} --version
+                    OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
+    string(REGEX MATCH "\\+\\+.* ([0-9]+)\\.[0-9]+" GCC_VERSION_REGEX
+                 "${GCC_VERSION_OUTPUT}")
+    set(GCCVER ${CMAKE_MATCH_1})
+  endif()
   # ############################################################################
   # Flags
   # ############################################################################
 
-  set(CFLAGS
-      -Wno-shadow -Wno-dangling-pointer
-      -DDEF_THREADPOOL_SIZE=CONFIG_LIBUV_THREADPOOL_SIZE
-      -DDEF_THREADPOOL_STACKSIZE=CONFIG_LIBUV_THREAD_STACKSIZE)
+  set(CFLAGS -Wno-shadow -DDEF_THREADPOOL_SIZE=CONFIG_LIBUV_THREADPOOL_SIZE
+             -DDEF_THREADPOOL_STACKSIZE=CONFIG_LIBUV_THREAD_STACKSIZE)
 
+  if(GCCVER EQUAL 12)
+    list(APPEND CFLAGS -Wno-dangling-pointer)
+  endif()
   # ############################################################################
   # Sources
   # ############################################################################
diff --git a/system/libuv/Makefile b/system/libuv/Makefile
index d0adbc4d9..bb2b50bcc 100644
--- a/system/libuv/Makefile
+++ b/system/libuv/Makefile
@@ -49,10 +49,17 @@ CFLAGS += -I$(LIBUV_UNPACK)/src
 CFLAGS += -I$(LIBUV_UNPACK)/src/unix
 CFLAGS += -I$(LIBUV_UNPACK)/test
 CFLAGS += -Wno-shadow
-CFLAGS += -Wno-dangling-pointer
 CFLAGS += -DDEF_THREADPOOL_SIZE=CONFIG_LIBUV_THREADPOOL_SIZE
 CFLAGS += -DDEF_THREADPOOL_STACKSIZE=CONFIG_LIBUV_THREAD_STACKSIZE
 
+ifeq ($(GCCVER),)
+  export GCCVER = $(shell $(CC) --version | grep gcc | sed -r 's/.* ([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
+endif
+
+ifeq ($(GCCVER),12)
+  CFLAGS += -Wno-dangling-pointer
+endif
+
 VPATH += $(LIBUV_UNPACK)/src
 VPATH += $(LIBUV_UNPACK)/src/unix
 VPATH += $(LIBUV_UNPACK)/test