[PATCH v2 12/16] errno: stub out perror/strerror API when built for PBL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To optimize out calls to undefined functions in PBL at compile-time
instead of link time, let's define stubs for the functions that
are referenced in obj-pbl-y files, but inside function sections
that are ultimately unreferenced.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 include/errno.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/errno.h b/include/errno.h
index 12e526a0d7ed..fd358e1c1103 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -7,8 +7,18 @@
 
 extern int errno;
 
+#if IN_PROPER
 void perror(const char *s);
 const char *strerror(int errnum);
+#else
+static inline void perror(const char *s)
+{
+}
+static inline const char *strerror(int errnum)
+{
+	return "unknown error";
+}
+#endif
 
 static inline int errno_set(int err)
 {
-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux