[omniORB] [PATCH] To use omniORB2 on Redhat 5 and egcs snapshots

Sai-Lai Lo S.Lo@orl.co.uk
Wed, 25 Mar 1998 17:35:17 GMT


With the patch included below, I'm able to run all the tests in the
omniORB2_testsuite successfully.

The platform configuration is:

- x86 Redhat 5.0
- binutils-2.8.1.0.23
- egcs-980302           ( which support thread-safe exception handling)

The patch introduces a workaround to a bug in egcs-98* snapshots. The bug
causes the compiler to generate the wrong code which in turn causes
eg3_{clt,impl} to hang.

Sai-Lai


--------------------------
diff -r -c omniORB_2.5.0/include/omniORB2/CORBA_sysdep.h newsrc/include/omniORB2/CORBA_sysdep.h
*** omniORB_2.5.0/include/omniORB2/CORBA_sysdep.h	Tue Jan 20 20:15:52 1998
--- newsrc/include/omniORB2/CORBA_sysdep.h	Wed Mar 25 17:19:25 1998
***************
*** 32,40 ****
  
  /*
   $Log: CORBA_sysdep.h,v $
!  * Revision 1.14  1998/01/20  16:45:57  sll
!  * Added support for OpenVMS.
!  *
   Revision 1.13  1997/12/09 20:40:21  sll
   Various platform specific updates.
  
--- 32,45 ----
  
  /*
   $Log: CORBA_sysdep.h,v $
!  Revision 1.15  1998/03/25 14:24:12  sll
!  Added #define EGCS_WORKAROUND for gcc compiler. This activate a
!  workaround for a bug in post-1.0 egcs snapshots. Can be removed if
!  the bug is fixed in future version.
! 
!  Revision 1.14  1998/01/20 16:45:57  sll
!  Added support for OpenVMS.
! 
   Revision 1.13  1997/12/09 20:40:21  sll
   Various platform specific updates.
  
***************
*** 61,66 ****
--- 66,76 ----
  #     define SIZEOF_INT  4
  #     define SIZEOF_PTR  8
  #  endif
+ 
+ // Activate temporary workaround for a bug in post-1.0 egcs snapshots
+ // No side-effect on other gcc compilers. May be removed in future once
+ // the bug is fixed.
+ #define EGCS_WORKAROUND
  
  #elif defined(__DECCXX)
  // DEC C++ compiler
diff -r -c omniORB_2.5.0/src/lib/omniORB2/corbaObject.cc newsrc/src/lib/omniORB2/corbaObject.cc
*** omniORB_2.5.0/src/lib/omniORB2/corbaObject.cc	Fri Feb 27 13:59:00 1998
--- newsrc/src/lib/omniORB2/corbaObject.cc	Wed Mar 25 17:18:01 1998
***************
*** 29,34 ****
--- 29,37 ----
   
  /*
    $Log: corbaObject.cc,v $
+   Revision 1.11  1998/03/25 14:20:51  sll
+   Temporary work-around for egcs compiler.
+ 
    Revision 1.10  1998/02/27 13:58:55  sll
    _is_equivalent() now returns the correct answer when a proxy object
    is tested against its colocated object implmentation. This situation will
***************
*** 232,238 ****
--- 235,245 ----
    }
  
    CORBA::ULong   _retries = 0;
+ #ifndef EGCS_WORKAROUND
  NONEXIST_again:
+ #else
+ while(1) {
+ #endif
    omniRopeAndKey _r;
    CORBA::Boolean _fwd = objptr->getRopeAndKey(_r);
    CORBA::Boolean _reuse = 0;
***************
*** 309,315 ****
--- 316,326 ----
      if (!_omni_callSystemExceptionHandler(objptr,_retries++,ex))
        throw;
    }
+ #ifndef EGCS_WORKAROUND
    goto NONEXIST_again;
+ #else
+ }
+ #endif
  #ifdef NEED_DUMMY_RETURN
    {
      // never reach here! Dummy return to keep some compilers happy.
*** omniORB_2.5.0/src/lib/omniORB2/object.cc	Fri Feb 27 13:59:34 1998
--- newsrc/src/lib/omniORB2/object.cc	Wed Mar 25 17:18:01 1998
***************
*** 29,34 ****
--- 29,40 ----
   
  /*
    $Log: object.cc,v $
+   Revision 1.12  1998/03/25 14:20:36  sll
+   Temporary work-around for egcs compiler.
+ 
+   Revision 1.11  1998/03/19 15:22:47  sll
+   Fixed so that omniObject ctor would not reject zero length key.
+ 
    Revision 1.10  1998/02/27 13:59:30  sll
    Minor update to cope with the change of manager() to _objectManager() in
    class omniObject.
***************
*** 97,104 ****
  	       IOP::TaggedProfileList *profiles,
  	       CORBA::Boolean release)
  {
!   if (!repoId || !r || !key || !keysize || !profiles)
      throw CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO);
  
    pd_repoIdsize = strlen(repoId)+1;
    pd_repoId = new char[pd_repoIdsize];
--- 103,112 ----
  	       IOP::TaggedProfileList *profiles,
  	       CORBA::Boolean release)
  {
!   if (!repoId || !r || !profiles)
      throw CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO);
+   // keysize may be >= 0, key may be nil.
+ 
  
    pd_repoIdsize = strlen(repoId)+1;
    pd_repoId = new char[pd_repoIdsize];
***************
*** 125,134 ****
        if (!pd_iopprofile)
  	throw CORBA::NO_MEMORY(0,CORBA::COMPLETED_NO);
        pd_objkeysize = keysize;
!       pd_objkey.foreign = new CORBA::Octet[keysize];
!       if (!pd_objkey.foreign)
! 	throw CORBA::NO_MEMORY(0,CORBA::COMPLETED_NO);
!       memcpy((void *)pd_objkey.foreign,(const void *)key,keysize);
      }
      catch (...) {
        delete [] pd_repoId;
--- 133,144 ----
        if (!pd_iopprofile)
  	throw CORBA::NO_MEMORY(0,CORBA::COMPLETED_NO);
        pd_objkeysize = keysize;
!       if (keysize) {
! 	pd_objkey.foreign = new CORBA::Octet[keysize];
! 	if (!pd_objkey.foreign)
! 	  throw CORBA::NO_MEMORY(0,CORBA::COMPLETED_NO);
! 	memcpy((void *)pd_objkey.foreign,(const void *)key,keysize);
!       }
      }
      catch (...) {
        delete [] pd_repoId;
***************
*** 430,436 ****
--- 440,450 ----
      {
        // Use GIOP LocateRequest to verify that the object exists.
        CORBA::ULong retries = 0;
+ #ifndef EGCS_WORKAROUND
  AOE_again:
+ #else
+ while (1) {
+ #endif
        omniRopeAndKey rak;
        CORBA::Boolean fwd = getRopeAndKey(rak);
        CORBA::Boolean reuse = 0;
***************
*** 493,499 ****
--- 507,517 ----
  	if (!_omni_callSystemExceptionHandler(this,retries++,ex))
  	  throw;
        }
+ #ifndef EGCS_WORKAROUND
        goto AOE_again;
+ #else
+ }
+ #endif
      }
    return;
  }
***************
*** 526,532 ****
--- 544,554 ----
    }
  
    CORBA::ULong   _retries = 0;
+ #ifndef EGCS_WORKAROUND
  ISA_again:
+ #else
+ while(1) {
+ #endif
    omniRopeAndKey _r;
    CORBA::Boolean _fwd = getRopeAndKey(_r);
    CORBA::Boolean _reuse = 0;
***************
*** 606,612 ****
--- 628,638 ----
      if (!_omni_callSystemExceptionHandler(this,_retries++,ex))
        throw;
    }
+ #ifndef EGCS_WORKAROUND
    goto ISA_again;
+ #else
+ }
+ #endif
  #ifdef NEED_DUMMY_RETURN
    {
      // never reach here! Dummy return to keep some compilers happy.
diff -r -c omniORB_2.5.0/src/tool/omniidl2/omniORB2_be/o2be_attribute.cc newsrc/src/tool/omniidl2/omniORB2_be/o2be_attribute.cc
*** omniORB_2.5.0/src/tool/omniidl2/omniORB2_be/o2be_attribute.cc	Tue Jan 27 16:34:33 1998
--- newsrc/src/tool/omniidl2/omniORB2_be/o2be_attribute.cc	Wed Mar 25 17:18:47 1998
***************
*** 27,35 ****
  
  /*
    $Log: o2be_attribute.cc,v $
! // Revision 1.14  1998/01/27  16:34:29  ewc
! //  Added support for type any and TypeCode
! //
    Revision 1.13  1997/12/10 11:35:10  sll
    Updated life cycle service stub.
  
--- 27,41 ----
  
  /*
    $Log: o2be_attribute.cc,v $
!   Revision 1.16  1998/03/25 14:39:12  sll
!   *** empty log message ***
! 
!   Revision 1.15  1998/03/25 14:19:50  sll
!   Temporary work-around for egcs compiler.
! 
!   Revision 1.14  1998/01/27 16:34:29  ewc
!    Added support for type any and TypeCode
! 
    Revision 1.13  1997/12/10 11:35:10  sll
    Updated life cycle service stub.
  
***************
*** 168,174 ****
--- 174,184 ----
    s << " {\n";
    INC_INDENT_LEVEL();
    IND(s); s << "CORBA::ULong _0RL_retries = 0;\n";
+   s << "#ifndef EGCS_WORKAROUND\n";
    s << "_0RL_again:\n";
+   s << "#else\n";
+   s << "while(1) {\n";
+   s << "#endif\n";
    IND(s); s << "assertObjectExistent();\n";
    IND(s); s << "omniRopeAndKey _0RL_r;\n";
    IND(s); s << "CORBA::Boolean _0RL_fwd = getRopeAndKey(_0RL_r);\n";
***************
*** 524,530 ****
--- 534,544 ----
      IND(s); s << "}\n";
    }
  
+   s << "#ifndef EGCS_WORKAROUND\n";
    IND(s); s << "goto _0RL_again;\n";
+   s << "#else\n";
+   s << "}\n";
+   s << "#endif\n";
  
    s << "#ifdef NEED_DUMMY_RETURN\n";
    IND(s); s << "{\n";
***************
*** 608,614 ****
--- 622,632 ----
    s << " {\n";
    INC_INDENT_LEVEL();
    IND(s); s << "CORBA::ULong _0RL_retries = 0;\n";
+   s << "#ifndef EGCS_WORKAROUND\n";
    s << "_0RL_again:\n";
+   s << "#else\n";
+   s << "while(1) {\n";
+   s << "#endif\n";
    IND(s); s << "assertObjectExistent();\n";
    IND(s); s << "omniRopeAndKey _0RL_r;\n";
    IND(s); s << "CORBA::Boolean _0RL_fwd = getRopeAndKey(_0RL_r);\n";
***************
*** 774,780 ****
--- 792,802 ----
    DEC_INDENT_LEVEL();
    IND(s); s << "}\n";
  
+   s << "#ifndef EGCS_WORKAROUND\n";
    IND(s); s << "goto _0RL_again;\n";
+   s << "#else\n";
+   s << "}\n";
+   s << "#endif\n";
    DEC_INDENT_LEVEL();
    IND(s);s << "}\n";
    return;
***************
*** 1030,1036 ****
--- 1052,1062 ----
    s << " {\n";
    INC_INDENT_LEVEL();
    IND(s); s << "CORBA::ULong _0RL_retries = 0;\n";
+   s << "#ifndef EGCS_WORKAROUND\n";
    s << "_0RL_again:\n";
+   s << "#else\n";
+   s << "while(1) {\n";
+   s << "#endif\n";
    IND(s); s << "assertObjectExistent();\n";
    IND(s); s << "omniRopeAndKey _0RL_r;\n";
    IND(s); s << "CORBA::Boolean _0RL_fwd = getRopeAndKey(_0RL_r);\n";
***************
*** 1414,1420 ****
--- 1440,1450 ----
      IND(s); s << "}\n";
    }
  
+   s << "#ifndef EGCS_WORKAROUND\n";
    IND(s); s << "goto _0RL_again;\n";
+   s << "#else\n";
+   s << "}\n";
+   s << "#endif\n";
  
    s << "#ifdef NEED_DUMMY_RETURN\n";
    IND(s); s << "{\n";
***************
*** 1497,1503 ****
--- 1527,1537 ----
    s << " {\n";
    INC_INDENT_LEVEL();
    IND(s); s << "CORBA::ULong _0RL_retries = 0;\n";
+   s << "#ifndef EGCS_WORKAROUND\n";
    s << "_0RL_again:\n";
+   s << "#else\n";
+   s << "while(1) {\n";
+   s << "#endif\n";
    IND(s); s << "assertObjectExistent();\n";
    IND(s); s << "omniRopeAndKey _0RL_r;\n";
    IND(s); s << "CORBA::Boolean _0RL_fwd = getRopeAndKey(_0RL_r);\n";
***************
*** 1697,1703 ****
--- 1731,1742 ----
    DEC_INDENT_LEVEL();
    IND(s); s << "}\n";
  
+   s << "#ifndef EGCS_WORKAROUND\n";
    IND(s); s << "goto _0RL_again;\n";
+   s << "#else\n";
+   s << "}\n";
+   s << "#endif\n";
+ 
    DEC_INDENT_LEVEL();
    IND(s);s << "}\n";
    return;
diff -r -c omniORB_2.5.0/src/tool/omniidl2/omniORB2_be/o2be_operation.cc newsrc/src/tool/omniidl2/omniORB2_be/o2be_operation.cc
*** omniORB_2.5.0/src/tool/omniidl2/omniORB2_be/o2be_operation.cc	Tue Jan 27 16:47:36 1998
--- newsrc/src/tool/omniidl2/omniORB2_be/o2be_operation.cc	Wed Mar 25 17:18:46 1998
***************
*** 28,36 ****
  
  /*
    $Log: o2be_operation.cc,v $
! // Revision 1.19  1998/01/27  16:47:25  ewc
! // Added support for type Any and TypeCode
! //
  // Revision 1.18  1998/01/21  12:14:16  sll
  // Now accepts null pointer as marshalling argument. Substituted with a
  // proper nil string.  Print a warning if traceLevel > 1.
--- 28,42 ----
  
  /*
    $Log: o2be_operation.cc,v $
!   Revision 1.21  1998/03/25 14:40:11  sll
!   *** empty log message ***
! 
!   Revision 1.20  1998/03/25 14:18:57  sll
!   Temporary work-around for egcs compiler.
! 
!   Revision 1.19  1998/01/27 16:47:25  ewc
!   Added support for type Any and TypeCode
! 
  // Revision 1.18  1998/01/21  12:14:16  sll
  // Now accepts null pointer as marshalling argument. Substituted with a
  // proper nil string.  Print a warning if traceLevel > 1.
***************
*** 254,260 ****
--- 260,270 ----
    IND(s); s << "{\n";
    INC_INDENT_LEVEL();
    IND(s); s << "CORBA::ULong _0RL_retries = 0;\n";
+   s << "#ifndef EGCS_WORKAROUND\n";
    s << "_0RL_again:\n";
+   s << "#else\n";
+   s << "while(1) {\n";
+   s << "#endif\n";
    IND(s); s << "assertObjectExistent();\n";
    IND(s); s << "omniRopeAndKey _0RL_r;\n";
    IND(s); s << "CORBA::Boolean _0RL_fwd = getRopeAndKey(_0RL_r);\n";
***************
*** 1133,1139 ****
--- 1143,1153 ----
    DEC_INDENT_LEVEL();
    IND(s); s << "}\n";
  
+   s << "#ifndef EGCS_WORKAROUND\n";
    IND(s); s << "goto _0RL_again;\n";
+   s << "#else\n";
+   s << "}\n";
+   s << "#endif\n";
  
    if (!return_is_void())
      {
***************
*** 1671,1677 ****
--- 1685,1695 ----
    IND(s); s << "{\n";
    INC_INDENT_LEVEL();
    IND(s); s << "CORBA::ULong _0RL_retries = 0;\n";
+   s << "#ifndef EGCS_WORKAROUND\n";
    s << "_0RL_again:\n";
+   s << "#else\n";
+   s << "while(1) {\n";
+   s << "#endif\n";
    IND(s); s << "assertObjectExistent();\n";
    IND(s); s << "omniRopeAndKey _0RL_r;\n";
    IND(s); s << "CORBA::Boolean _0RL_fwd = getRopeAndKey(_0RL_r);\n";
***************
*** 2613,2619 ****
--- 2631,2641 ----
    DEC_INDENT_LEVEL();
    IND(s); s << "}\n";
  
+   s << "#ifndef EGCS_WORKAROUND\n";
    IND(s); s << "goto _0RL_again;\n";
+   s << "#else\n";
+   s << "}\n";
+   s << "#endif\n";
  
    if (!return_is_void())
      {