diff --git a/include/features.h b/include/features.h
index b3277f342cd6..a3f483fa7869 100644
--- a/include/features.h
+++ b/include/features.h
@@ -475,7 +475,9 @@
    safely.  It has been removed from ISO C11 and ISO C++14.  Note: for
    compatibility with various implementations of <cstdio>, this test
    must consider only the value of __cplusplus when compiling C++.  */
-#if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11
+#if (defined __cplusplus			\
+     ? __cplusplus >= 201402L			\
+     : (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L))
 # define __GLIBC_USE_DEPRECATED_GETS 0
 #else
 # define __GLIBC_USE_DEPRECATED_GETS 1
diff --git a/libio/Makefile b/libio/Makefile
index 616107ee105b..836a9dbb70d4 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -258,7 +258,7 @@ CFLAGS-oldtmpfile.c += -fexceptions
 
 # Prevent fortification as these are built with -O0
 CFLAGS-tst-bz24051.c += $(no-fortify-source)
-CFLAGS-tst-bz24153.c += $(no-fortify-source)
+CFLAGS-tst-bz24153.c += $(no-fortify-source) -Wno-deprecated-declarations
 
 CFLAGS-tst_putwc.c += -DOBJPFX=\"$(objpfx)\"
 
