Commit 69f8cbfa by Zack Weinberg

objc-act.c (objc_add_static_instance): Set DECL_INITIAL and DECL_DEFER_OUTPUT on…

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
parent 1f50aafb
2001-03-06 Zack Weinberg <zackw@stanford.edu> 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 * aclocal.m4 (AM_GNU_GETTEXT): Don't AC_REQUIRE
AC_FUNC_ALLOCA. AC_FUNC_ALLOCA.
* configure, config.in: Regenerate. * configure, config.in: Regenerate.
...@@ -101,8 +107,8 @@ ...@@ -101,8 +107,8 @@
from 2000-09-06 Zack Weinberg <zack@wolery.cumb.org> from 2000-09-06 Zack Weinberg <zack@wolery.cumb.org>
* c-parse.gperf, c-gperf.h: Delete. * c-parse.gperf, c-gperf.h: Delete.
(c-gperf.h was accidently re-added to the CVS repo in the rev 1.16 commit (c-gperf.h was accidently re-added to the CVS repo in the rev
by tromey) 1.16 commit by tromey)
2001-03-03 Neil Booth <neil@daikokuya.demon.co.uk> 2001-03-03 Neil Booth <neil@daikokuya.demon.co.uk>
......
...@@ -1474,13 +1474,14 @@ objc_add_static_instance (constructor, class_decl) ...@@ -1474,13 +1474,14 @@ objc_add_static_instance (constructor, class_decl)
DECL_COMMON (decl) = 1; DECL_COMMON (decl) = 1;
TREE_STATIC (decl) = 1; TREE_STATIC (decl) = 1;
DECL_ARTIFICIAL (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); pushdecl_top_level (decl);
rest_of_decl_compilation (decl, 0, 1, 0); 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. */ /* Add the DECL to the head of this CLASS' list. */
TREE_PURPOSE (*chain) = tree_cons (NULL_TREE, decl, TREE_PURPOSE (*chain)); TREE_PURPOSE (*chain) = tree_cons (NULL_TREE, decl, TREE_PURPOSE (*chain));
......
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> 2001-03-03 Neil Booth <neil@daikokuya.demon.co.uk>
* gcc.dg/cpp/macro7.c: New test. * gcc.dg/cpp/macro7.c: New test.
......
#include <stdio.h> /* Based on a test case contributed by Nicola Pero. */
#include <string.h>
#include <stdlib.h>
#include <objc/NXConstStr.h> #include <objc/NXConstStr.h>
int main(int argc, void **args) 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; return 0;
} }
#include <stdio.h> /* Based on a test case contributed by Nicola Pero. */
#include <string.h>
#include <stdlib.h>
#include <objc/NXConstStr.h> #include <objc/NXConstStr.h>
int main(int argc, void **args) 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; return 0;
} }
/* 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;
}
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment