summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-30 14:53:30 +0000
committersma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-30 14:53:30 +0000
commit0360b3cc97ea02a7a536dc8521d71b0cd7b6d83f (patch)
tree9c9419e961173bf210ec0e581b0fa602458c337e
parentb132bae7c7dff8e78ddb2a73db95165097da3a7c (diff)
downloadATCD-0360b3cc97ea02a7a536dc8521d71b0cd7b6d83f.tar.gz
ChangeLogTag: Fri Oct 30 14:50:00 UTC 2009 Simon Massey <sma at prismtech dot com>
-rw-r--r--TAO/ChangeLog7
-rw-r--r--TAO/TAO_IDL/driver/drv_preproc.cpp92
2 files changed, 56 insertions, 43 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 0a2370fb22c..82a215cc205 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,9 @@
+Fri Oct 30 14:50:00 UTC 2009 Simon Massey <sma at prismtech dot com>
+
+ * TAO_IDL/driver/drv_preproc.cpp:
+ Improve the DRV_add_include_path() space within roots and
+ directory slash handling. (TAO782)
+
Fri Oct 30 13:08:30 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com>
* tests/Bug_3748_Regression/client.cpp:
@@ -465,6 +471,7 @@ Mon Oct 26 10:52:01 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com>
* tao/Acceptor_Impl.cpp:
Uncommented code for a fix for bug#3748.
+>>>>>>> .r87276
Thu Oct 22 10:47:21 UTC 2009 Johnny Willemsen <jwilllemsen@remedy.nl>
* TAO_IDL/TAO_IDL_ACE.mwc:
diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp
index cdbc35ee05e..e75091226d1 100644
--- a/TAO/TAO_IDL/driver/drv_preproc.cpp
+++ b/TAO/TAO_IDL/driver/drv_preproc.cpp
@@ -429,54 +429,61 @@ DRV_sweep_dirs (const char *rel_path,
}
ACE_CString&
-DRV_add_include_path (ACE_CString& include_path, const char* p,
- const char* suffix, bool is_system)
+DRV_add_include_path (ACE_CString& include_path, const char *path,
+ const char *suffix, bool is_system)
{
- if (p == 0) return include_path;
+ if (!path)
+ return include_path;
- ACE_CString include_option ("-I");
-
- size_t len = ACE_OS::strlen (p);
-
- bool quote = !(p[0] == '"' || ACE_OS::strchr (p, ' ') == 0);
-
- // Eliminate possible quotes from the path
- if ('"' == p[0])
- {
- include_path = p + 1;
- include_path[len - 2] = 0;
- }
- else
- {
- include_path = p;
- }
-
- // Some compilers choke on "//" separators.
- if (p[len - 1] == '/' || p[len - 1] == '\\')
- {
- include_path[len - 1] = '\0';
- }
-
- for ( ; suffix != 0 && *suffix != 0; suffix++)
- {
+ const bool needToQuote= (('"' == *path) || ACE_OS::strchr (path, ' '));
+ const size_t pathLength= ACE_OS::strlen (path);
+ const char
#if defined (ACE_WIN32)
- if (*suffix == '/')
- include_path += '\\';
+ nativeDir= '\\',
+ foreignDir= '/';
#else
- if (*suffix == '\\')
- include_path += '/';
+ nativeDir= '/',
+ foreignDir= '\\';
#endif
- else
- include_path += *suffix;
- }
-
- if (quote)
- include_option += '"';
- include_option += include_path; //.c_str ();
-
- if (quote)
- include_option += '"';
+ // Eliminate possible enclosing quotes from the path, and since some compilers
+ // choke on double directory separators in paths, ensure that the path does not
+ // end with a directory slash.
+ include_path=
+ ACE_CString (path + ('"' == *path), // Skip leading Quote
+ pathLength
+ - ('"' == *path) // Don't count leading Quote
+ - ( (1uL < pathLength) && // Don't count trailing Quote XOR directory
+ ('"' == path [pathLength - 1uL] ||
+ nativeDir == path [pathLength - 1uL] ||
+ foreignDir == path [pathLength - 1uL]
+ ) )
+ - ( (2uL < pathLength) && // Don't count trailing Quote AND directory
+ '"' == path [pathLength - 1uL] &&
+ (nativeDir == path [pathLength - 2uL] ||
+ foreignDir == path [pathLength - 2uL]
+ ) )
+ );
+
+ if (suffix)
+ {
+ if (!include_path.length () && ((nativeDir == *suffix) || (foreignDir == *suffix)))
+ ++suffix; // Path is empty, don't add the suffix's leading directory seporator
+
+ if (include_path.length () && *suffix && (nativeDir != *suffix) && (foreignDir != *suffix))
+ include_path+= nativeDir; // Force a directory seporator
+
+ // Add the suffix string to the path, ensuring that foreign directory slashes
+ // are added as the native type.
+ for ( ; *suffix; ++suffix)
+ include_path+= (foreignDir == *suffix) ? nativeDir : *suffix;
+ }
+
+ // Build up the include string from the new path+suffix
+ ACE_CString include_option ("-I\"", 2 + needToQuote);
+ include_option+= include_path;
+ if (needToQuote)
+ include_option+= '"';
DRV_cpp_putarg (include_option.c_str ());
idl_global->add_include_path (include_path.c_str (), is_system);
@@ -489,7 +496,6 @@ DRV_add_include_path (ACE_CString& include_path, const char* p,
void
DRV_cpp_post_init (void)
{
-
// Add include path for TAO_ROOT/orbsvcs.
char* TAO_ROOT = ACE_OS::getenv ("TAO_ROOT");