Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
e33c685b
Commit
e33c685b
authored
Apr 09, 2000
by
Nathan Sidwell
Committed by
Nathan Sidwell
Apr 09, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* g++.old-deja/g++.abi/cxa_vec.C: New test.
From-SVN: r33043
parent
b8c1233b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
274 additions
and
0 deletions
+274
-0
gcc/testsuite/ChangeLog
+4
-0
gcc/testsuite/g++.old-deja/g++.abi/cxa_vec.C
+270
-0
No files found.
gcc/testsuite/ChangeLog
View file @
e33c685b
2000-04-09 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.abi/cxa_vec.C: New test.
2000-04-08 Neil Booth <NeilB@earthling.net>
* gcc.dg/cpp-nullchar.c: Remove test as
...
...
gcc/testsuite/g++.old-deja/g++.abi/cxa_vec.C
0 → 100644
View file @
e33c685b
// Test __cxa_vec routines
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Apr 2000 <nathan@nathan@codesourcery.com>
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
#include <cxxabi.h>
#include <stdio.h>
#include <new>
#include <malloc.h>
#include <setjmp.h>
static
int
ctor_count
=
0
;
static
int
dtor_count
=
0
;
static
bool
dtor_repeat
=
false
;
// our pseudo ctors and dtors
static
void
ctor
(
void
*
)
{
if
(
!
ctor_count
)
throw
1
;
ctor_count
--
;
}
static
void
dtor
(
void
*
)
{
if
(
!
dtor_count
)
{
if
(
!
dtor_repeat
)
dtor_count
--
;
throw
1
;
}
dtor_count
--
;
}
// track new and delete
static
int
blocks
=
0
;
void
*
operator
new
[]
(
std
::
size_t
size
)
throw
(
std
::
bad_alloc
)
{
void
*
ptr
=
malloc
(
size
);
if
(
!
ptr
)
throw
std
::
bad_alloc
();
blocks
++
;
return
ptr
;
}
void
operator
delete
[]
(
void
*
ptr
)
throw
()
{
if
(
ptr
)
{
free
(
ptr
);
blocks
--
;
}
}
static
jmp_buf
jump
;
// allocate and delete an array with no problems
void
test0
()
{
static
bool
started
=
false
;
if
(
!
started
)
{
started
=
true
;
set_terminate
(
test0
);
ctor_count
=
dtor_count
=
5
;
dtor_repeat
=
false
;
blocks
=
0
;
try
{
void
*
ary
=
abi
::
__cxa_vec_new
(
5
,
1
,
sizeof
(
std
::
size_t
),
ctor
,
dtor
);
abi
::
__cxa_vec_delete
(
ary
,
1
,
sizeof
(
std
::
size_t
),
dtor
);
if
(
ctor_count
||
dtor_count
||
blocks
)
longjmp
(
jump
,
1
);
}
catch
(...)
{
longjmp
(
jump
,
2
);
}
}
else
{
longjmp
(
jump
,
3
);
}
return
;
}
// allocate and delete an array with exception on ctor
void
test1
()
{
static
bool
started
=
false
;
if
(
!
started
)
{
started
=
true
;
set_terminate
(
test1
);
ctor_count
=
dtor_count
=
5
;
dtor_repeat
=
false
;
blocks
=
0
;
ctor_count
=
4
;
try
{
void
*
ary
=
abi
::
__cxa_vec_new
(
5
,
1
,
sizeof
(
std
::
size_t
),
ctor
,
dtor
);
longjmp
(
jump
,
1
);
}
catch
(...)
{
// we expect to get here
if
(
ctor_count
||
dtor_count
!=
1
||
blocks
)
longjmp
(
jump
,
2
);
}
}
else
{
longjmp
(
jump
,
3
);
}
return
;
}
// allocate and delete an array with exception on dtor
void
test2
()
{
static
bool
started
=
false
;
if
(
!
started
)
{
started
=
true
;
set_terminate
(
test2
);
ctor_count
=
dtor_count
=
5
;
dtor_repeat
=
false
;
blocks
=
0
;
dtor_count
=
3
;
try
{
void
*
ary
=
abi
::
__cxa_vec_new
(
5
,
1
,
sizeof
(
std
::
size_t
),
ctor
,
dtor
);
abi
::
__cxa_vec_delete
(
ary
,
1
,
sizeof
(
std
::
size_t
),
dtor
);
longjmp
(
jump
,
1
);
}
catch
(...)
{
// we expect to get here
if
(
ctor_count
||
dtor_count
!=
-
2u
||
blocks
)
longjmp
(
jump
,
2
);
}
}
else
{
longjmp
(
jump
,
3
);
}
return
;
}
// allocate an array with double exception on dtor
void
test3
()
{
static
bool
started
=
false
;
if
(
!
started
)
{
started
=
true
;
set_terminate
(
test3
);
ctor_count
=
dtor_count
=
5
;
dtor_repeat
=
false
;
blocks
=
0
;
dtor_count
=
3
;
dtor_repeat
=
true
;
try
{
void
*
ary
=
abi
::
__cxa_vec_new
(
5
,
1
,
sizeof
(
std
::
size_t
),
ctor
,
dtor
);
abi
::
__cxa_vec_delete
(
ary
,
1
,
sizeof
(
std
::
size_t
),
dtor
);
longjmp
(
jump
,
1
);
}
catch
(...)
{
// we do not expect to get here
longjmp
(
jump
,
2
);
}
}
else
{
// we expect to get here (via terminate)
if
(
ctor_count
||
dtor_count
||
blocks
!=
1
)
longjmp
(
jump
,
3
);
longjmp
(
jump
,
-
1
);
}
return
;
}
// allocate an array with exception on ctor and exception in cleanup
void
test4
()
{
static
bool
started
=
false
;
if
(
!
started
)
{
started
=
true
;
set_terminate
(
test4
);
ctor_count
=
dtor_count
=
5
;
dtor_repeat
=
false
;
blocks
=
0
;
ctor_count
=
3
;
dtor_count
=
2
;
try
{
void
*
ary
=
abi
::
__cxa_vec_new
(
5
,
1
,
sizeof
(
std
::
size_t
),
ctor
,
dtor
);
longjmp
(
jump
,
1
);
}
catch
(...)
{
// we do not expect to get here
longjmp
(
jump
,
2
);
}
}
else
{
// we expect to get here (via terminate)
if
(
ctor_count
||
dtor_count
!=
-
1u
||
blocks
!=
1
)
longjmp
(
jump
,
3
);
longjmp
(
jump
,
-
1
);
}
return
;
}
static
void
(
*
tests
[])()
=
{
test0
,
test1
,
test2
,
test3
,
test4
,
NULL
};
int
main
()
{
int
ix
;
int
n
;
int
errors
=
0
;
for
(
ix
=
0
;
tests
[
ix
];
ix
++
)
{
if
(
n
=
setjmp
(
jump
))
{
if
(
n
>
0
)
{
printf
(
"test %d failed %d
\n
"
,
ix
,
n
);
errors
++
;
}
}
else
tests
[
ix
]
();
}
return
errors
;
}
#else
int
main
()
{
return
0
;
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment