>From 826a16e3da3d42454417e433774dda6e5003ad04 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 5 Jan 2020 09:13:25 +0100 Subject: [PATCH] tests: Avoid GCC over-optimization caused by _GL_ARG_NONNULL attributes. Reported by Jim Meyering in . * tests/test-canonicalize.c (_GL_ARG_NONNULL): Define to empty. * tests/test-canonicalize-lgpl.c (_GL_ARG_NONNULL): Likewise. * tests/test-ptsname_r.c (_GL_ARG_NONNULL): Likewise. --- ChangeLog | 9 +++++++++ tests/test-canonicalize-lgpl.c | 5 +++++ tests/test-canonicalize.c | 5 +++++ tests/test-ptsname_r.c | 5 +++++ 4 files changed, 24 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6d9ea9e..556549c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2020-01-05 Bruno Haible + + tests: Avoid GCC over-optimization caused by _GL_ARG_NONNULL attributes. + Reported by Jim Meyering in + . + * tests/test-canonicalize.c (_GL_ARG_NONNULL): Define to empty. + * tests/test-canonicalize-lgpl.c (_GL_ARG_NONNULL): Likewise. + * tests/test-ptsname_r.c (_GL_ARG_NONNULL): Likewise. + 2020-01-04 Bruno Haible mbsnrtoc32s: Add tests. diff --git a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c index b46ad87..2c743af 100644 --- a/tests/test-canonicalize-lgpl.c +++ b/tests/test-canonicalize-lgpl.c @@ -16,6 +16,11 @@ /* Written by Bruno Haible , 2007. */ +/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc + may "optimize" the null_ptr function, when its result gets passed to a + function that has an argument declared as _GL_ARG_NONNULL. */ +#define _GL_ARG_NONNULL(params) + #include #include diff --git a/tests/test-canonicalize.c b/tests/test-canonicalize.c index e7138a6..1df3092 100644 --- a/tests/test-canonicalize.c +++ b/tests/test-canonicalize.c @@ -16,6 +16,11 @@ /* Written by Bruno Haible , 2007. */ +/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc + may "optimize" the null_ptr function, when its result gets passed to a + function that has an argument declared as _GL_ARG_NONNULL. */ +#define _GL_ARG_NONNULL(params) + #include #include "canonicalize.h" diff --git a/tests/test-ptsname_r.c b/tests/test-ptsname_r.c index 19e33ea..9e1471c 100644 --- a/tests/test-ptsname_r.c +++ b/tests/test-ptsname_r.c @@ -14,6 +14,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc + may "optimize" the null_ptr function, when its result gets passed to a + function that has an argument declared as _GL_ARG_NONNULL. */ +#define _GL_ARG_NONNULL(params) + #include #include -- 2.7.4