]> Savannah Git Hosting - gnulib.git/commitdiff
open-tests: port to glibc with _FORTIFY_SOURCE and -O1
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 5 Dec 2013 17:22:20 +0000 (09:22 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 5 Dec 2013 17:22:40 +0000 (09:22 -0800)
Problem reported by Daiki Ueno in:
http://lists.gnu.org/archive/html/bug-gnulib/2013-06/msg00052.html
* tests/test-open.h (__always_inline):
New macro, if not already defined.
(test_open): Use it.

ChangeLog
tests/test-open.h

index cdf69fa96b14b95ed39c218f15ec4a129c53963f..1f2b13cdbf6a3fe35bca6d01ffee4cadcd13c132 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-12-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+       open-tests: port to glibc with _FORTIFY_SOURCE and -O1
+       Problem reported by Daiki Ueno in:
+       http://lists.gnu.org/archive/html/bug-gnulib/2013-06/msg00052.html
+       * tests/test-open.h (__always_inline):
+       New macro, if not already defined.
+       (test_open): Use it.
+
 2013-12-04  Eric Blake  <eblake@redhat.com>
 
        include_next: minimize code duplication
index babb23907d2a87a03d06ee8fce7ea00ed9e3cd51..ff44b3e83e0aa390909d6a605901b0fed995f147 100644 (file)
 
 /* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
 
+/* Make test_open always inline if we're using Fortify, which defines
+   __always_inline to do that.  Do nothing otherwise.  This works
+   around a glibc bug whereby 'open' cannot be used as a function
+   pointer when _FORTIFY_SOURCE is positive.  */
+
+#ifndef __always_inline
+#define __always_inline
+#endif
+
 /* This file is designed to test both open(n,buf[,mode]) and
    openat(AT_FDCWD,n,buf[,mode]).  FUNC is the function to test.
    Assumes that BASE and ASSERT are already defined, and that
    appropriate headers are already included.  If PRINT, warn before
    skipping symlink tests with status 77.  */
 
-static int
+static int __always_inline
 test_open (int (*func) (char const *, int, ...), bool print)
 {
   int fd;