about summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-02-08 15:46:21 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-02-27 10:52:59 -0300
commit86889e22db329abac618c6a41f86c84657a15324 (patch)
tree44cd2f7b8f61f93cc72cf5f2107fd90ad0c87391 /misc
parent68444c045077368446eced143510419c901e31b1 (diff)
downloadglibc-86889e22db329abac618c6a41f86c84657a15324.tar.gz
glibc-86889e22db329abac618c6a41f86c84657a15324.tar.xz
glibc-86889e22db329abac618c6a41f86c84657a15324.zip
debug: Improve fcntl.h fortify warnings with clang
It improves open, open64, openat, and openat64.  The compile and runtime
checks have similar coverage as with GCC.

Checked on aarch64, armhf, x86_64, and i686.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'misc')
-rw-r--r--misc/sys/cdefs.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 62507044c8..6b03417453 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -257,7 +257,9 @@
 
 # define __fortify_clang_warning(__c, __msg) \
   __attribute__ ((__diagnose_if__ ((__c), (__msg), "warning")))
-# define __fortify_clang_warning_only_if_bos0_lt(n, buf, complaint) \
+#  define __fortify_clang_error(__c, __msg) \
+  __attribute__ ((__diagnose_if__ ((__c), (__msg), "error")))
+#  define __fortify_clang_warning_only_if_bos0_lt(n, buf, complaint) \
   __attribute__ ((__diagnose_if__ \
 		  (__fortify_clang_bosn_args (__bos0, n, buf, 1, complaint))))
 # define __fortify_clang_warning_only_if_bos0_lt2(n, buf, div, complaint) \
@@ -270,6 +272,11 @@
   __attribute__ ((__diagnose_if__ \
 		  (__fortify_clang_bosn_args (__bos, n, buf, div, complaint))))
 
+#  define __fortify_clang_prefer_this_overload \
+  __attribute__ ((enable_if (1, "")))
+#  define __fortify_clang_unavailable(__msg) \
+  __attribute__ ((unavailable(__msg)))
+
 # if __USE_FORTIFY_LEVEL == 3
 #  define __fortify_clang_overload_arg(__type, __attr, __name) \
   __type __attr const __fortify_clang_pass_dynamic_object_size __name