diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2001-03-06 10:04:54 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2001-03-06 10:04:54 +0000 |
commit | 69f8cbfaa92e236bf8b7841403d23e07fb113494 (patch) | |
tree | c7b3a28a926f9e64d20cdaac03ad76793baa4910 | |
parent | 1f50aafb85ecf587bc0e03864e9c4f67e762b279 (diff) | |
download | gcc-69f8cbfaa92e236bf8b7841403d23e07fb113494.zip gcc-69f8cbfaa92e236bf8b7841403d23e07fb113494.tar.gz gcc-69f8cbfaa92e236bf8b7841403d23e07fb113494.tar.bz2 |
objc-act.c (objc_add_static_instance): Set DECL_INITIAL and DECL_DEFER_OUTPUT on the decl we create...
* objc/objc-act.c (objc_add_static_instance): Set DECL_INITIAL
and DECL_DEFER_OUTPUT on the decl we create, before calling
rest_of_decl_compilation.
testsuite:
* objc/execute/string1.m, objc/execute/string2.m: Compare the
result of -cString against what we expect it to be; don't just
print it out for no one to read.
* objc/execute/string3.m, objc/execute/string4.m: New tests.
Based on testcases provided by Nicola Pero.
From-SVN: r40261
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/objc/execute/string1.m | 8 | ||||
-rw-r--r-- | gcc/testsuite/objc/execute/string2.m | 9 | ||||
-rw-r--r-- | gcc/testsuite/objc/execute/string3.m | 14 | ||||
-rw-r--r-- | gcc/testsuite/objc/execute/string4.m | 12 |
7 files changed, 61 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b9f61a..1b1b3d0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2001-03-06 Zack Weinberg <zackw@stanford.edu> + * objc/objc-act.c (objc_add_static_instance): Set DECL_INITIAL + and DECL_DEFER_OUTPUT on the decl we create, before calling + rest_of_decl_compilation. + +2001-03-06 Zack Weinberg <zackw@stanford.edu> + * aclocal.m4 (AM_GNU_GETTEXT): Don't AC_REQUIRE AC_FUNC_ALLOCA. * configure, config.in: Regenerate. @@ -101,8 +107,8 @@ from 2000-09-06 Zack Weinberg <zack@wolery.cumb.org> * c-parse.gperf, c-gperf.h: Delete. - (c-gperf.h was accidently re-added to the CVS repo in the rev 1.16 commit - by tromey) + (c-gperf.h was accidently re-added to the CVS repo in the rev + 1.16 commit by tromey) 2001-03-03 Neil Booth <neil@daikokuya.demon.co.uk> diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index f5f27ad..99cb297 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -1474,13 +1474,14 @@ objc_add_static_instance (constructor, class_decl) DECL_COMMON (decl) = 1; TREE_STATIC (decl) = 1; DECL_ARTIFICIAL (decl) = 1; + DECL_INITIAL (decl) = constructor; + + /* We may be writing something else just now. + Postpone till end of input. */ + DECL_DEFER_OUTPUT (decl) = 1; pushdecl_top_level (decl); rest_of_decl_compilation (decl, 0, 1, 0); - /* Do this here so it gets output later instead of possibly - inside something else we are writing. */ - DECL_INITIAL (decl) = constructor; - /* Add the DECL to the head of this CLASS' list. */ TREE_PURPOSE (*chain) = tree_cons (NULL_TREE, decl, TREE_PURPOSE (*chain)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8e2e7b0..d0a7835 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2001-03-06 Zack Weinberg <zackw@stanford.edu> + + * objc/execute/string1.m, objc/execute/string2.m: Compare the + result of -cString against what we expect it to be; don't just + print it out for no one to read. + + * objc/execute/string3.m, objc/execute/string4.m: New tests. + Based on testcases provided by Nicola Pero. + 2001-03-03 Neil Booth <neil@daikokuya.demon.co.uk> * gcc.dg/cpp/macro7.c: New test. diff --git a/gcc/testsuite/objc/execute/string1.m b/gcc/testsuite/objc/execute/string1.m index f0d1473..fff03c7 100644 --- a/gcc/testsuite/objc/execute/string1.m +++ b/gcc/testsuite/objc/execute/string1.m @@ -1,8 +1,12 @@ -#include <stdio.h> +/* Based on a test case contributed by Nicola Pero. */ + +#include <string.h> +#include <stdlib.h> #include <objc/NXConstStr.h> int main(int argc, void **args) { - printf ([@"this is a string\n" cString]); + if (strcmp ([@"this is a string" cString], "this is a string")) + abort (); return 0; } diff --git a/gcc/testsuite/objc/execute/string2.m b/gcc/testsuite/objc/execute/string2.m index 247e22b..66462b3 100644 --- a/gcc/testsuite/objc/execute/string2.m +++ b/gcc/testsuite/objc/execute/string2.m @@ -1,8 +1,13 @@ -#include <stdio.h> +/* Based on a test case contributed by Nicola Pero. */ + +#include <string.h> +#include <stdlib.h> #include <objc/NXConstStr.h> int main(int argc, void **args) { - printf ([@"this " @"is " @"a " @"string\n" cString]); + if (strcmp ([@"this " @"is " @"a " @"string" cString], + "this " "is " "a " "string")) + abort (); return 0; } diff --git a/gcc/testsuite/objc/execute/string3.m b/gcc/testsuite/objc/execute/string3.m new file mode 100644 index 0000000..21527dc --- /dev/null +++ b/gcc/testsuite/objc/execute/string3.m @@ -0,0 +1,14 @@ +/* Based on a test case contributed by Nicola Pero. */ + +#include <string.h> +#include <stdlib.h> +#include <objc/NXConstStr.h> + +#define STRING "this is a string" + +int main (int argc, void **args) +{ + if (strcmp ([@STRING cString], STRING)) + abort (); + return 0; +} diff --git a/gcc/testsuite/objc/execute/string4.m b/gcc/testsuite/objc/execute/string4.m new file mode 100644 index 0000000..54550d6 --- /dev/null +++ b/gcc/testsuite/objc/execute/string4.m @@ -0,0 +1,12 @@ +/* Based on a test case contributed by Nicola Pero. */ + +#include <string.h> +#include <stdlib.h> +#include <objc/NXConstStr.h> + +int main(int argc, void **args) +{ + if ([@"this is a string" length] != strlen ("this is a string")) + abort (); + return 0; +} |