summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr44295.C
blob: 8169bb0a8736a80bb08b280d7b23e97d2a2ff401 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/* { dg-do compile } */
extern "C" {
  typedef __SIZE_TYPE__ size_t;
  typedef struct   {
    } __sigset_t;
  typedef union {
  } pthread_barrierattr_t;
  }
  typedef unsigned short XMLCh;
      typedef unsigned long XMLSize_t;
  namespace xercesc_2_5 {
  class DOMNodeList;
  class DOMNode {
  };
  class DOMDocumentRange {
  };
  class DOMDocument: public DOMDocumentRange,  public DOMNode {
  };
  union wait   {
      struct       {
       }
  __wait_stopped;
    }
 div_t;
  class MemoryManager;
  class XMemory {
  public :     void* operator new(size_t size, MemoryManager* memMgr);
      void operator delete(void* p);
      void operator delete(void* p, MemoryManager* memMgr);
  };
  class XMLExcepts {
  public :     enum Codes     {
         NoError = 0       , HshTbl_ZeroModulus = 48       , HshTbl_BadHashFromKey = 49     };
  };
  class XMLUni {
  };
  }
  namespace xercesc_2_5 {
  class XMLException : public XMemory {
  public:
    virtual ~XMLException();
      XMLException(const char* const srcFile, const unsigned int srcLine, MemoryManager* const memoryManager = 0);
      void loadExceptText     (         const XMLExcepts::Codes toLoad     );
  };
  class XMLDeleter {
  };
  class XMLPlatformUtils {
  public :     static MemoryManager* fgMemoryManager;
   static inline size_t alignPointerForNewBlockAllocation(size_t ptrSize);
  };
  inline size_t XMLPlatformUtils::alignPointerForNewBlockAllocation(size_t ptrSize) {
  }
  class HashBase : public XMemory {
  public:
 virtual bool equals(const void *const key1, const void *const key2) = 0;
      virtual ~HashBase() {
};
  };
  class IllegalArgumentException : public XMLException {
  public:
IllegalArgumentException(const char* const srcFile , const unsigned int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = 0) : XMLException(srcFile, srcLine, memoryManager) {
 loadExceptText(toThrow);
 }
  };
  class RuntimeException : public XMLException {
  public:
RuntimeException(const char* const srcFile , const unsigned int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = 0) : XMLException(srcFile, srcLine, memoryManager) {
 loadExceptText(toThrow);
 }
  };
  class MemoryManager {
  public:
    virtual ~MemoryManager()     {
     }
      virtual void* allocate(size_t size) = 0;
  };
  template <class TElem> class BaseRefVectorOf : public XMemory {
      BaseRefVectorOf     (           const unsigned int maxElems         , const bool adoptElems = true         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager     );
      virtual ~BaseRefVectorOf();
      bool fAdoptedElems;
      TElem** fElemList;
  };
  template <class TElem> BaseRefVectorOf<TElem>::BaseRefVectorOf( const unsigned int maxElems                                        , const bool adoptElems                                        , MemoryManager* const manager) :     fAdoptedElems(adoptElems) {
      for (unsigned int index = 0;
  index < maxElems;
  index++)         fElemList[index] = 0;
  }
  template <class TElem> BaseRefVectorOf<TElem>::~BaseRefVectorOf() {
  }
  class XMLString {
  public:
     static bool equals     (           const XMLCh* const str1         , const XMLCh* const str2     );
      static void moveChars     (                 XMLCh* const targetStr         , const XMLCh* const srcStr         , const unsigned int count     );
  };
  inline void XMLString::moveChars( XMLCh* const targetStr                                 , const XMLCh* const srcStr                                 , const unsigned int count) {
  }
  inline bool XMLString::equals( const XMLCh* const str1                                , const XMLCh* const str2) {
      const XMLCh* psz1 = str1;
      const XMLCh* psz2 = str2;
      if (psz1 == 0 || psz2 == 0) {
             return true;
     }
  }
  }
  namespace xercesc_2_5 {
  class HashPtr : public HashBase {
   virtual bool equals(const void *const key1, const void *const key2);
  };
  template <class TVal> struct DOMDeepNodeListPoolTableBucketElem : public XMemory {
      void* fKey1;
      XMLCh* fKey2;
      XMLCh* fKey3;
  };
  template <class TVal> class DOMDeepNodeListPool {
  public:
     DOMDeepNodeListPool     (         const XMLSize_t modulus       , const bool adoptElems       , const XMLSize_t initSize = 128     );
      TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3);
      DOMDeepNodeListPoolTableBucketElem<TVal>* findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal);
      bool fAdoptedElems;
      DOMDeepNodeListPoolTableBucketElem<TVal>** fBucketList;
      XMLSize_t fHashModulus;
      HashBase* fHash;
      TVal** fIdPtrs;
      XMLSize_t fIdPtrsCount;
      MemoryManager* fMemoryManager;
  };
  template <class TVal> DOMDeepNodeListPool<TVal>::DOMDeepNodeListPool( const XMLSize_t modulus                                               , const bool adoptElems                                               , const XMLSize_t initSize) :   fAdoptedElems(adoptElems)     , fBucketList(0)     , fHash(0)     , fIdPtrs(0) {
      fHash = new (fMemoryManager) HashPtr();
      fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));
   if (modulus == 0)         throw IllegalArgumentException("./xercesc/dom/impl/bad.c", 38, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager);
  }
  template <class TVal> TVal* DOMDeepNodeListPool<TVal>::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) {
      XMLSize_t hashVal;
      DOMDeepNodeListPoolTableBucketElem<TVal>* findIt = findBucketElem(key1, key2, key3, hashVal);
  }
  template <class TVal> DOMDeepNodeListPoolTableBucketElem<TVal>* DOMDeepNodeListPool<TVal>:: findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) {
      if (hashVal > fHashModulus)         throw RuntimeException("./xercesc/dom/impl/bad.c", 64, XMLExcepts::HshTbl_BadHashFromKey, fMemoryManager);
      DOMDeepNodeListPoolTableBucketElem<TVal>* curElem = fBucketList[hashVal];
          if (fHash->equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
             return curElem;
     }
  }
  class DOMDeepNodeListImpl;
  class DOMDocumentImpl: public DOMDocument {
      DOMNodeList* getElementsByTagName(const XMLCh * tagname) const;
      DOMNodeList* getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName);
      DOMNodeList* getDeepNodeList(const DOMNode *rootNode,                                                  const XMLCh *namespaceURI,                                                  const XMLCh *localName);
      DOMDeepNodeListPool<DOMDeepNodeListImpl>* fNodeListPool;
  };
  }
  void * operator new(size_t amt, xercesc_2_5:: DOMDocument *doc);
  namespace xercesc_2_5 {
  class DOMNodeList {
  };
  class DOMDeepNodeListImpl: public DOMNodeList {
  };
  DOMNodeList *DOMDocumentImpl::getElementsByTagName(const XMLCh *tagname) const {
      return ((DOMDocumentImpl*)this)->getDeepNodeList(this,tagname);
  }
  DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName) {
      if(!fNodeListPool) {
         fNodeListPool = new (this) DOMDeepNodeListPool<DOMDeepNodeListImpl>(109, false);
     }
      DOMNodeList* retList = fNodeListPool->getByKey(rootNode, tagName, 0);
  }
  DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode,                                                    const XMLCh *namespaceURI,                                                    const XMLCh *localName) {
      DOMNodeList* retList = fNodeListPool->getByKey(rootNode, localName, namespaceURI);
  }
  }