9755 bounds checking functions and types should only be visible if __STDC_WANT_LIB_EXT1__ is set to 1
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Approved by: Joshua M. Clulow <josh@sysmgr.org>
diff --git a/usr/src/head/errno.h b/usr/src/head/errno.h
index 17e6b38..f52fdea 100644
--- a/usr/src/head/errno.h
+++ b/usr/src/head/errno.h
@@ -60,6 +60,14 @@
 #endif
 #endif	/* defined(_REENTRANT) || defined(_TS_ERRNO) */
 
+#if __EXT1_VISIBLE
+/* ISO/IEC 9899:2011 K.3.2.2 */
+#ifndef	_ERRNO_T_DEFINED
+#define	_ERRNO_T_DEFINED
+typedef int errno_t;
+#endif
+#endif	/* __EXT1_VISIBLE */
+
 #ifdef	__cplusplus
 }
 #endif
diff --git a/usr/src/head/iso/stddef_iso.h b/usr/src/head/iso/stddef_iso.h
index f42c104..6e0ac63 100644
--- a/usr/src/head/iso/stddef_iso.h
+++ b/usr/src/head/iso/stddef_iso.h
@@ -95,11 +95,6 @@
 #define	_RSIZE_T_DEFINED
 typedef size_t rsize_t;
 #endif
-/* ISO/IEC 9899:2011 K.3.2.2 */
-#ifndef	_ERRNO_T_DEFINED
-#define	_ERRNO_T_DEFINED
-typedef int errno_t;
-#endif
 #endif	/* __EXT1_VISIBLE */
 
 #ifdef	__cplusplus
diff --git a/usr/src/lib/libc/port/gen/memset_s.c b/usr/src/lib/libc/port/gen/memset_s.c
index 9f3fcf8..c77b02d 100644
--- a/usr/src/lib/libc/port/gen/memset_s.c
+++ b/usr/src/lib/libc/port/gen/memset_s.c
@@ -27,6 +27,8 @@
  * Copyright 2018 Nexenta Systems, Inc.
  */
 
+#define	__STDC_WANT_LIB_EXT1__	1
+
 #include "lint.h"
 
 #include <errno.h>
diff --git a/usr/src/lib/libc/port/gen/set_constraint_handler_s.c b/usr/src/lib/libc/port/gen/set_constraint_handler_s.c
index 3466b8a..2261a8d 100644
--- a/usr/src/lib/libc/port/gen/set_constraint_handler_s.c
+++ b/usr/src/lib/libc/port/gen/set_constraint_handler_s.c
@@ -27,6 +27,8 @@
  * Copyright 2018 Nexenta Systems, Inc.
  */
 
+#define	__STDC_WANT_LIB_EXT1__	1
+
 #include "lint.h"
 
 #include <sys/types.h>
diff --git a/usr/src/test/libc-tests/tests/memset_s.c b/usr/src/test/libc-tests/tests/memset_s.c
index 4a73459..eb44230 100644
--- a/usr/src/test/libc-tests/tests/memset_s.c
+++ b/usr/src/test/libc-tests/tests/memset_s.c
@@ -24,6 +24,7 @@
  */
 
 #include <assert.h>
+#include <errno.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/usr/src/uts/common/sys/feature_tests.h b/usr/src/uts/common/sys/feature_tests.h
index 7e4b4fc..41c0fb2 100644
--- a/usr/src/uts/common/sys/feature_tests.h
+++ b/usr/src/uts/common/sys/feature_tests.h
@@ -437,19 +437,14 @@
 #endif
 
 /* ISO/IEC 9899:2011 Annex K */
-#if !defined(_STRICT_SYMBOLS)
-#define	__EXT1_VISIBLE	1
-#else
-#define	__EXT1_VISIBLE	0
-#endif
-
 #if defined(__STDC_WANT_LIB_EXT1__)
-#undef	__EXT1_VISIBLE
 #if __STDC_WANT_LIB_EXT1__
 #define	__EXT1_VISIBLE		1
 #else
 #define	__EXT1_VISIBLE		0
 #endif
+#else
+#define	__EXT1_VISIBLE		0
 #endif /* __STDC_WANT_LIB_EXT1__ */
 
 /*