Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jan 2018 20:27:47 +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: r328221 - head/sys/sys
Message-ID:  <201801212027.w0LKRlj4024423@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Sun Jan 21 20:27:47 2018
New Revision: 328221
URL: https://svnweb.freebsd.org/changeset/base/328221

Log:
  Define a new __alloc_size2 attribute to complement the exiting support.
  
  At least on GCC7 calling __alloc_size(x) twice is not equivalent to
  calling using the attribute once with two arguments. The later is the
  documented use in GCC documentation so add a new alloc_size(n, x)
  alternative to cover for the few places where it is used: basically:
  calloc(3), reallocarray(3) and  mallocarray(9).
  
  Submitted by:	Mark Millard
  MFC after:	3 days
  Reference:
  http://docs.freebsd.org/cgi/mid.cgi?F227842D-6BE2-4680-82E7-07906AF61CD7

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==============================================================================
--- head/sys/sys/cdefs.h	Sun Jan 21 19:26:38 2018	(r328220)
+++ head/sys/sys/cdefs.h	Sun Jan 21 20:27:47 2018	(r328221)
@@ -230,8 +230,10 @@
 #endif
 #if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__)
 #define	__alloc_size(x)	__attribute__((__alloc_size__(x)))
+#define	__alloc_size2(n, x)	__attribute__((__alloc_size__(n, x)))
 #else
 #define	__alloc_size(x)
+#define	__alloc_size2(n, x)
 #endif
 #if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__)
 #define	__alloc_align(x)	__attribute__((__alloc_align__(x)))



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