gcc/libgomp/testsuite/libgomp.c/nested-3.c
Kwok Cheung Yeung 10508db867 openmp: Mark deprecated symbols in OpenMP 5.0
2020-11-05  Ulrich Drepper  <drepper@redhat.com>
	    Kwok Cheung Yeung  <kcy@codesourcery.com>

	libgomp/
	* Makefile.am (%.mod): Add -cpp and -fopenmp to compile flags.
	* Makefile.in: Regenerate.
	* fortran.c: Wrap uses of omp_set_nested and omp_get_nested with
	pragmas to ignore -Wdeprecated-declarations warnings.
	* icv.c: Likewise.
	* omp.h.in (__GOMP_DEPRECATED_5_0): Define.
	Mark omp_lock_hint_* enum values, omp_lock_hint_t, omp_set_nested,
	and omp_get_nested with __GOMP_DEPRECATED_5_0.
	* omp_lib.f90.in: Mark omp_get_nested and omp_set_nested as
	deprecated.
	* testsuite/libgomp.c++/affinity-1.C: Add -Wno-deprecated-declarations
	to test options.
	* testsuite/libgomp.c/affinity-1.c: Likewise.
	* testsuite/libgomp.c/affinity-2.c: Likewise.
	* testsuite/libgomp.c/appendix-a/a.15.1.c: Likewise.
	* testsuite/libgomp.c/lib-1.c: Likewise.
	* testsuite/libgomp.c/nested-1.c: Likewise.
	* testsuite/libgomp.c/nested-2.c: Likewise.
	* testsuite/libgomp.c/nested-3.c: Likewise.
	* testsuite/libgomp.c/pr32362-1.c: Likewise.
	* testsuite/libgomp.c/pr32362-2.c: Likewise.
	* testsuite/libgomp.c/pr32362-3.c: Likewise.
	* testsuite/libgomp.c/pr35549.c: Likewise.
	* testsuite/libgomp.c/pr42942.c: Likewise.
	* testsuite/libgomp.c/pr61200.c: Likewise.
	* testsuite/libgomp.c/sort-1.c: Likewise.
	* testsuite/libgomp.c/target-5.c: Likewise.
	* testsuite/libgomp.c/target-6.c: Likewise.
	* testsuite/libgomp.c/teams-1.c: Likewise.
	* testsuite/libgomp.c/thread-limit-1.c: Likewise.
	* testsuite/libgomp.c/thread-limit-2.c: Likewise.
	* testsuite/libgomp.c/thread-limit-4.c: Likewise.
	* testsuite/libgomp.fortran/affinity1.f90: Likewise.
	* testsuite/libgomp.fortran/lib1.f90: Likewise.
	* testsuite/libgomp.fortran/lib2.f: Likewise.
	* testsuite/libgomp.fortran/nested1.f90: Likewise.
	* testsuite/libgomp.fortran/teams1.f90: Likewise.
2020-11-05 10:32:56 -08:00

92 lines
2.7 KiB
C

/* { dg-additional-options "-Wno-deprecated-declarations" } */
#include <omp.h>
#include <stdlib.h>
#include <string.h>
int
main (void)
{
int e[3];
memset (e, '\0', sizeof (e));
omp_set_nested (1);
omp_set_dynamic (0);
if (omp_in_parallel ()
|| omp_get_level () != 0
|| omp_get_ancestor_thread_num (0) != 0
|| omp_get_ancestor_thread_num (-1) != -1
|| omp_get_ancestor_thread_num (1) != -1
|| omp_get_team_size (0) != 1
|| omp_get_team_size (-1) != -1
|| omp_get_team_size (1) != -1
|| omp_get_active_level () != 0)
abort ();
#pragma omp parallel num_threads (4)
{
int tn1 = omp_get_thread_num ();
if (omp_in_parallel () != 1
|| omp_get_num_threads () != 4
|| tn1 >= 4 || tn1 < 0
|| omp_get_level () != 1
|| omp_get_ancestor_thread_num (0) != 0
|| omp_get_ancestor_thread_num (1) != tn1
|| omp_get_ancestor_thread_num (-1) != -1
|| omp_get_ancestor_thread_num (2) != -1
|| omp_get_team_size (0) != 1
|| omp_get_team_size (1) != omp_get_num_threads ()
|| omp_get_team_size (-1) != -1
|| omp_get_team_size (2) != -1
|| omp_get_active_level () != 1)
#pragma omp atomic
e[0] += 1;
#pragma omp parallel if (0) num_threads(5) firstprivate(tn1)
{
int tn2 = omp_get_thread_num ();
if (omp_in_parallel () != 1
|| omp_get_num_threads () != 1
|| tn2 != 0
|| omp_get_level () != 2
|| omp_get_ancestor_thread_num (0) != 0
|| omp_get_ancestor_thread_num (1) != tn1
|| omp_get_ancestor_thread_num (2) != tn2
|| omp_get_ancestor_thread_num (-1) != -1
|| omp_get_ancestor_thread_num (3) != -1
|| omp_get_team_size (0) != 1
|| omp_get_team_size (1) != 4
|| omp_get_team_size (2) != 1
|| omp_get_team_size (-1) != -1
|| omp_get_team_size (3) != -1
|| omp_get_active_level () != 1)
#pragma omp atomic
e[1] += 1;
#pragma omp parallel num_threads(2) firstprivate(tn1, tn2)
{
int tn3 = omp_get_thread_num ();
if (omp_in_parallel () != 1
|| omp_get_num_threads () != 2
|| tn3 > 1 || tn3 < 0
|| omp_get_level () != 3
|| omp_get_ancestor_thread_num (0) != 0
|| omp_get_ancestor_thread_num (1) != tn1
|| omp_get_ancestor_thread_num (2) != tn2
|| omp_get_ancestor_thread_num (3) != tn3
|| omp_get_ancestor_thread_num (-1) != -1
|| omp_get_ancestor_thread_num (4) != -1
|| omp_get_team_size (0) != 1
|| omp_get_team_size (1) != 4
|| omp_get_team_size (2) != 1
|| omp_get_team_size (3) != 2
|| omp_get_team_size (-1) != -1
|| omp_get_team_size (4) != -1
|| omp_get_active_level () != 2)
#pragma omp atomic
e[2] += 1;
}
}
}
if (e[0] || e[1] || e[2])
abort ();
return 0;
}