mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Michael Forney <mforney@mforney.org>
To: musl@lists.openwall.com
Subject: [PATCH v2] Unconditonally define alloca as __builtin_alloca
Date: Tue, 19 Nov 2019 01:56:34 -0800	[thread overview]
Message-ID: <20191119095634.24434-1-mforney@mforney.org> (raw)
In-Reply-To: <20191119092856.GM25646@port70.net>

This enables alternative compilers, which may not define __GNUC__,
to implement alloca, which is still fairly widely used.

This is similar to how stdarg.h already works in musl; compilers must
implement __builtin_va_arg, there is no fallback definition.
---

On 2019-11-19, Szabolcs Nagy <nsz@port70.net> wrote:
> i don't think removing the prototype is a good idea.
> 
> alloca is a builtin in gcc and won't generate an extern
> call even without optimization, so things work now with
> #undef alloca

OK, added back in v2.

 include/alloca.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/alloca.h b/include/alloca.h
index d2e6f1c6..b8d183d1 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -10,9 +10,7 @@ extern "C" {
 
 void *alloca(size_t);
 
-#ifdef __GNUC__
 #define alloca __builtin_alloca
-#endif
 
 #ifdef __cplusplus
 }
-- 
2.20.1



  reply	other threads:[~2019-11-19  9:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19  4:04 [PATCH] " Michael Forney
2019-11-19  9:28 ` Szabolcs Nagy
2019-11-19  9:56   ` Michael Forney [this message]
2020-01-01 20:02     ` [PATCH v2] " Michael Forney
2020-01-01 20:08       ` Rich Felker
2020-01-01 20:28         ` Michael Forney

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=20191119095634.24434-1-mforney@mforney.org \
    --to=mforney@mforney.org \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).