You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/07/08 11:07:31 UTC

[incubator-nuttx] branch master updated: libc: Always declare getenv, link/symlink and atexit/on_exit

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

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 1bca457  libc: Always declare getenv, link/symlink and atexit/on_exit
1bca457 is described below

commit 1bca457b283d713ca5fec849ffe3aefd08c7ef69
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Jul 6 21:06:43 2020 +0800

    libc: Always declare getenv, link/symlink and atexit/on_exit
    
    since many c++ library implementation reference these symbols by using ::xxx but never
    really use them, the declaration avoid the unused code is pulled into the final binary
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: Idd7bf9a1e09b77a6b21f900cd3ede08a1cc82d86
---
 include/cxx/cstdlib | 6 ------
 include/cxx/cunistd | 4 +---
 include/stdlib.h    | 6 ------
 include/unistd.h    | 3 ---
 4 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/include/cxx/cstdlib b/include/cxx/cstdlib
index ba2add7..694d33e 100644
--- a/include/cxx/cstdlib
+++ b/include/cxx/cstdlib
@@ -40,7 +40,6 @@ namespace std
   using ::rand;
   using ::random;
 
-#ifndef CONFIG_DISABLE_ENVIRON
   // Environment variable support
 
   using ::get_environ_ptr;
@@ -49,18 +48,13 @@ namespace std
   using ::clearenv;
   using ::setenv;
   using ::unsetenv;
-#endif
 
   // Process exit functions
 
   using ::exit;
   using ::abort;
-#ifdef CONFIG_SCHED_ATEXIT
   using ::atexit;
-#endif
-#ifdef CONFIG_SCHED_ONEXIT
   using ::on_exit;
-#endif
 
 #ifndef __KERNEL__
   // System command
diff --git a/include/cxx/cunistd b/include/cxx/cunistd
index 5c792a7..5ea58cf 100644
--- a/include/cxx/cunistd
+++ b/include/cxx/cunistd
@@ -94,10 +94,8 @@ namespace std
   using ::access;
   using ::rmdir;
   using ::unlink;
-#ifdef CONFIG_PSEUDOFS_SOFTLINKS
-  using ::link;
+  using ::symlink;
   using ::readlink;
-#endif
 
   // Execution of program files
 
diff --git a/include/stdlib.h b/include/stdlib.h
index cfe44f4..fd6df08 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -121,7 +121,6 @@ int       rand(void);
 #define   srandom(s) srand(s)
 long      random(void);
 
-#ifndef CONFIG_DISABLE_ENVIRON
 /* Environment variable support */
 
 FAR char **get_environ_ptr(void);
@@ -130,18 +129,13 @@ int       putenv(FAR const char *string);
 int       clearenv(void);
 int       setenv(FAR const char *name, FAR const char *value, int overwrite);
 int       unsetenv(FAR const char *name);
-#endif
 
 /* Process exit functions */
 
 void      exit(int status) noreturn_function;
 void      abort(void) noreturn_function;
-#ifdef CONFIG_SCHED_ATEXIT
 int       atexit(CODE void (*func)(void));
-#endif
-#ifdef CONFIG_SCHED_ONEXIT
 int       on_exit(CODE void (*func)(int, FAR void *), FAR void *arg);
-#endif
 
 /* _Exit() is a stdlib.h equivalent to the unistd.h _exit() function */
 
diff --git a/include/unistd.h b/include/unistd.h
index 3c3742f..4a86e56 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -357,11 +357,8 @@ int     access(FAR const char *path, int amode);
 int     rmdir(FAR const char *pathname);
 int     unlink(FAR const char *pathname);
 int     truncate(FAR const char *path, off_t length);
-
-#ifdef CONFIG_PSEUDOFS_SOFTLINKS
 int     symlink(FAR const char *path1, FAR const char *path2);
 ssize_t readlink(FAR const char *path, FAR char *buf, size_t bufsize);
-#endif
 
 /* Execution of programs from files */