Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Apr 2015 18:13:29 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r281861 - head/sys/sys
Message-ID:  <201504221813.t3MIDTgW003010@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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__))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504221813.t3MIDTgW003010>