* [PATCH] Unconditonally define alloca as __builtin_alloca
@ 2019-11-19 4:04 Michael Forney
2019-11-19 9:28 ` Szabolcs Nagy
0 siblings, 1 reply; 6+ 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] 6+ messages in thread
* Re: [PATCH] Unconditonally define alloca as __builtin_alloca
2019-11-19 4:04 [PATCH] Unconditonally define alloca as __builtin_alloca Michael Forney
@ 2019-11-19 9:28 ` Szabolcs Nagy
2019-11-19 9:56 ` [PATCH v2] " Michael Forney
0 siblings, 1 reply; 6+ messages in thread
From: Szabolcs Nagy @ 2019-11-19 9:28 UTC (permalink / raw)
To: musl
* Michael Forney <mforney@mforney.org> [2019-11-18 20:04:59 -0800]:
> 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);
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
> -
> -#ifdef __GNUC__
> #define alloca __builtin_alloca
> -#endif
>
> #ifdef __cplusplus
> }
> --
> 2.20.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] Unconditonally define alloca as __builtin_alloca
2019-11-19 9:28 ` Szabolcs Nagy
@ 2019-11-19 9:56 ` Michael Forney
2020-01-01 20:02 ` Michael Forney
0 siblings, 1 reply; 6+ 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] 6+ 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; 6+ 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] 6+ 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; 6+ 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] 6+ 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; 6+ 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] 6+ messages in thread
end of thread, other threads:[~2020-01-01 20:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 4:04 [PATCH] Unconditonally define alloca as __builtin_alloca Michael Forney
2019-11-19 9:28 ` 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
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).