projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added simple static array init test
[fw/sdcc]
/
src
/
regression
/
struct1.c
diff --git
a/src/regression/struct1.c
b/src/regression/struct1.c
index fd3e860f60982af8c4fc1f5477f1c45df687f971..32baf80876fd9fbc7986b5604c6373e8eade31e8 100644
(file)
--- a/
src/regression/struct1.c
+++ b/
src/regression/struct1.c
@@
-9,9
+9,9
@@
* (like bitx = bity + bitz;) */
#define SUPPORT_BIT_ARITHMETIC 1
* (like bitx = bity + bitz;) */
#define SUPPORT_BIT_ARITHMETIC 1
-unsigned char success
=
0;
-unsigned char failures
=
0;
-unsigned char dummy
=
0;
+unsigned char success
=
0;
+unsigned char failures
=
0;
+unsigned char dummy
=
0;
#if SUPPORT_BIT_TYPES
#if SUPPORT_BIT_TYPES
@@
-36,55
+36,73
@@
unsigned char achar0 = 0;
unsigned char achar1 = 0;
unsigned char *acharP = 0;
unsigned char achar1 = 0;
unsigned char *acharP = 0;
-struct chars {
- unsigned char c0,c1;
-};
+struct chars
+ {
+ unsigned char c0, c1;
+ unsigned int i0, i1;
+ };
-struct chars
char_struct
;
+struct chars
struct1
;
-void done()
+void
+done ()
{
dummy++;
}
{
dummy++;
}
-void struct_test(void)
+void
+struct_test (void)
{
{
- if
(char_struct.c0 || char_struct
.c1)
+ if
(struct1.c0 || struct1
.c1)
failures++;
failures++;
-
char_struct
.c0++;
+
struct1
.c0++;
- if
(char_struct
.c0 != 1)
+ if
(struct1
.c0 != 1)
failures++;
}
failures++;
}
-
-void ptr_to_struct(struct chars *p)
+/*
+void
+ptr_to_struct (struct chars *p)
{
{
- if(p->c1)
+ if
(p->c1)
failures++;
p->c1++;
failures++;
p->c1++;
- if(p->c1 != 1)
+ if
(p->c1 != 1)
failures++;
}
failures++;
}
+*/
+void add_chars(void)
+{
+
+ achar0 = struct1.c0 + struct1.c1;
+ if(achar0 != 1)
+ failures++;
+}
-void main(void)
+void
+main (void)
{
{
- char_struct.c0 = 0;
- char_struct.c1 = 0;
- struct_test();
- ptr_to_struct(&char_struct);
+ struct1.c0 = 0;
+ struct1.c1 = 0;
+ struct_test ();
+ // ptr_to_struct (&struct1);
+
+ struct1.c0 = 0;
+ struct1.c1 = 1;
+ add_chars();
success = failures;
success = failures;
- done();
+ done
();
}
}