You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by xe...@xml.apache.org on 2004/10/19 19:03:52 UTC

[jira] Closed: (XERCESC-355) illegal attempt to delete void* in src/util/RefHashTableOf.c

Message:

   The following issue has been closed.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCESC-355

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCESC-355
    Summary: illegal attempt to delete void* in src/util/RefHashTableOf.c
       Type: Bug

     Status: Closed
 Resolution: WON'T FIX

    Project: Xerces-C++
 Components: 
             Build
   Versions:
             1.6.0

   Assignee: 
   Reporter: Mike Lessacher

    Created: Wed, 6 Mar 2002 10:26 AM
    Updated: Tue, 19 Oct 2004 10:03 AM
Environment: Operating System: Other
Platform: HP

Description:
*** PROBLEM

The compiler barfs at attempts to delete void* in RefHashTableOf.c. The problem 
lines are 205, 257, and 346. The problem is exhibited when these templates are 
instantiated with TVal=void, e.g. in DocumentImpl.cpp, DocumentImpl::setUserData
().

Deleting a void* is explicitly forbidden by the ASNCI C++ standard, section 
5.3.5, para 5, note 73.

*** SOLUTION

I have implemented a local solution as follows:

1. Change the code at lines 205, 257, and 346 mentioned above, which are all of 
the form "delete XXX;", to "DeleteIfNotVoid(XXX);".

2. Insert the following above line 187 in RefHashTableOf.c:

template <class T> inline void DeleteIfNotVoid(T* t) { delete t; }
template <> inline void DeleteIfNotVoid<void>(void*) { }

The above template and its void specialization will ensure that we do not 
attempt to delete objects of type void.

*** ENVIRONMENT

I am building on HP-UX 10.20 (uname -a = "HP-UX hibds012 B.10.20 A 9000/821 
2013082413 two-user license").

I am using aCC version "HP ANSI C++ B3910B A.01.21".

My parameters to runConfigure were "-php-10 -ccc -xaCC -minmem -nfileonly -
tnative -rpthread -z'+p -z -D_REENTRANT'"

*** EXAMPLE

Here is an example of the build failure:

% gmake
mkdir -p /tmp/x/include/dom
cp -fp DOM.hpp DOMString.hpp DOM_Attr.hpp DOM_CDATASection.hpp 
DOM_CharacterData.hpp DOM_Comment.hpp DOM_DOMException.hpp 
DOM_DOMImplementation.hpp DOM_Document.hpp DOM_DocumentFragment.hpp 
DOM_DocumentType.hpp DOM_Element.hpp DOM_Entity.hpp DOM_EntityReference.hpp 
DomMemDebug.hpp DOM_NamedNodeMap.hpp DOM_Node.hpp DOM_NodeFilter.hpp 
DOM_NodeIterator.hpp DOM_NodeList.hpp DOM_Notation.hpp 
DOM_ProcessingInstruction.hpp DOM_Range.hpp DOM_RangeException.hpp DOM_Text.hpp 
DOM_TreeWalker.hpp DOM_XMLDecl.hpp  /tmp/x/include/dom
aCC -D_HP_UX -DHPaCC -DHPUX10 +DAportable +Z -c +p -D_REENTRANT -O -
DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_DCE   -
I/tmp/x/include  -o /tmp/x/obj/HPUX/DocumentImpl.o DocumentImpl.cpp
Error 251: "/tmp/x/include/util/RefHashTableOf.c", line 205 # An object cannot 
be deleted using a
    pointer of type 'void *' since the type of the object allocated is unknown. 
Either delete the
    object using the allocated type or call operator delete directly.
                    delete curElem->fData;
                           ^^^^^^^^^^^^^^ 
Error 556: "/tmp/x/include/util/RefHashTableOf.c", line 150 # Unable to 
generate specialization
    "void RefHashTableOf<void>::removeAll()" due to errors during generation.
        removeAll();
        ^^^^^^^^^^^ 
gmake: *** [DocumentImpl.o] Error 2

*** THE END

Kind Regards,
--MikeL


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org