svn commit: r281861 - head/sys/sys
Pedro F. Giffuni
pfg at FreeBSD.org
Wed Apr 22 18:13:29 UTC 2015
Author: pfg
Date: Wed Apr 22 18:13:28 2015
New Revision: 281861
URL: https://svnweb.freebsd.org/changeset/base/281861
Log:
Add definition for the argument_with_type_tag attribute.
This attribute originates in clang and brings support for checking types
of variadic functions' arguments for functions like fcntl() and ioctl().
Unfortunately lint(1) will complain about them: in particular as one of
the parameters is the function being tagged. For now define this attribute
in the lint-sensitive section.
Reference:
http://clang.llvm.org/docs/AttributeReference.html#type-safety-checking
Modified:
head/sys/sys/cdefs.h
Modified: head/sys/sys/cdefs.h
==============================================================================
--- head/sys/sys/cdefs.h Wed Apr 22 18:11:34 2015 (r281860)
+++ head/sys/sys/cdefs.h Wed Apr 22 18:13:28 2015 (r281861)
@@ -212,6 +212,7 @@
#define __unused
#define __packed
#define __aligned(x)
+#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx)
#define __section(x)
#define __weak
#else
@@ -236,6 +237,12 @@
#define __aligned(x) __attribute__((__aligned__(x)))
#define __section(x) __attribute__((__section__(x)))
#endif
+#if __has_attribute(argument_with_type_tag)
+#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \
+ __attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx)))
+#else
+#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx)
+#endif
#if defined(__INTEL_COMPILER)
#define __dead2 __attribute__((__noreturn__))
#define __pure2 __attribute__((__const__))
More information about the svn-src-head
mailing list