From 17b2315e80b66cdf4ee10a859e418dc84bf1edd9 Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 6 Jun 2001 15:08:42 +0000 Subject: [PATCH] New test git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10084 72102866-910b-0410-8b05-ffd578937521 --- config/config.constant-string-class.m | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 config/config.constant-string-class.m diff --git a/config/config.constant-string-class.m b/config/config.constant-string-class.m new file mode 100644 index 000000000..4f2474cd0 --- /dev/null +++ b/config/config.constant-string-class.m @@ -0,0 +1,61 @@ +/* Test that the compiler supports the -fconstant-string-class option + Copyright (C) 2001 Free Software Foundation, Inc. + + Written by: Nicola Pero + Created: June 2001 + + This file is part of the GNUstep Base Library. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. +*/ +#ifdef NeXT_RUNTIME +/* ignore this test with the NeXT runtime - never use + -fconstant-string-class */ +int main (int argc, char **argv) +{ + abort (); + return 1; +} +#else /* GNU RUNTIME - the real test */ + +/* must be compiled compile using -fconstant-string-class=NSConstantString + as an option to gcc. If it doesn't work, it means your gcc doesn't + support this option. */ + +#include +#include + +/* Define our custom constant string class */ +@interface NSConstantString : Object +{ + char *c_string; + unsigned int len; +} +- (char *) customString; +@end + +@implementation NSConstantString +- (char *) customString +{ + return c_string; +} +@end + + +int main (int argc, char **argv) +{ + /* Create a test constant string */ + NSConstantString *string = @"Antonio Valente"; + + /* Check that it really works */ + if (strcmp ([string customString], "Antonio Valente")) + { + abort (); + } + + return 0; +} +#endif /* GNU RUNTIME */