mailing list of musl libc
 help / color / Atom feed
* [PATCH] Unconditonally define alloca as __builtin_alloca
@ 2019-11-19  4:04 Michael Forney
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Forney @ 2019-11-19  4:04 UTC (permalink / raw)
  To: musl

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.
---
 include/alloca.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/alloca.h b/include/alloca.h
index d2e6f1c6..8ae8a30d 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -8,11 +8,7 @@ extern "C" {
 #define	__NEED_size_t
 #include <bits/alltypes.h>
 
-void *alloca(size_t);
-
-#ifdef __GNUC__
 #define alloca __builtin_alloca
-#endif
 
 #ifdef __cplusplus
 }
-- 
2.20.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] Unconditonally define alloca as __builtin_alloca
  2019-11-19  9:28 [PATCH] Unconditonally define alloca as __builtin_alloca Szabolcs Nagy
@ 2019-11-19  9:56 ` Michael Forney
  2020-01-01 20:02   ` Michael Forney
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Forney @ 2019-11-19  9:56 UTC (permalink / raw)
  To: musl

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] Unconditonally define alloca as __builtin_alloca
  2019-11-19  9:56 ` [PATCH v2] " Michael Forney
@ 2020-01-01 20:02   ` Michael Forney
  2020-01-01 20:08     ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Forney @ 2020-01-01 20:02 UTC (permalink / raw)
  To: musl

On 2019-11-19, Michael Forney <mforney@mforney.org> wrote:
> 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.

Ping.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH v2] Unconditonally define alloca as __builtin_alloca
  2020-01-01 20:02   ` Michael Forney
@ 2020-01-01 20:08     ` Rich Felker
  2020-01-01 20:28       ` Michael Forney
  0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2020-01-01 20:08 UTC (permalink / raw)
  To: musl

On Wed, Jan 01, 2020 at 12:02:01PM -0800, Michael Forney wrote:
> On 2019-11-19, Michael Forney <mforney@mforney.org> wrote:
> > 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.
> 
> Ping.

I'll go ahead and merge it; I don't think this is terribly
controversial and at worst it compile-time breaks something that's
already not working right.

Rich


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH v2] Unconditonally define alloca as __builtin_alloca
  2020-01-01 20:08     ` Rich Felker
@ 2020-01-01 20:28       ` Michael Forney
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Forney @ 2020-01-01 20:28 UTC (permalink / raw)
  To: musl

On 2020-01-01, Rich Felker <dalias@libc.org> wrote:
> I'll go ahead and merge it; I don't think this is terribly
> controversial and at worst it compile-time breaks something that's
> already not working right.

Thanks! Just wanted to make sure it didn't get forgotten before the
upcoming release.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19  9:28 [PATCH] Unconditonally define alloca as __builtin_alloca Szabolcs Nagy
2019-11-19  9:56 ` [PATCH v2] " Michael Forney
2020-01-01 20:02   ` Michael Forney
2020-01-01 20:08     ` Rich Felker
2020-01-01 20:28       ` Michael Forney
  -- strict thread matches above, loose matches on Subject: below --
2019-11-19  4:04 [PATCH] " Michael Forney

mailing list of musl libc

Archives are clonable: git clone --mirror http://inbox.vuxu.org/musl

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.musl


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git