# HG changeset patch # User Paul Eggert # Date 1386264140 28800 # Node ID 741e229f177058a7db8450c0ae5f7a2ece473c4d # Parent 014625970f68c4d4074ec417e93e4ef738d19101 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. diff -r 014625970f68 -r 741e229f1770 ChangeLog --- a/ChangeLog Wed Dec 04 10:00:00 2013 -0700 +++ b/ChangeLog Thu Dec 05 09:22:20 2013 -0800 @@ -1,3 +1,12 @@ +2013-12-05 Paul Eggert + + 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 include_next: minimize code duplication diff -r 014625970f68 -r 741e229f1770 tests/test-open.h --- a/tests/test-open.h Wed Dec 04 10:00:00 2013 -0700 +++ b/tests/test-open.h Thu Dec 05 09:22:20 2013 -0800 @@ -16,13 +16,22 @@ /* Written by Bruno Haible , 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;