public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sebastian Huber <sh@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Define a new __alloc_size2 attribute to complement the exiting support.
Date: Mon, 30 Jul 2018 08:52:00 -0000	[thread overview]
Message-ID: <20180730085212.74168.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=271e856a49731edb88427f4a7aeb388825e366c3

commit 271e856a49731edb88427f4a7aeb388825e366c3
Author: pfg <pfg@FreeBSD.org>
Date:   Sun Jan 21 20:27:47 2018 +0000

    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

Diff:
---
 newlib/libc/include/sys/cdefs.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index db87078..7c2aa3b 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -250,8 +250,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))


                 reply	other threads:[~2018-07-30  8:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180730085212.74168.qmail@sourceware.org \
    --to=sh@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).