From ad8c162bc1f1ea2113598c0009fdba2c1c0b361d Mon Sep 17 00:00:00 2001 From: Ziemowit Laski Date: Wed, 18 Aug 2004 01:58:13 +0000 Subject: [PATCH] gcc.c (default_compilers): Add info about ".mm", ".M" and ".mii" Objective-C++ extensions. [gcc/ChangeLog] 2004-08-18 Ziemowit Laski * gcc.c (default_compilers): Add info about ".mm", ".M" and ".mii" Objective-C++ extensions. * gengtype.c (get_file_basename): Match entire subdirectory name ('cp', 'objc', 'objcp') rather than just its suffix. (get_base_file_bitmap): Allow for files to belong to more than one language. (get_output_file_with_visibility): Treat objc/objc-act.h as a header used by more than one front-end. From-SVN: r86167 --- gcc/ChangeLog | 13 ++++++++++++- gcc/gcc.c | 2 ++ gcc/gengtype.c | 19 ++++++++++++++----- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e8108e5086b..dab997443d2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2004-08-18 Ziemowit Laski + + * gcc.c (default_compilers): Add info about ".mm", ".M" and ".mii" + Objective-C++ extensions. + * gengtype.c (get_file_basename): Match entire subdirectory name + ('cp', 'objc', 'objcp') rather than just its suffix. + (get_base_file_bitmap): Allow for files to belong to more than one + language. + (get_output_file_with_visibility): Treat objc/objc-act.h as a header + used by more than one front-end. + 2004-08-18 Richard Earnshaw * arm.md (addsi3, subsi3, andsi3, iorsi3, movsi, movhi): Rework to @@ -211,7 +222,7 @@ 2004-08-16 Adam Nemet * Makefile.in (LIBS): Move $(LIBIBERTY) after $(BANSHEELIB). - + 2004-08-16 Andrew Pinski * target-def.h (TARGET_EH_RETURN_FILTER_MODE): Remove diff --git a/gcc/gcc.c b/gcc/gcc.c index 78974ab4e6a..bce27bcd5dc 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -918,6 +918,8 @@ static const struct compiler default_compilers[] = and be given a more meaningful error than "file not used since linking is not done". */ {".m", "#Objective-C", 0, 0, 0}, {".mi", "#Objective-C", 0, 0, 0}, + {".mm", "#Objective-C++", 0, 0, 0}, {".M", "#Objective-C++", 0, 0, 0}, + {".mii", "#Objective-C++", 0, 0, 0}, {".cc", "#C++", 0, 0, 0}, {".cxx", "#C++", 0, 0, 0}, {".cpp", "#C++", 0, 0, 0}, {".cp", "#C++", 0, 0, 0}, {".c++", "#C++", 0, 0, 0}, {".C", "#C++", 0, 0, 0}, diff --git a/gcc/gengtype.c b/gcc/gengtype.c index a1c23d2c980..6cb89f0e872 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -1096,7 +1096,7 @@ get_file_basename (const char *f) s2 = lang_dir_names [i]; l1 = strlen (s1); l2 = strlen (s2); - if (l1 >= l2 && !memcmp (s1, s2, l2)) + if (l1 >= l2 && IS_DIR_SEPARATOR (s1[-1]) && !memcmp (s1, s2, l2)) { basename -= l2 + 1; if ((basename - f - 1) != srcdir_len) @@ -1125,6 +1125,10 @@ get_base_file_bitmap (const char *input_file) unsigned k; unsigned bitmap; + /* If the file resides in a language subdirectory (e.g., 'cp'), assume that + it belongs to the corresponding language. The file may belong to other + languages as well (which is checked for below). */ + if (slashpos) { size_t i; @@ -1134,10 +1138,7 @@ get_base_file_bitmap (const char *input_file) { /* It's in a language directory, set that language. */ bitmap = 1 << i; - return bitmap; } - - abort (); /* Should have found the language. */ } /* If it's in any config-lang.in, then set for the languages @@ -1200,11 +1201,19 @@ get_output_file_with_visibility (const char *input_file) memcpy (s, ".h", sizeof (".h")); for_name = basename; } + /* Some headers get used by more than one front-end; hence, it + would be inappropriate to spew them out to a single gtype-.h + (and gengtype doesn't know how to direct spewage into multiple + gtype-.h headers at this time). Instead, we pair up these + headers with source files (and their special purpose gt-*.h headers). */ else if (strcmp (basename, "c-common.h") == 0) output_name = "gt-c-common.h", for_name = "c-common.c"; else if (strcmp (basename, "c-tree.h") == 0) output_name = "gt-c-decl.h", for_name = "c-decl.c"; - else + else if (strncmp (basename, "objc", 4) == 0 && IS_DIR_SEPARATOR (basename[4]) + && strcmp (basename + 5, "objc-act.h") == 0) + output_name = "gt-objc-objc-act.h", for_name = "objc/objc-act.c"; + else { size_t i; -- 2.30.2