public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libiberty: Don't use VLAs if __STDC_NO_VLA__ is non-zero
@ 2019-05-30 20:54 Michael Forney
  2019-05-31 18:46 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Forney @ 2019-05-30 20:54 UTC (permalink / raw)
  To: gcc-patches

VLAs are optional in C11, and an implementation that does not support
them will define __STDC_NO_VLA__ to 1.

2019-05-30  Michael Forney  <mforney@mforney.org>

	* cp-demangle.c: Don't define CP_DYNAMIC_ARRAYS if __STDC_NO_VLA__
	is non-zero.
---
 libiberty/cp-demangle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 4e5b733b548..aa78c86dd44 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -192,9 +192,9 @@ static void d_init_info (const char *, int, size_t, struct d_info *);
 #else
 #ifdef __STDC__
 #ifdef __STDC_VERSION__
-#if __STDC_VERSION__ >= 199901L
+#if __STDC_VERSION__ >= 199901L && !__STDC_NO_VLA__
 #define CP_DYNAMIC_ARRAYS
-#endif /* __STDC__VERSION >= 199901L */
+#endif /* __STDC_VERSION__ >= 199901L && !__STDC_NO_VLA__ */
 #endif /* defined (__STDC_VERSION__) */
 #endif /* defined (__STDC__) */
 #endif /* ! defined (__GNUC__) */
-- 
2.20.1

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

* Re: [PATCH] libiberty: Don't use VLAs if __STDC_NO_VLA__ is non-zero
  2019-05-30 20:54 [PATCH] libiberty: Don't use VLAs if __STDC_NO_VLA__ is non-zero Michael Forney
@ 2019-05-31 18:46 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2019-05-31 18:46 UTC (permalink / raw)
  To: Michael Forney, gcc-patches

On 5/30/19 2:50 PM, Michael Forney wrote:
> VLAs are optional in C11, and an implementation that does not support
> them will define __STDC_NO_VLA__ to 1.
> 
> 2019-05-30  Michael Forney  <mforney@mforney.org>
> 
> 	* cp-demangle.c: Don't define CP_DYNAMIC_ARRAYS if __STDC_NO_VLA__
> 	is non-zero.
THanks.  I've installed this on the trunk.  Though I must admit some
surprise, what compiler are you using that defines STDC_NO_VLA? :-)

jeff

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

end of thread, other threads:[~2019-05-31 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-30 20:54 [PATCH] libiberty: Don't use VLAs if __STDC_NO_VLA__ is non-zero Michael Forney
2019-05-31 18:46 ` Jeff Law

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).