diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-12-02 19:33:36 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-12-02 19:33:36 +0000 |
commit | 06d606acee020bac9ab442f125c69388e363c541 (patch) | |
tree | b610489a6caf1b7d09a0eeab7060eed85743aa6c | |
parent | 4ac9602c06b6b4d95121bfd1be5792705ae4cee6 (diff) | |
download | ATCD-06d606acee020bac9ab442f125c69388e363c541.tar.gz |
ChangeLogTag: Thu Dec 2 19:30:21 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 15 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_codegen.cpp | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/driver/drv_preproc.cpp | 380 |
3 files changed, 301 insertions, 97 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 9db8989c82e..2298e862eeb 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,18 @@ +Thu Dec 2 19:30:21 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/be/be_codegen.cpp: + + Fixed generated include in *A.idl, not restored when + previous changes were reversed. + + * TAO_IDL/driver/drv_preproc.cpp(DRV_pre_proc): + + Added code to unlink all temporary files at any point + where this method might bail out. If an automated build + takes place when there is something going wrong in + TAO_IDL preprocessing, a great many temporary files could + have been left over. + Thu Dec 2 14:12:04 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_component/component_ami_rh_exs.cpp: diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index b26290a7faf..e83ede2b755 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -3777,8 +3777,7 @@ TAO_CodeGen::gen_ami_conn_idl_includes (void) this->gen_standard_include ( this->ciao_ami_conn_idl_, - BE_GlobalData::be_get_ciao_exec_idl ( - idl_global->stripped_filename ())); + idl_global->stripped_filename ()->get_string ()); } void diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index 9533ae8caae..da7d481e881 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -110,7 +110,8 @@ char const DIR_DOT_DOT[] = ".."; static char tmp_file [MAXPATHLEN + 1] = { 0 }; static char tmp_ifile[MAXPATHLEN + 1] = { 0 }; -// Lines can be 1024 chars long intially - it will expand as required. +// Lines can be 1024 chars long intially - +// it will expand as required. #define LINEBUF_SIZE 1024 char* drv_line = 0; static size_t drv_line_size = LINEBUF_SIZE + 1; @@ -120,7 +121,8 @@ void DRV_cpp_new_location (char const * new_loc) { ACE::strdelete (const_cast<ACE_TCHAR *> (DRV_arglist[0])); - DRV_arglist[0] = ACE::strnew (ACE_TEXT_CHAR_TO_TCHAR (new_loc)); + DRV_arglist[0] = + ACE::strnew (ACE_TEXT_CHAR_TO_TCHAR (new_loc)); } // Push an argument into the DRV_arglist. @@ -137,7 +139,8 @@ DRV_cpp_putarg (const char *str) throw Bailout (); } - DRV_arglist[DRV_argcount++] = ACE::strnew (ACE_TEXT_CHAR_TO_TCHAR (str)); + DRV_arglist[DRV_argcount++] = + ACE::strnew (ACE_TEXT_CHAR_TO_TCHAR (str)); } // Expand the output argument with the given filename. @@ -146,7 +149,8 @@ DRV_cpp_expand_output_arg (const char *filename) { if (output_arg_format != 0) { - ACE::strdelete (const_cast<ACE_TCHAR *> (DRV_arglist[output_arg_index])); + ACE::strdelete (const_cast<ACE_TCHAR *> ( + DRV_arglist[output_arg_index])); DRV_arglist[output_arg_index] = 0; ACE_NEW (DRV_arglist[output_arg_index], @@ -154,7 +158,8 @@ DRV_cpp_expand_output_arg (const char *filename) + ACE_OS::strlen (filename) + 1]); - ACE_OS::sprintf (const_cast<ACE_TCHAR *> (DRV_arglist[output_arg_index]), + ACE_OS::sprintf (const_cast<ACE_TCHAR *> ( + DRV_arglist[output_arg_index]), ACE_TEXT_CHAR_TO_TCHAR (output_arg_format), ACE_TEXT_CHAR_TO_TCHAR (filename)); } @@ -199,6 +204,7 @@ DRV_get_line (FILE *file) len-= 2; drv_line [len]= '\0'; } + // Check for end-of-line if (len && '\n' == drv_line [len-1]) { @@ -245,8 +251,8 @@ DRV_cpp_init (void) DRV_cpp_putarg (cpp_loc); // Add an option to the IDL compiler to make the TAO version - // available to the user. A XX.YY.ZZ release gets version 0xXXYYZZ, - // for example, 5.1.14 gets 0x050114. + // available to the user. A XX.YY.ZZ release gets + // version 0xXXYYZZ, for example, 5.1.14 gets 0x050114. char version_option[128]; ACE_OS::sprintf (version_option, "-D__TAO_IDL=0x%2.2d%2.2d%2.2d", @@ -257,7 +263,8 @@ DRV_cpp_init (void) DRV_cpp_putarg (version_option); DRV_cpp_putarg ("-I."); - const char *platform_cpp_args = FE_get_cpp_args_from_env (); + const char *platform_cpp_args = + FE_get_cpp_args_from_env (); if (platform_cpp_args == 0) { @@ -279,8 +286,15 @@ DRV_cpp_init (void) if (TAO_ROOT != 0) { - DRV_add_include_path (include_path1, TAO_ROOT, 0, true); - DRV_add_include_path (include_path2, TAO_ROOT, "/tao", true); + DRV_add_include_path (include_path1, + TAO_ROOT, + 0, + true); + + DRV_add_include_path (include_path2, + TAO_ROOT, + "/tao", + true); } else { @@ -288,8 +302,15 @@ DRV_cpp_init (void) if (ACE_ROOT != 0) { - DRV_add_include_path (include_path1, ACE_ROOT, "/TAO", true); - DRV_add_include_path (include_path2, ACE_ROOT, "/TAO/tao", true); + DRV_add_include_path (include_path1, + ACE_ROOT, + "/TAO", + true); + + DRV_add_include_path (include_path2, + ACE_ROOT, + "/TAO/tao", + true); } else { @@ -306,7 +327,10 @@ DRV_cpp_init (void) "/tao", true); #else - DRV_add_include_path (include_path1, ".", 0, true); + DRV_add_include_path (include_path1, + ".", + 0, + true); #endif /* TAO_IDL_INCLUDE_DIR */ } } @@ -315,15 +339,18 @@ DRV_cpp_init (void) } // Add any flags in platform_cpp_args to cpp's DRV_arglist. - ACE_ARGV platform_arglist (ACE_TEXT_CHAR_TO_TCHAR (platform_cpp_args)); + ACE_ARGV platform_arglist ( + ACE_TEXT_CHAR_TO_TCHAR (platform_cpp_args)); for (int i = 0; i < platform_arglist.argc (); ++i) { - // Check for an argument that specifies the preprocessor's output file. + // Check for an argument that specifies + // the preprocessor's output file. if (ACE_OS::strstr (platform_arglist[i], ACE_TEXT ("%s")) != 0 && output_arg_format == 0) { - output_arg_format = ACE::strnew (ACE_TEXT_ALWAYS_CHAR (platform_arglist[i])); + output_arg_format = + ACE::strnew (ACE_TEXT_ALWAYS_CHAR (platform_arglist[i])); output_arg_index = DRV_argcount; DRV_cpp_putarg (0); } @@ -365,7 +392,9 @@ DRV_sweep_dirs (const char *rel_path, { // Skip the ".." and "." files in each directory. if (ACE::isdotdir (dir_entry->d_name) == true) - continue; + { + continue; + } #if defined (ACE_HAS_TCHAR_DIRENT) ACE_CString lname (ACE_TEXT_ALWAYS_CHAR (dir_entry->d_name)); @@ -377,7 +406,8 @@ DRV_sweep_dirs (const char *rel_path, if (ACE_OS::lstat (lname.c_str (), &stat_buf) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "DRV_sweep_dirs: ACE_OS::lstat (%s) failed\n", + "DRV_sweep_dirs: ACE_OS::lstat" + " (%C) failed\n", lname.c_str ()), -1); } @@ -406,7 +436,8 @@ DRV_sweep_dirs (const char *rel_path, if (full_path != 0) { - idl_global->add_include_path (full_path, false); + idl_global->add_include_path (full_path, + false); } include_added = true; @@ -432,7 +463,8 @@ DRV_sweep_dirs (const char *rel_path, if (ACE_OS::chdir (DIR_DOT_DOT) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "DRV_sweep_dirs: chdir .. (from %C) failed\n", + "DRV_sweep_dirs: chdir " + ".. (from %C) failed\n", rel_path), -1); } @@ -441,27 +473,34 @@ DRV_sweep_dirs (const char *rel_path, } ACE_CString& -DRV_add_include_path (ACE_CString& include_path, const char *path, - const char *suffix, bool is_system) +DRV_add_include_path (ACE_CString& include_path, + const char *path, + const char *suffix, + bool is_system) { - if (!path) - return include_path; + if (path == 0) + { + return include_path; + } - const bool needToQuote= (('"' == *path) || ACE_OS::strchr (path, ' ')); - const size_t pathLength= ACE_OS::strlen (path); + const bool needToQuote = + (('"' == *path) || ACE_OS::strchr (path, ' ')); + const size_t pathLength = ACE_OS::strlen (path); const char #if defined (ACE_WIN32) - nativeDir= '\\', - foreignDir= '/'; + nativeDir = '\\', + foreignDir = '/'; #else - nativeDir= '/', - foreignDir= '\\'; + nativeDir = '/', + foreignDir = '\\'; #endif - // Eliminate possible enclosing quotes from the path, and since some compilers - // choke on double directory separators in paths, ensure that the path does not + // 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= + include_path = ACE_CString (path + ('"' == *path), // Skip leading Quote pathLength - ('"' == *path) // Don't count leading Quote @@ -477,28 +516,49 @@ DRV_add_include_path (ACE_CString& include_path, const char *path, ) ) ); - if (suffix) + if (suffix != 0) { - 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 () + && ((nativeDir == *suffix) || (foreignDir == *suffix))) + { + // Path is empty, don't add the + // suffix's leading directory separator. + ++suffix; + } - if (include_path.length () && *suffix && (nativeDir != *suffix) && (foreignDir != *suffix)) - include_path+= nativeDir; // Force a directory seporator + if (include_path.length () + && (*suffix != '\0') + && (nativeDir != *suffix) + && (foreignDir != *suffix)) + { + // Force a directory separator. + include_path += nativeDir; + } - // Add the suffix string to the path, ensuring that foreign directory slashes + // 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; + for ( ; *suffix != '\0'; ++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+= '"'; + { + include_option+= '"'; + } DRV_cpp_putarg (include_option.c_str ()); - idl_global->add_include_path (include_path.c_str (), is_system); + + idl_global->add_include_path (include_path.c_str (), + is_system); return include_path; } @@ -517,7 +577,10 @@ DRV_cpp_post_init (void) // FE_Utils::validate_orb_include accordingly. if (TAO_ROOT != 0) { - DRV_add_include_path (include_path3, TAO_ROOT, "/orbsvcs", true); + DRV_add_include_path (include_path3, + TAO_ROOT, + "/orbsvcs", + true); } else { @@ -526,7 +589,10 @@ DRV_cpp_post_init (void) if (ACE_ROOT != 0) { - DRV_add_include_path (include_path3, ACE_ROOT, "/TAO/orbsvcs", true); + DRV_add_include_path (include_path3, + ACE_ROOT, + "/TAO/orbsvcs", + true); } else { @@ -538,7 +604,10 @@ DRV_cpp_post_init (void) #else // If ACE_ROOT isn't defined either, there will already // be a warning from DRV_preproc(). - DRV_add_include_path (include_path3, ".", 0, true); + DRV_add_include_path (include_path3, + ".", + 0, + true); #endif /* TAO_IDL_INCLUDE_DIR */ } } @@ -550,16 +619,39 @@ DRV_cpp_post_init (void) // FE_Utils::validate_orb_include accordingly. if (CIAO_ROOT != 0) { - DRV_add_include_path (include_path4, CIAO_ROOT, 0, true); - DRV_add_include_path (include_path5, CIAO_ROOT, "/ciao", true); - DRV_add_include_path (include_path5, CIAO_ROOT, "/ccm", true); + DRV_add_include_path (include_path4, + CIAO_ROOT, + 0, + true); + + DRV_add_include_path (include_path5, + CIAO_ROOT, + "/ciao", + true); + + DRV_add_include_path (include_path5, + CIAO_ROOT, + "/ccm", + true); } else if (TAO_ROOT != 0) { - // If CIAO_ROOT hasn't been set, maybe it's nested under TAO_ROOT. - DRV_add_include_path (include_path4, TAO_ROOT, "/CIAO", true); - DRV_add_include_path (include_path5, TAO_ROOT, "/CIAO/ciao", true); - DRV_add_include_path (include_path5, TAO_ROOT, "/CIAO/ccm", true); + // If CIAO_ROOT hasn't been set, + // maybe it's nested under TAO_ROOT. + DRV_add_include_path (include_path4, + TAO_ROOT, + "/CIAO", + true); + + DRV_add_include_path (include_path5, + TAO_ROOT, + "/CIAO/ciao", + true); + + DRV_add_include_path (include_path5, + TAO_ROOT, + "/CIAO/ccm", + true); } else { @@ -568,9 +660,20 @@ DRV_cpp_post_init (void) if (ACE_ROOT != 0) { - DRV_add_include_path (include_path4, ACE_ROOT, "/TAO/CIAO", true); - DRV_add_include_path (include_path5, ACE_ROOT, "/TAO/CIAO/ciao", true); - DRV_add_include_path (include_path5, ACE_ROOT, "/TAO/CIAO/ccm", true); + DRV_add_include_path (include_path4, + ACE_ROOT, + "/TAO/CIAO", + true); + + DRV_add_include_path (include_path5, + ACE_ROOT, + "/TAO/CIAO/ciao", + true); + + DRV_add_include_path (include_path5, + ACE_ROOT, + "/TAO/CIAO/ccm", + true); } else { @@ -579,10 +682,12 @@ DRV_cpp_post_init (void) TAO_IDL_INCLUDE_DIR, 0, true); + DRV_add_include_path (include_path5, TAO_IDL_INCLUDE_DIR, "/ciao", true); + DRV_add_include_path (include_path5, TAO_IDL_INCLUDE_DIR, "/ccm", @@ -590,16 +695,26 @@ DRV_cpp_post_init (void) #else // If ACE_ROOT isn't defined either, there will already // be a warning from DRV_preproc(). - DRV_add_include_path (include_path4, ACE_ROOT, ".", true); - DRV_add_include_path (include_path5, ACE_ROOT, ".", true); + DRV_add_include_path (include_path4, + ACE_ROOT, + ".", + true); + + DRV_add_include_path (include_path5, + ACE_ROOT, + ".", + true); #endif /* TAO_IDL_INCLUDE_DIR */ } } - // Save path of current directory, in case the call to DRV_sweep_dirs() - // below is not a no-op - then the current working directory will + // Save path of current directory, in case + // the call to DRV_sweep_dirs() + // below is not a no-op - then the current + // working directory will // have to be restored. char cwd_path[MAXPATHLEN]; + if (ACE_OS::getcwd (cwd_path, sizeof (cwd_path)) == 0) { ACE_ERROR ((LM_ERROR, @@ -632,20 +747,21 @@ DRV_cpp_post_init (void) } } -namespace // local/internal helper function +// Local/internal helper function. +namespace { // Advances the input char buffer to the first non-white // space character, handles /**/ comments as well. char DRV_skip_over_white_spaces (const char *&input) { - while (*input) + while (*input != 0) { // Skip the spaces, tabs, vertical-tabs and form feeds. while (' ' == *input || '\t' == *input || '\v' == *input || - '\f' == *input ) + '\f' == *input) { ++input; } @@ -659,6 +775,7 @@ namespace // local/internal helper function // end of line). return *input; } + if ('*' != *++input) { // Wasn't the start of a comment so / was the first non-white space character. @@ -672,11 +789,13 @@ namespace // local/internal helper function // Looking for the closing "*/" characters while ('*' != *++input && *input) {} + while ('*' == *input) { ++input; } } while ('/' != *input && *input); + if ('/' == *input) { ++input; @@ -697,17 +816,22 @@ namespace // local/internal helper function { return false; } + // Only want #include to match const char *include_str = "include"; + if (*include_str != DRV_skip_over_white_spaces (++input)) { return false; } + while (*++include_str == *++input && *input) {} + if (*include_str || !*input) { - return false; // Not #include (or it ends before filename given) + // Not #include (or it ends before filename given). + return false; } // Next thing is finding the file that has been `#include'd. Skip @@ -716,9 +840,12 @@ namespace // local/internal helper function return ('"' == start_char || '<' == start_char); } - // We really need to know whether this line is a "#include ...". If - // so, we would like to separate the "file name" and keep that in the - // idl_global. We need them to produce "#include's in the stubs and + // We really need to know whether + // this line is a "#include ...". If + // so, we would like to separate the + // "file name" and keep that in the + // idl_global. We need them to produce + // "#include's in the stubs and // skeletons. void DRV_check_for_include (const char *buf) @@ -728,30 +855,38 @@ namespace // local/internal helper function return; } - // Skip over this leading " or < and copy the filename upto the + // Skip over this leading " or < and + // copy the filename upto the // closing " or > character. const char start_char = *buf++, end_char = ('<' == start_char) ? '>' : start_char; + char incl_file[MAXPATHLEN + 1], *fi = incl_file; - while (*buf && *buf != end_char) + + while (*buf != '\0' && *buf != end_char) { // Put Microsoft-style pathnames into a canonical form. if ('\\' == buf[0] && '\\' == buf [1]) { ++buf; } + *fi++ = *buf++; - if (fi == incl_file + sizeof(incl_file)-1) + + if (fi == incl_file + sizeof (incl_file) - 1) { - break; // Safety valve, filename given was too long! + // Safety valve, filename given was too long! + break; } } + *fi= '\0'; const size_t len = fi - incl_file; - if (!len) + + if (len == 0) { return; // Null filename not allowed. } @@ -762,7 +897,9 @@ namespace // local/internal helper function ACE_CString const win_path ("tao\\orb.idl"); // Some backends pass this file through, others don't. - if (name_str == simple || name_str == nix_path || name_str == win_path) + if (name_str == simple + || name_str == nix_path + || name_str == win_path) { if (idl_global->pass_orb_idl ()) { @@ -773,14 +910,13 @@ namespace // local/internal helper function DRV_get_orb_idl_includes (); } } - // We have special lookup for orb.idl (TAO_ROOT/tao) that // also kicks in for .pidl files. If one of the latter is // included as a local name only, we add the 'tao/' prefix // so the generated C++ include files will be correct. else if ((5 <= len && !ACE_OS::strcmp (incl_file + len - 5, ".pidl")) - && !ACE_OS::strchr (incl_file, '/') - && !ACE_OS::strchr (incl_file, '\\')) + && !ACE_OS::strchr (incl_file, '/') + && !ACE_OS::strchr (incl_file, '\\')) { ACE_CString fixed_name ("tao/"); fixed_name += incl_file; @@ -799,19 +935,24 @@ namespace // local/internal helper function DRV_convert_includes (char *buf) { const char *input = buf; + if (!DRV_find_include_filename (input) || '"' != *input) { return; // Only interested in #include "" type } + buf = const_cast<char *> (input); // Find the closing '"' character. char *open_quote= buf; - while ('"' != *++buf && *buf) + + while ('"' != *++buf && *buf != '\0') { if ('>' == *buf) { - return; // Can't change to #include <> as it has a > character in the filename! + // Can't change to #include <> as it + // has a > character in the filename! + return; } } if ('"' == *buf) @@ -1009,6 +1150,7 @@ DRV_pre_proc (const char *myfile) ACE_OS::strcat (tmp_ifile, tao_idli_template); ACE_HANDLE const ti_fd = ACE_OS::mkstemp (tmp_ifile); + if (ti_fd == ACE_INVALID_HANDLE) { ACE_ERROR ((LM_ERROR, @@ -1020,6 +1162,7 @@ DRV_pre_proc (const char *myfile) } ACE_HANDLE const tf_fd = ACE_OS::mkstemp (tmp_file); + if (tf_fd == ACE_INVALID_HANDLE) { ACE_ERROR ((LM_ERROR, @@ -1027,6 +1170,7 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), tmp_file)); + (void) ACE_OS::unlink (tmp_ifile); throw Bailout (); } @@ -1057,6 +1201,8 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), myfile)); + (void) ACE_OS::unlink (tmp_ifile); + (void) ACE_OS::unlink (tmp_file); throw Bailout (); } @@ -1081,28 +1227,35 @@ DRV_pre_proc (const char *myfile) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unable to construct full file pathname\n"))); + (void) ACE_OS::unlink (tmp_ifile); + (void) ACE_OS::unlink (tmp_file); throw Bailout (); } ACE_NEW (utl_string, UTL_String (main_fullpath, true)); + idl_global->set_main_filename (utl_string); } #else ACE_NEW (utl_string, UTL_String (myfile, true)); + idl_global->set_main_filename (utl_string); #endif ACE_Auto_String_Free safety (ACE_OS::strdup (myfile)); + UTL_String *stripped_tmp = 0; ACE_NEW (stripped_tmp, UTL_String (DRV_stripped_name (safety.get ()), true)); + idl_global->set_stripped_filename (stripped_tmp); UTL_String *real_tmp = 0; ACE_NEW (real_tmp, UTL_String (t_ifile, true)); + idl_global->set_real_filename (real_tmp); // We use ACE instead of the (low level) fork facilities, this also @@ -1113,8 +1266,10 @@ DRV_pre_proc (const char *myfile) DRV_cpp_putarg (t_ifile); DRV_cpp_putarg (0); // Null terminate the DRV_arglist. - // For complex builds, the default command line buffer size of 1024 - // is often not enough. We determine the required space and arg nr + // For complex builds, the default + // command line buffer size of 1024 + // is often not enough. We determine + // the required space and arg nr // dynamically here. ACE_Process_Options cpp_options (1, // Inherit environment. DRV_cpp_calc_total_argsize (), @@ -1128,6 +1283,9 @@ DRV_pre_proc (const char *myfile) ACE_TEXT ("%C: command line processing \"%s\" failed\n"), idl_global->prog_name (), DRV_arglist[0])); + + (void) ACE_OS::unlink (tmp_ifile); + (void) ACE_OS::unlink (tmp_file); throw Bailout (); } @@ -1137,23 +1295,29 @@ DRV_pre_proc (const char *myfile) if (ACE_OS::rename (tmp_file, t_file) != 0) { ACE_ERROR ((LM_ERROR, - "%C: Unable to rename temporary file \"%C\" to \"%C\": %p\n", + "%C: Unable to rename temporary " + "file \"%C\" to \"%C\": %p\n", idl_global->prog_name (), tmp_file, t_file)); + (void) ACE_OS::unlink (tmp_ifile); + (void) ACE_OS::unlink (tmp_file); throw Bailout (); } + if (ACE_OS::rename (tmp_ifile, t_ifile) != 0) { ACE_ERROR ((LM_ERROR, - "%C: Unable to rename temporary file \"%C\" to \"%C\": %p\n", + "%C: Unable to rename temporary " + "file \"%C\" to \"%C\": %p\n", idl_global->prog_name (), tmp_ifile, t_ifile)); - + (void) ACE_OS::unlink (tmp_ifile); + (void) ACE_OS::unlink (t_file); throw Bailout (); } @@ -1182,10 +1346,13 @@ DRV_pre_proc (const char *myfile) if (fd == ACE_INVALID_HANDLE) { ACE_ERROR ((LM_ERROR, - "%C: cannot open temp file \"%C\" for writing: %p\n", + "%C: cannot open temp file" + " \"%C\" for writing: %p\n", idl_global->prog_name (), t_file)); + (void) ACE_OS::unlink (t_file); + (void) ACE_OS::unlink (t_ifile); throw Bailout (); } @@ -1198,6 +1365,7 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), cpp_options.command_line_buf ())); } + if (process.spawn (cpp_options) == ACE_INVALID_PID) { ACE_ERROR ((LM_ERROR, @@ -1206,6 +1374,8 @@ DRV_pre_proc (const char *myfile) DRV_arglist[0])); + (void) ACE_OS::unlink (t_file); + (void) ACE_OS::unlink (t_ifile); throw Bailout (); } @@ -1219,14 +1389,18 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), t_file)); + (void) ACE_OS::unlink (t_file); + (void) ACE_OS::unlink (t_ifile); throw Bailout (); } } - // Remove the null termination and the input file from the DRV_arglist, + // Remove the null termination and the + // input file from the DRV_arglist, // the next file will the previous args. DRV_argcount -= 2; - ACE::strdelete (const_cast<ACE_TCHAR *> (DRV_arglist[DRV_argcount])); + ACE::strdelete ( + const_cast<ACE_TCHAR *> (DRV_arglist[DRV_argcount])); DRV_arglist[DRV_argcount] = 0; ACE_exitcode status = 0; @@ -1236,6 +1410,8 @@ DRV_pre_proc (const char *myfile) "%C: wait for child process failed\n", idl_global->prog_name ())); + (void) ACE_OS::unlink (t_file); + (void) ACE_OS::unlink (t_ifile); throw Bailout (); } @@ -1247,10 +1423,13 @@ DRV_pre_proc (const char *myfile) errno = WEXITSTATUS ((status)); ACE_ERROR ((LM_ERROR, - "%C: preprocessor \"%s\" returned with an error\n", + "%C: preprocessor \"%s\" " + "returned with an error\n", idl_global->prog_name (), DRV_arglist[0])); + (void) ACE_OS::unlink (t_file); + (void) ACE_OS::unlink (t_ifile); throw Bailout (); } } @@ -1265,10 +1444,14 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), DRV_arglist[0])); + (void) ACE_OS::unlink (t_file); + (void) ACE_OS::unlink (t_ifile); throw Bailout (); } - // TODO: Manage problems in the pre-processor, in the previous - // version the current process would exit if the pre-processor + // TODO: Manage problems in the + // pre-processor, in the previous + // version the current process + // would exit if the pre-processor // returned with error. #if defined (ACE_OPENVMS) @@ -1280,10 +1463,13 @@ DRV_pre_proc (const char *myfile) if (yyin == 0) { ACE_ERROR ((LM_ERROR, - "%C: Could not open cpp output file \"%C\": %p\n", + "%C: Could not open cpp " + "output file \"%C\": %p\n", idl_global->prog_name (), t_file)); + (void) ACE_OS::unlink (t_file); + (void) ACE_OS::unlink (t_ifile); throw Bailout (); } @@ -1298,10 +1484,13 @@ DRV_pre_proc (const char *myfile) if (preproc == 0) { ACE_ERROR ((LM_ERROR, - "%C: Could not open cpp output file \"$C\": %p\n", + "%C: Could not open cpp " + "output file \"$C\": %p\n", idl_global->prog_name (), t_file)); + (void) ACE_OS::unlink (t_file); + (void) ACE_OS::unlink (t_ifile); throw Bailout (); } @@ -1319,10 +1508,9 @@ DRV_pre_proc (const char *myfile) sizeof (char), ACE_MAXLOGMSGLEN - 1, preproc)) - != 0) + != 0) { buffer[bytes] = 0; - ACE_DEBUG ((LM_DEBUG, buffer)); } @@ -1332,7 +1520,8 @@ DRV_pre_proc (const char *myfile) if (ACE_OS::unlink (t_ifile) == -1) { ACE_ERROR ((LM_ERROR, - "%C: Could not remove cpp input file \"%C\": %p\n", + "%C: Could not remove cpp " + "input file \"%C\": %p\n", idl_global->prog_name (), t_ifile)); @@ -1342,7 +1531,8 @@ DRV_pre_proc (const char *myfile) if (ACE_OS::unlink (t_file) == -1) { ACE_ERROR ((LM_ERROR, - "%C: Could not remove cpp output file \"%C\": %p\n", + "%C: Could not remove cpp " + "output file \"%C\": %p\n", idl_global->prog_name (), t_file)); |