aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.benjamin/p15561.C
blob: 3dedd0c5bade0ba38e093e3efe2d4611eb315704 (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
//980418 bkoz reduced from kumar's g++/15561
// Build don't link:
// prms-id: 15561

extern int errno;
extern int	write  (int, const void *, long unsigned int )  ;

/* to debug
#ifdef BUG
*/
//this crashes
typedef long unsigned int size_t;		
//typedef unsigned long size_t;
//this is ok
//typedef unsigned int size_t;

class exception {
public:
  exception () { }
  virtual ~exception () { }
  virtual const char* what () const;
};

class bad_alloc : public exception {
public:
  virtual const char* what() const throw() { return "bad_alloc"; }
};

struct nothrow_t {};
extern const nothrow_t nothrow;

typedef void (*new_handler)();
new_handler set_new_handler (new_handler);

void *operator new (size_t) throw (std::bad_alloc);
void *operator new[] (size_t) throw (std::bad_alloc);
void operator delete (void *) throw();
void operator delete[] (void *) throw();
void *operator new (size_t, const nothrow_t&) throw();
void *operator new[] (size_t, const nothrow_t&) throw();
void operator delete (void *, const nothrow_t&) throw();
void operator delete[] (void *, const nothrow_t&) throw();
inline void *operator new(size_t, void *place) throw() { return place; }
inline void *operator new[](size_t, void *place) throw() { return place; }

/* to debug
#else
#include <new>
#endif
*/

//from kumar's ace file
typedef	unsigned long	u_long;
typedef int ACE_thread_t;
typedef int ACE_hthread_t;
typedef int ACE_thread_key_t;
typedef int ssize_t;
typedef int ACE_HANDLE;
typedef ACE_HANDLE ACE_SOCKET;

struct ACE_OVERLAPPED
{
  u_long Internal;
  u_long InternalHigh;
  u_long Offset;
  u_long OffsetHigh;
  ACE_HANDLE hEvent;
};

struct strbuf {
	int	maxlen;			 
	int	len;			 
	char	*buf;			 
};

struct flock {
	short	l_type;		 
	short	l_whence;	 
	long	l_start;	 
	long	l_len;		 
	short	l_pid;		 
	short	l_xxx;		 
};

class   ACE_OS
{
public:
  struct ace_flock_t
  {
    void dump (void) const;
    struct flock lock_;
    ACE_HANDLE handle_;
  };
  static ssize_t write (ACE_HANDLE handle,
			const void *buf,
			size_t nbyte);
  static ssize_t write (ACE_HANDLE handle,
			const void *buf,
			size_t nbyte,
			ACE_OVERLAPPED *);

  static void *memcpy (void *t,
		       const void *s,
		       size_t len);

  static int putmsg (ACE_HANDLE handle,
		     const struct strbuf *ctl,
		     const struct strbuf *data,
		     int flags); 

  static ACE_thread_t NULL_thread;
  static ACE_hthread_t NULL_hthread;
  static ACE_thread_key_t NULL_key;
  static void mutex_lock_cleanup (void *mutex);
private:
  ACE_OS (void);
};


 
inline  ssize_t 
ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte)
{
 do {   
	ssize_t  ace_result_ =   -1 ; 
	ace_result_ = ace_result_; 
	return  ::write (handle, buf, nbyte) ; } while (0) ;
}

inline  ssize_t 
ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte,
	       ACE_OVERLAPPED *overlapped)
{
  overlapped = overlapped;
  return ACE_OS::write (handle, buf, nbyte);
}
  

inline  int 
ACE_OS::putmsg (ACE_HANDLE handle, const struct strbuf *ctl, 
		const struct strbuf *data, int flags) 
{
  {
    if (& flags ) 
      ;
  } ;
  if (ctl == 0 && data == 0)
    {
      errno = 22 ;
      return 0;
    }
   
  else if (ctl != 0)
    return ACE_OS::write (handle, ctl->buf, ctl->len);
  else if (data != 0)
    return ACE_OS::write (handle, data->buf, data->len);
  else
    {
      char *buf;
      do 
	{  
	  buf  = new   char [ctl->len + data->len] ; 
	  if ( buf  == 0) 
	    { 
	      errno = 12 ; 
	      return   -1 ;
	    } 
      	} 
      while (0) ;
      ACE_OS::memcpy (buf, ctl->buf, ctl->len);
      ACE_OS::memcpy (buf + ctl->len, data->buf, data->len);
      int result = ACE_OS::write (handle, buf, ctl->len + data->len);
      delete [] buf;
      return result;
    }
}

int main() 
{
  return (1);
}