[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] test-open: port to cygwin, which lacks Fortify
From: |
Eric Blake |
Subject: |
[PATCH] test-open: port to cygwin, which lacks Fortify |
Date: |
Wed, 30 Jul 2014 17:23:08 -0600 |
On cygwin, with gcc 4.8.3, I get this compilation warning:
In file included from ../../gltests/test-open.c:35:0:
../../gltests/test-open.h:35:1: warning: always_inline function might not be
inlinable [-Wattributes]
test_open (int (*func) (char const *, int, ...), bool print)
^
On that platform, there are no Fortify enhancements, and the
internal macro __always_inline is always defined to turn on the
gcc attribute, contrary to our needs. Since relying on a __
prefix is already risky, it's better to limit the workaround of
commit d6ba92ea to just glibc.
* tests/test-open.h (ALWAYS_INLINE): New macro.
(__always_inline): Don't abuse internal symbol on non-glibc.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 4 ++++
tests/test-open.h | 8 +++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 62025f2..5eb94db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2014-07-30 Eric Blake <address@hidden>
+ test-open: port to cygwin, which lacks Fortify
+ * tests/test-open.h (ALWAYS_INLINE): New macro.
+ (__always_inline): Don't abuse internal symbol on non-glibc.
+
openat-die: use _Noreturn markup
* modules/openat-die (Depends-on): Add stdnoreturn.
* lib/openat-die.c (openat_save_fail, openat_restore_fail): Mark
diff --git a/tests/test-open.h b/tests/test-open.h
index d7bd5af..0dfcb79 100644
--- a/tests/test-open.h
+++ b/tests/test-open.h
@@ -21,8 +21,10 @@
around a glibc bug whereby 'open' cannot be used as a function
pointer when _FORTIFY_SOURCE is positive. */
-#ifndef __always_inline
-#define __always_inline
+#if _LIBC && defined __always_inline
+# define ALWAYS_INLINE __always_inline
+#else
+# define ALWAYS_INLINE
#endif
/* This file is designed to test both open(n,buf[,mode]) and
@@ -31,7 +33,7 @@
appropriate headers are already included. If PRINT, warn before
skipping symlink tests with status 77. */
-static __always_inline int
+static ALWAYS_INLINE int
test_open (int (*func) (char const *, int, ...), bool print)
{
int fd;
--
1.9.3