]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - tools/include/linux/string.h
tools lib: Fix builds when glibc contains strlcpy()
[mirror_ubuntu-bionic-kernel.git] / tools / include / linux / string.h
index 6c3e2cc274c5546ce64709e444701bdec582390b..0ec646f127dc6b63686920b880e5ea2eda6b077c 100644 (file)
@@ -14,7 +14,15 @@ int strtobool(const char *s, bool *res);
  * However uClibc headers also define __GLIBC__ hence the hack below
  */
 #if defined(__GLIBC__) && !defined(__UCLIBC__)
+// pragma diagnostic was introduced in gcc 4.6
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+#endif
 extern size_t strlcpy(char *dest, const char *src, size_t size);
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#pragma GCC diagnostic pop
+#endif
 #endif
 
 char *str_error_r(int errnum, char *buf, size_t buflen);