* support/regression/tests/zeropad.c: never meant to commit the
authormaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 1 Jun 2004 11:46:57 +0000 (11:46 +0000)
committermaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 1 Jun 2004 11:46:57 +0000 (11:46 +0000)
  nestedstruct test: removed, added check for GCC version

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3336 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
support/regression/tests/zeropad.c

index 2b0fb850e199e02b9d07099199043c91b83bfb1b..930c0776b2fc48307508517b35595068b7939f79 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-06-01 Maarten Brock <sourceforge.brock AT dse.nl>
+       * support/regression/tests/zeropad.c: never meant to commit the
+         nestedstruct test: removed, added check for GCC version
+
 2004-05-31 Maarten Brock <sourceforge.brock AT dse.nl>
        * src/SDCCast.c (createIvalArray): fixed bug 770487 SIGSEGV
        * src/SDCCglue.c (emitRegularMap): fixed bug 770484 allocation problem
index dbec36a224f8620e9a8d9b3f7e3c94eebc184584..299be534f478e8a8954ce82e488b03beae2788ac 100644 (file)
@@ -6,6 +6,12 @@
 #define STORAGE {storage}
 #endif
 
+#if defined __GNUC__
+  #define FLEXARRAY (__GNUC__ >= 3)
+#else
+  #define FLEXARRAY 1
+#endif
+
 #include <testfwk.h>
 
 typedef unsigned int size_t;
@@ -17,7 +23,7 @@ typedef unsigned int size_t;
 # define code
 #endif
 
-char array[5] = {'a', 'b', 'c'};
+char STORAGE array[5] = {'a', 'b', 'c'};
 
 struct w {
   char a;
@@ -33,36 +39,21 @@ struct x {
   char  b[10];
 };
 
-struct y {
-  short a;
-  char  b[];
-};
-
-/* I think section 6.7.2.1 paragraph 2 of ISO/IEC 9899:1999 prohibits */
-/* nesting a structure ending in a flexible array inside another      */
-/* struct/union. In any case, my gcc (3.2.2) chokes on this. -- EEP   */
-#ifdef NESTED_FLEX_ARRAY
-struct z {
-  char     c;
-  struct y s;
-};
-#endif
-
 struct x STORAGE teststruct[5] = {
   { 10, {  1, 2, 3, 4, 5} },
   { 20, { 11 } },
   { 30, {  6, 7, 8} }
 };
 
+#if FLEXARRAY
+  struct y {
+    short a;
+    char  b[];
+  };
+
 struct y STORAGE incompletestruct = {
   10, {1, 2, 3, 4, 5}
 };
-
-#ifdef NESTED_FLEX_ARRAY
-struct z STORAGE nestedstruct = {
-  16,
-  {20, {6, 7, 8} }
-};
 #endif
 
 void
@@ -86,6 +77,7 @@ testZeropad(void)
   ASSERT(sizeof(teststruct[1])   == 12);
   ASSERT(sizeof(teststruct)      == 60);
 
+#if FLEXARRAY
   ASSERT(incompletestruct.a    == 10);
   ASSERT(incompletestruct.b[0] ==  1);
   ASSERT(incompletestruct.b[4] ==  5);
@@ -93,10 +85,5 @@ testZeropad(void)
   ASSERT(sizeof(incompletestruct) == sizeof(struct y));
   ASSERT(sizeof(incompletestruct) == offsetof(struct y, b));
   ASSERT(sizeof(incompletestruct) == offsetof(struct x, b));
-
-#ifdef NESTED_FLEX_ARRAY
-  ASSERT(nestedstruct.c      == 16);
-  ASSERT(nestedstruct.s.a    == 20);
-  ASSERT(nestedstruct.s.b[2] ==  8);
 #endif
 }