mailing list of musl libc
 help / color / Atom feed
* 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
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

* [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; 2+ 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] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ 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

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