* fixed GCC 4.4.0 mingw compilation:
[fw/sdcc] / src / regression / struct1.c
index e7a607e8d18cc1f0db5ab6d92ae84cb09c62a3f7..99b9f21c3aa817611f673d712d8e62a05dc31b84 100644 (file)
@@ -1,17 +1,15 @@
-//#include "p16c84.h"
+#include "gpsim_assert.h"
 // Addition tests
 
 /* bit types are not ANSI - so provide a way of disabling bit types
  * if this file is used to test other compilers besides SDCC */
-#define SUPPORT_BIT_TYPES 1
+#define SUPPORT_BIT_TYPES 0
 
 /* Some compilers that support bit types do not support bit arithmetic 
  * (like bitx = bity + bitz;) */
 #define SUPPORT_BIT_ARITHMETIC 1
 
-unsigned char success = 0;
 unsigned char failures = 0;
-unsigned char dummy = 0;
 
 #if SUPPORT_BIT_TYPES
 
@@ -39,32 +37,32 @@ unsigned char *acharP = 0;
 struct chars
   {
     unsigned char c0, c1;
+    unsigned int  i0, i1;
   };
 
 
-struct chars char_struct;
+struct chars struct1;
 
 void
-done ()
+done()
 {
-
-  dummy++;
-
+  ASSERT(MANGLE(failures) == 0);
+  PASSED();
 }
 
 void
 struct_test (void)
 {
 
-  if (char_struct.c0 || char_struct.c1)
+  if (struct1.c0 || struct1.c1)
     failures++;
 
-  char_struct.c0++;
+  struct1.c0++;
 
-  if (char_struct.c0 != 1)
+  if (struct1.c0 != 1)
     failures++;
 }
-
+/*
 void
 ptr_to_struct (struct chars *p)
 {
@@ -78,18 +76,29 @@ ptr_to_struct (struct chars *p)
   if (p->c1 != 1)
     failures++;
 }
+*/
+void add_chars(void)
+{
 
+  achar0 = struct1.c0 + struct1.c1;
+
+  if(achar0 != 1)
+    failures++;
+}
 
 void
 main (void)
 {
 
 
-  char_struct.c0 = 0;
-  char_struct.c1 = 0;
+  struct1.c0 = 0;
+  struct1.c1 = 0;
   struct_test ();
-  ptr_to_struct (&char_struct);
+  //  ptr_to_struct (&struct1);
+
+  struct1.c0 = 0;
+  struct1.c1 = 1;
+  add_chars();
 
-  success = failures;
   done ();
 }