Issue 31648

Summary: C++: Forte 6 Update 2 problem in connectivity/source/drivers/file/FStatement.cxx
Product: porting Reporter: pavel
Component: codeAssignee: pavel
Status: CLOSED IRREPRODUCIBLE QA Contact: issues@porting <issues>
Severity: Trivial    
Priority: P3 CC: issues
Version: current   
Target Milestone: OOo 2.0   
Hardware: All   
OS: Solaris   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
Small patch
none
patch no. 1, using ::std::for_each
none
patch no. 1, using ::std::copy
none
patch no. 1, using while none

Description pavel 2004-07-17 21:04:18 UTC
Hi,

this is for C++ expert ;-)

I'm doing build QA on 20040704 with Forte C++ 6 Update 2 on Solaris/SPARC.

oo@ultra:/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/connectivity/source/drivers/file>
dmake
--- EXCEPTIONSFILES ---
------------------------------
Making: ../../../unxsols4.pro/slo/FStatement.obj
CC  -c -temp=/tmp -I.  -I. -I../inc -I../../inc -I../../../inc
-I../../../unx/inc -I../../../unxsols4.pro/inc -I.
-I/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/solver/680/unxsols4.pro/inc/stl
-I/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/solver/680/unxsols4.pro/inc/external
-I/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/solver/680/unxsols4.pro/inc
-I/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/solenv/unxsols4/inc
-I/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/solenv/inc
-I/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/res
-I/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/solver/680/unxsols4.pro/inc/stl/SC5
 -I/include -I/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/solenv/inc/Xp31
-I/usr/java/include -I/usr/java/include/solaris
-I/usr/java/include/native_threads/include     -I. -I../../../res -I. -xarch=v8
-xO3 -xspace   -features=no%altspell -library=no%Cstd   -instances=static -KPIC
-mt -DSOLARIS -DUNX -DVCL -DC52 -DC52 -DSPARC -DCVER=C52 -D_USE_NAMESPACE
-D_PTHREADS -DSYSV -DSUN -DSUN4 -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
-DSTLPORT_VERSION=400 -D__DMAKE -DUNIX -DCPPU_ENV=sunpro5 -DSUPD=680 -DPRODUCT
-DNDEBUG -DPRODUCT_FULL -DOSL_DEBUG_LEVEL=0 -DOPTIMIZE -DEXCEPTIONS_ON -DCUI
-DSOLAR_JAVA -DSRC680   -DSHAREDLIB -D_DLL_  -DMULTITHREAD  -o
../../../unxsols4.pro/slo/FStatement.o
/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/connectivity/source/drivers/file/FStatement.cxx
"/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/solver/680/unxsols4.pro/inc/comphelper/propertycontainer.hxx",
line 130: Warning: comphelper::OPropertyContainer::getFastPropertyValue hides
the virtual function cppu::OPropertySetHelper::getFastPropertyValue(long).
"/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/connectivity/source/drivers/file/FStatement.cxx",
line 627: Error: Could not find a match for _STL::vector<String,
_STL::allocator<String>>::insert(String*, const rtl::OUString*, const
rtl::OUString*).
1 Error(s) and 1 Warning(s) detected.
dmake:  Error code 1, while making '../../../unxsols4.pro/slo/FStatement.obj'
'---* TG_SLO.MK *---'
dmake:  Error code 255, while making 'do_it_exceptions'
'---* TG_SLO.MK *---'

The attached patch fixes this problem for me/my compiler. Please decide.
Comment 1 pavel 2004-07-17 21:05:06 UTC
Created attachment 16550 [details]
Small patch
Comment 2 pavel 2004-07-17 21:05:39 UTC
set target
Comment 3 Martin Hollmichel 2004-07-19 11:44:47 UTC
Frank, can you please have a closer look ?
Comment 4 Frank Schönheit 2004-07-19 14:23:37 UTC
Pavel, I don't think this is a good idea. The line in question already was in
the form you're suggesting, in revision 1.31. You're working on 1.31.28.1 (if I
am correct), which touched exactly this one line which causes you trouble. We
shouldn't change this back, as Caolans change was resonable.

I am unsure about how to fix this (the original form should do), perhaps
something like:
  copy( pBegin, pEnd, ::std::back_insert_iterator< ::std::vector< String > >(
    aColumnNameList ) );

If your compiler also doesn't accept this .... hmm.

struct ConvertStringAndInsert : public ::std::unary_function< ::rtl::OUString,
                                   String >
{
  private:
    back_insert_iterator< ::std::vector< String > > m_aInserter;

  public:
    ConvertStringAndInsert( back_insert_iterator< ::std::vector< String > >
      _rInserter ) : m_aInserter( _rInserter ) { }

    String operator()( const ::rtl::OUString& _rToConvert )
    {
      // implicit conversion to String, and insertion
      *m_aInserter = rToConvert;
      // use *m_aInserter = String( rToConvert ); if the implicit conversion
      // does not work.
    }
};

::std::for_each( pBegin, pEnd, back_insert_iterator< ::std::vector< String > >(
  aColumnNameList ) );

And no, I did *not* actually test whether this complies, but will do if required :)
Comment 5 Frank Schönheit 2004-07-19 14:27:02 UTC
> struct ConvertStringAndInsert : public ::std::unary_function< ::rtl::OUString,
                                   String >
> ...
> String operator()( const ::rtl::OUString& _rToConvert )

replace "String" with "void" here ....

> ::std::for_each( pBegin, pEnd, back_insert_iterator< ::std::vector< String >
> >( aColumnNameList ) );

Place a "ConvertStringAndInsert( " before "back_", and add the missing bracket
at the end ....

Oh, and the trivial and boring solution :) would be something like
while ( pBegin != pEnd )
  aColumnNameList.push_back( String( *pBegin++ ) );
Comment 6 pavel 2004-07-19 15:12:07 UTC
fs: I'd be glad if you could test it, because I'm in the middle of build (which
means ~4 days cycle) on my slow Ultra.

I looked back at 1.1.2 where I compiled successfully. Of course we can always
tell that this is bug in the compiler and deprecate it ;-)
Comment 7 Frank Schönheit 2004-07-19 16:02:06 UTC
Created attachment 16584 [details]
patch no. 1, using ::std::for_each
Comment 8 Frank Schönheit 2004-07-19 16:02:11 UTC
Created attachment 16585 [details]
patch no. 1, using ::std::copy
Comment 9 Frank Schönheit 2004-07-19 16:02:17 UTC
Created attachment 16586 [details]
patch no. 1, using while
Comment 10 Frank Schönheit 2004-07-19 16:04:26 UTC
No. 1 is the most STL-ish one, and should compile everywhere. No. 3 is without
STL, and should compile everywhere.
No. 2 is the most elegant one IMO :), but may not compile everywhere.

All three patches compile on wntmsci8, going to verify unxlngi5.
Comment 11 Frank Schönheit 2004-07-19 16:14:41 UTC
All three patches also compile on unxlngi5, so take whatever your compiler
accepts (my personal ranking would probably be 2, 3, 1)

> Of course we can always tell that this is bug in the compiler and deprecate it
> ;-)

Nah - isn't it that "the compiler is always right!"? :)
Comment 12 Frank Schönheit 2004-07-20 11:40:10 UTC
Pavel, can you please check which patch works for you, and close this bug (if at
least one does :), or reassign back to me?
Comment 13 pavel 2004-07-20 17:21:25 UTC
OK, My build compelted so here are the sesults of tests. All done on 20040704
code just before closing.

My compiler:

oo@ultra:/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/connectivity/source/drivers/file>
CC -V
CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-10 2002/09/16
oo@ultra:/ultra/BuildDir/ooo_cws_src680_ooo20040704_src/connectivity/source/drivers/file>


I tried all patches and all compiles without problem.

So can we implement at least one of them to CVS?

Lowering prio, fixes (4 of them!) are known.
Comment 14 Frank Schönheit 2004-07-21 07:02:18 UTC
Since the "bug" was introduced with revision 1.31.28.1, on branch
cws_src680_ooo20040704, I suggest we also fix it on this branch. Do you have
checkin permissions, Pavel? Is this branch still open?
Comment 15 pavel 2004-07-21 07:03:40 UTC
It is closed unfortunately :-(
Comment 16 Frank Schönheit 2004-07-21 07:18:27 UTC
Looking into EIS, it seems there is no successor in place, yet. So I suggest
waiting until it *is*, and then checking in.
(I have no other bug fixing CWS at hand at the moment, else I'd suggest to put
it in *somewhere* ....)
Comment 17 pavel 2004-07-21 16:49:09 UTC
Ok, I will commit patch nr. 2 (this was your highest rank ;-) to the next cws
opened.

Thanks!
Comment 18 pavel 2004-10-07 21:15:58 UTC
It is fixed now by rewriting the source code (in SRC680_m55).
Comment 19 pavel 2004-10-08 17:23:21 UTC
.
Comment 20 wingmogoldgeld 2010-11-10 17:38:12 UTC
Created attachment 73542