diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-08-27 21:25:00 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-08-27 21:25:00 +0000 |
commit | 8deeb9c0a6b1c02da5380d045f9a48adc31e5c2d (patch) | |
tree | 533a02b36ad60afd99fa6aae8a017925394a20d3 | |
parent | 67f973fd08f200cc94f97de7a36778d353f8b807 (diff) | |
download | ATCD-8deeb9c0a6b1c02da5380d045f9a48adc31e5c2d.tar.gz |
ChangeLogTag: Tue Aug 27 16:22:27 2002 Jeff Parsons <parsons@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLog | 10 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_global.cpp | 37 |
2 files changed, 38 insertions, 9 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 19d2753187d..9c8ea242abe 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,13 @@ +Tue Aug 27 16:22:27 2002 Jeff Parsons <parsons@cs.wustl.edu> + + * TAO_IDL/util/utl_global.cpp: + + Yet another pass at fixing conditional #included IDL files. + This time code has been added to make sure, when stripping + -I prefixes off of preprocessor #include strings, that we + strip off the longest match, in case some -I options are + substrings of others. + Tue Aug 27 15:41:57 2002 Balachandran Natarajan <bala@isis-server.vuse.vanderbilt.edu> * tests/ORB_shutdown/server.bor: diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index 6f127ad41f5..61704b145fd 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -1035,13 +1035,14 @@ IDL_GlobalData::stripped_preproc_include (const char *name) ssize_t cursor = this->idl_flags_.find ("-I", 0); ACE_CString c_name (name, 0, 0); - size_t start = 0; - size_t end = 0; + ssize_t start = 0; + ssize_t end = 0; + char *candidate = 0; while (cursor != ACE_SString::npos) { // Skip over the "-I". - start = (size_t)cursor + 2; + start = cursor + 2; // If the "-I" is followed by a space. skip that too. if (this->idl_flags_[start] == ' ') @@ -1060,23 +1061,41 @@ IDL_GlobalData::stripped_preproc_include (const char *name) // Set the cursor for the next iteration, if any. cursor = this->idl_flags_.find ("-I", end); - // If this prefix is found at the beginning of the name, strip it // and return it. if (c_name.find (this->idl_flags_.substr (start, end - start)) == 0) { // If the prefix ends in / or \, we don't need to strip the one - // that *would* have been added for concatenation. + // that *would* have been added for concatenation... char prefix_cap = this->idl_flags_[end - 1]; size_t skip_slash = (prefix_cap != '\\' && prefix_cap != '/'); - char *retval = c_name.substr (end - start + skip_slash).rep (); + char *rep = c_name.substr (end - start + skip_slash).rep (); + + // ...unless it's the SunCC preprocessor, which adds a / for + // concatentation no matter what, so we check for it. + if (rep[0] == '/') + { + ++rep; + } - // The Sun preprocessor adds a concatenating slash no matter what. - return retval + (retval[0] == '/'); + // If there's more than one match in the list, we want the + // longest one. + if (candidate == 0 + || ACE_OS::strlen (rep) < ACE_OS::strlen (candidate)) + { + candidate = rep; + } } } // If no prefix matches, just return the name unchanged. - return (char *)name; + if (candidate != 0) + { + return candidate; + } + else + { + return (char *)name; + } } |