This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Pascal Strings (and General String Literal Fixes!)


Hello all,

After a brief hiatus, I'm resuming the battle to get the Pascal
string literal support accepted into mainline gcc.  I owe a
debt of gratitude to Neil Booth for lots of great advice, and
for actually rewriting some of my initial code.  I have
incorporated Neil's fixes, and then went further and cleaned
up string literal handling in the C/C++/ObjC front-end in
general.

I have bootstrapped the resulting compiler successfully on
powerpc-apple-darwin1.4.  The four new test cases work also. :)

Enjoy!

--Zem
==============================================================

[ChangeLog]
         * c-common.c (WCHAR_TYPE_SIZE): Move to c-common.h.
         (char_array_type_node): Remove description.
         (wchar_array_type_node): Remove description.
         (flag_pascal_strings): New flag.
         (c_set_string_type): New routine to set the type of STRING_CST
         nodes.
         (c_build_string): New routine; wrapper around build_string, used
         by combine_strings and lex_string.
         (combine_strings): Major clean-up, portions refactored into
         c_set_string_type and c_build_string.  Added support for
         handling Pascal string literals.
         (c_common_nodes_and_builtins): Remove initialization of
         char_array_type_node and wchar_array_type_node.
         * c-common.h (CTI_CHAR_ARRAY_TYPE): Remove.
         (CTI_WCHAR_ARRAY_TYPE): Remove.
         (char_array_type_node): Remove.
         (wchar_array_type_node): Remove.
         (flag_pascal_strings): Add forward decl.
         (C_WIDE_STRING_P): New tree accessor predicate.
         (C_PASCAL_STRING_P): New tree accessor predicate.
         (WCHAR_TYPE_SIZE): Moved from c-common.c, c-lex.c
         (WCHAR_BYTES): Moved from c-lex.c.
         * c-decl.c (c_decode_option): Handle -fpascal-strings
         and -fno-pascal-strings.
         * c-lex.c (WCHAR_TYPE_SIZE): Move to c-common.h.
         (WCHAR_BYTES): Move to c-common.h.
         (valid_escape_pascal_p): New routine to check if Pascal
         escape (\p) occurred in a proper context.
         (lex_string): Major clean-up, portions refactored into
         c_build_string.  Added support for handling Pascal string
         literals.
         * c-typeck.c (digest_init): Use new accessor predicates
         to check for STRING_CST type.
         * toplev.c (documented_lang_options): Add entry for
         -fpascal-strings and -fno-pascal-strings.
         * doc/extend.texi: Add description of Pascal string
           literal usage.
         * doc/invoke.texi: Add description of -fpascal-strings
           option.

[cp/ChangeLog]
         * decl2.c (lang_f_options): Add -fpascal-strings.
         * typeck2.c (digest_init):  Use new accessor predicates
         to check for STRING_CST type.

[testsuite/ChangeLog]
         * g++.dg/pascal-strings-1.C: New.
         * g++.dg/pascal-strings-2.C: New.
         * gcc.dg/pascal-strings-1.c: New.
         * gcc.dg/pascal-strings-2.c: New.

gcc3_pascal_strings.diff


--------------------------------------------------------------
Ziemowit Laski                   Apple Computer, Inc.
zlaski@apple.com                 2 Infinite Loop, MS 302-4SN
+1.408.974.6229  Fax .1344       Cupertino, CA  95014-2085

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]