From ee98542103afd5efcc948c4142c146db6b442316 Mon Sep 17 00:00:00 2001 From: parsons Date: Fri, 2 Jul 2004 20:47:54 +0000 Subject: ChangeLogTag: Fri Jul 2 15:39:42 2004 Jeff Parsons --- TAO/ChangeLog | 16 ++++ TAO/TAO_IDL/driver/drv_args.cpp | 3 +- TAO/TAO_IDL/driver/drv_preproc.cpp | 190 ++++++++++--------------------------- TAO/TAO_IDL/fe/fe_init.cpp | 110 +++++++++++++++++++++ TAO/TAO_IDL/include/fe_extern.h | 3 + 5 files changed, 181 insertions(+), 141 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 45ca3e0edc5..30568ebb893 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,19 @@ +Fri Jul 2 15:39:42 2004 Jeff Parsons + + * TAO_IDL/driver/drv_args.cpp: + * TAO_IDL/driver/drv_preproc.cpp: + * TAO_IDL/fe/fe_init.cpp: + * TAO_IDL/include/fe_extern.h: + + Moved bits of code that instantiate ACE_Env_Value into + new methods created in the front end library. Having them in + the executable was causing a problem for Tru64 builds, since + the executable is compiled in multiple builds linking to + different backend libraries. The Tru64 compiler deals with + templates differently than other compilers, and the VPATH + solution for g++ that allowed the same object files to be + linked in different builds does not work for cxx. + Fri Jul 2 13:20:46 2004 Jeff Parsons * TAO_IDL/tao_idl.cpp: diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp index 6c29f5ed7af..f7b1970f69f 100644 --- a/TAO/TAO_IDL/driver/drv_args.cpp +++ b/TAO/TAO_IDL/driver/drv_args.cpp @@ -69,6 +69,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "idl_defines.h" #include "global_extern.h" #include "drv_extern.h" +#include "fe_extern.h" #include "be_global.h" #include "be_extern.h" #include "ace/OS_NS_stdio.h" @@ -203,7 +204,7 @@ DRV_parse_args (long ac, char **av) char *s = 0; long i; - DRV_store_env_include_paths (); + FE_store_env_include_paths (); DRV_cpp_init (); idl_global->set_prog_name (av[0]); diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index 3c91fa34aab..881d7c8d705 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -183,71 +183,11 @@ DRV_get_line (FILE *f) return I_TRUE; } -// Store include paths from the environment variable, if any. -void -DRV_store_env_include_paths (void) -{ - ACE_Env_Value incl_paths ("INCLUDE", - (char *) 0); - const char *aggr_str = incl_paths; - - if (aggr_str != 0) - { - char separator; -#if defined (ACE_WIN32) - separator = ';'; -#else - separator = ':'; -#endif - ACE_CString aggr_cstr (aggr_str); - ssize_t pos; - - do - { - pos = aggr_cstr.find (separator); - idl_global->add_include_path (aggr_cstr.substr (0, pos).fast_rep ()); - aggr_cstr = aggr_cstr.substr (pos + 1); - } while (pos != ACE_String_Base_Const::npos); - } -} - // Initialize the cpp argument list. void DRV_cpp_init (void) { - const char *cpp_loc, *cpp_args; - - // See if TAO_IDL_PREPROCESSOR is defined. - ACE_Env_Value preprocessor ("TAO_IDL_PREPROCESSOR", - (char *) 0); - - // Set cpp_loc to the built in location, unless it has been overriden by - // environment variables. - if (preprocessor != 0) - { - cpp_loc = preprocessor; - } - else - { - // Check for the deprecated CPP_LOCATION environment variable - ACE_Env_Value cpp_path ("CPP_LOCATION", - (char *) 0); - - if (cpp_path != 0) - { - ACE_ERROR ((LM_WARNING, - "WARNING: The environment variable " - "CPP_LOCATION has been deprecated.\n" - " Please use TAO_IDL_PREPROCESSOR " - "instead.\n")); - - cpp_loc = cpp_path; - } - else - { - cpp_loc = idl_global->cpp_location (); - } - } + const char *cpp_loc = FE_get_cpp_loc_from_env (); DRV_cpp_putarg (cpp_loc); @@ -264,106 +204,81 @@ DRV_cpp_init (void) DRV_cpp_putarg ("-I."); - // Added some customizable preprocessor options - ACE_Env_Value args1 ("TAO_IDL_PREPROCESSOR_ARGS", - (char *) 0); + const char *cpp_args = FE_get_cpp_args_from_env (); - if (args1 != 0) - { - cpp_args = args1; - } - else + if (cpp_args == 0) { - // Check for the deprecated TAO_IDL_DEFAULT_CPP_FLAGS environment - // variable. - ACE_Env_Value args2 ("TAO_IDL_DEFAULT_CPP_FLAGS", - (char *) 0); - - if (args2 != 0) - { - ACE_ERROR ((LM_ERROR, - "Warning: The environment variable " - "TAO_IDL_DEFAULT_CPP_FLAGS has been " - "deprecated.\n" - " Please use " - "TAO_IDL_PREPROCESSOR_ARGS instead.\n")); - - cpp_args = args2; - } - else - { - // If no cpp flag was defined by the user, we define some - // platform specific flags here. - char option[BUFSIZ]; + // If no cpp flag was defined by the user, we define some + // platform specific flags here. + char option[BUFSIZ]; #if defined (TAO_IDL_PREPROCESSOR_ARGS) - cpp_args = TAO_IDL_PREPROCESSOR_ARGS; + cpp_args = TAO_IDL_PREPROCESSOR_ARGS; #elif defined (ACE_CC_PREPROCESSOR_ARGS) - cpp_args = ACE_CC_PREPROCESSOR_ARGS; + cpp_args = ACE_CC_PREPROCESSOR_ARGS; #else - cpp_args = "-E"; + cpp_args = "-E"; #endif /* TAO_IDL_PREPROCESSOR_ARGS */ - // So we can find OMG IDL files, such as `orb.idl'. - ACE_OS::strcpy (option, "-I"); + // So we can find OMG IDL files, such as `orb.idl'. + ACE_OS::strcpy (option, "-I"); #if defined (TAO_IDL_INCLUDE_DIR) - // TAO_IDL_INCLUDE_DIR should be in quotes, - // e.g. "/usr/local/include/tao" + // TAO_IDL_INCLUDE_DIR should be in quotes, + // e.g. "/usr/local/include/tao" - ACE_OS::strcat (option, - TAO_IDL_INCLUDE_DIR); + ACE_OS::strcat (option, + TAO_IDL_INCLUDE_DIR); #else - char* TAO_ROOT = ACE_OS::getenv ("TAO_ROOT"); - size_t len = 0; + char* TAO_ROOT = ACE_OS::getenv ("TAO_ROOT"); + size_t len = 0; + + if (TAO_ROOT != 0) + { + len = ACE_OS::strlen (TAO_ROOT); + + // Some compilers choke on "//" separators. + if (TAO_ROOT[len - 1] == '/') + { + TAO_ROOT[len - 1] = '\0'; + } - if (TAO_ROOT != 0) + ACE_OS::strcat (option, TAO_ROOT); + ACE_OS::strcat (option, "/tao"); + } + else + { + char* ACE_ROOT = ACE_OS::getenv ("ACE_ROOT"); + + if (ACE_ROOT != 0) { - len = ACE_OS::strlen (TAO_ROOT); + len = ACE_OS::strlen (ACE_ROOT); // Some compilers choke on "//" separators. - if (TAO_ROOT[len - 1] == '/') + if (ACE_ROOT[len - 1] == '/') { - TAO_ROOT[len - 1] = '\0'; + ACE_ROOT[len - 1] = '\0'; } - ACE_OS::strcat (option, TAO_ROOT); - ACE_OS::strcat (option, "/tao"); + ACE_OS::strcat (option, ACE_ROOT); + ACE_OS::strcat (option, "/TAO/tao"); } else { - char* ACE_ROOT = ACE_OS::getenv ("ACE_ROOT"); - - if (ACE_ROOT != 0) - { - len = ACE_OS::strlen (ACE_ROOT); - - // Some compilers choke on "//" separators. - if (ACE_ROOT[len - 1] == '/') - { - ACE_ROOT[len - 1] = '\0'; - } + ACE_ERROR ((LM_WARNING, + "NOTE: The environment variables " + "TAO_ROOT and ACE_ROOT are not defined.\n" + " TAO_IDL may not be able to " + "locate orb.idl\n")); - ACE_OS::strcat (option, ACE_ROOT); - ACE_OS::strcat (option, "/TAO/tao"); - } - else - { - ACE_ERROR ((LM_WARNING, - "NOTE: The environment variables " - "TAO_ROOT and ACE_ROOT are not defined.\n" - " TAO_IDL may not be able to " - "locate orb.idl\n")); - - ACE_OS::strcat (option, "."); - } + ACE_OS::strcat (option, "."); } + } #endif /* TAO_IDL_INCLUDE_DIR */ - DRV_cpp_putarg (option); - idl_global->add_include_path (ACE::strnew (option + 2)); - idl_global->tao_root (option + 2); - } + DRV_cpp_putarg (option); + idl_global->add_include_path (ACE::strnew (option + 2)); + idl_global->tao_root (option + 2); } // Add any flags in cpp_args to cpp's arglist. @@ -997,8 +912,3 @@ DRV_pre_proc (const char *myfile) } } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_Env_Value; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -# pragma instantiate ACE_Env_Value -#endif diff --git a/TAO/TAO_IDL/fe/fe_init.cpp b/TAO/TAO_IDL/fe/fe_init.cpp index 7b8cb3ea84f..dfc24977a99 100644 --- a/TAO/TAO_IDL/fe/fe_init.cpp +++ b/TAO/TAO_IDL/fe/fe_init.cpp @@ -72,6 +72,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "utl_identifier.h" #include "global_extern.h" #include "fe_extern.h" +#include "ace/Env_Value_T.h" ACE_RCSID (fe, fe_init, @@ -677,3 +678,112 @@ FE_populate (void) fe_populate_idl_keywords (); } +// Store include paths from the environment variable, if any. +void +FE_store_env_include_paths (void) +{ + ACE_Env_Value incl_paths ("INCLUDE", + (char *) 0); + const char *aggr_str = incl_paths; + + if (aggr_str != 0) + { + char separator; +#if defined (ACE_WIN32) + separator = ';'; +#else + separator = ':'; +#endif + ACE_CString aggr_cstr (aggr_str); + ssize_t pos; + + do + { + pos = aggr_cstr.find (separator); + idl_global->add_include_path (aggr_cstr.substr (0, pos).fast_rep ()); + aggr_cstr = aggr_cstr.substr (pos + 1); + } while (pos != ACE_String_Base_Const::npos); + } +} + +const char * +FE_get_cpp_loc_from_env (void) +{ + const char *cpp_loc = 0; + + // See if TAO_IDL_PREPROCESSOR is defined. + ACE_Env_Value preprocessor ("TAO_IDL_PREPROCESSOR", + (char *) 0); + + // Set cpp_loc to the built in location, unless it has been overriden by + // environment variables. + if (preprocessor != 0) + { + cpp_loc = preprocessor; + } + else + { + // Check for the deprecated CPP_LOCATION environment variable + ACE_Env_Value cpp_path ("CPP_LOCATION", + (char *) 0); + + if (cpp_path != 0) + { + ACE_ERROR ((LM_WARNING, + "WARNING: The environment variable " + "CPP_LOCATION has been deprecated.\n" + " Please use TAO_IDL_PREPROCESSOR " + "instead.\n")); + + cpp_loc = cpp_path; + } + else + { + cpp_loc = idl_global->cpp_location (); + } + } + + return cpp_loc; +} + +const char * +FE_get_cpp_args_from_env (void) +{ + const char *cpp_args = 0; + + // Added some customizable preprocessor options + ACE_Env_Value args1 ("TAO_IDL_PREPROCESSOR_ARGS", + (char *) 0); + + if (args1 != 0) + { + cpp_args = args1; + } + else + { + // Check for the deprecated TAO_IDL_DEFAULT_CPP_FLAGS environment + // variable. + ACE_Env_Value args2 ("TAO_IDL_DEFAULT_CPP_FLAGS", + (char *) 0); + + if (args2 != 0) + { + ACE_ERROR ((LM_WARNING, + "Warning: The environment variable " + "TAO_IDL_DEFAULT_CPP_FLAGS has been " + "deprecated.\n" + " Please use " + "TAO_IDL_PREPROCESSOR_ARGS instead.\n")); + + cpp_args = args2; + } + } + + return cpp_args; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + template class ACE_Env_Value; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +# pragma instantiate ACE_Env_Value +#endif diff --git a/TAO/TAO_IDL/include/fe_extern.h b/TAO/TAO_IDL/include/fe_extern.h index 5ba9d434444..cb76ea7102b 100644 --- a/TAO/TAO_IDL/include/fe_extern.h +++ b/TAO/TAO_IDL/include/fe_extern.h @@ -73,6 +73,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc. TAO_IDL_FE_Export void FE_init (void); TAO_IDL_FE_Export void FE_populate (void); +TAO_IDL_FE_Export void FE_store_env_include_paths (void); +TAO_IDL_FE_Export const char *FE_get_cpp_loc_from_env (void); +TAO_IDL_FE_Export const char *FE_get_cpp_args_from_env (void); class File; -- cgit v1.2.1