This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH 7/8] don't use C99 static array indices with older GCC versions
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Cc: avg <avg at FreeBSD dot org>
- Date: Tue, 4 Apr 2017 09:04:58 +0200
- Subject: [PATCH 7/8] don't use C99 static array indices with older GCC versions
- Authentication-results: sourceware.org; auth=none
- References: <1491289499-30548-1-git-send-email-sebastian.huber@embedded-brains.de>
From: avg <avg@FreeBSD.org>
For example, the FreeBSD GCC (4.2.1) has a spotty support for that
feature. If the static keyword is used with an unnamed array parameter
in a function declaration, then the compilation fails with:
error: static or type qualifiers in abstract declarator
The feature does work if the parameter is named.
So, the restriction introduced in this commit can be removed when all
affected function prototypes have the workaround.
MFC after: 1 week
Sponsored by: Panzura
---
newlib/libc/include/sys/cdefs.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index fa1692c..280aefd 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -369,6 +369,7 @@
* void bar(int myArray[__min_size(10)]);
*/
#if !defined(__cplusplus) && \
+ (defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \
(!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901))
#define __min_size(x) static (x)
#else
--
1.8.4.5