Discussion:
[PATCH] libgomp.c/ cleanup
Marek Polacek
2014-10-06 10:18:33 UTC
Permalink
This patch is a cleanup of tests in libgomp.c/ directory.
See https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02656.html for more info.

Tested on x86_64-linux: vanilla results == results with this patch ==
results with this patch and gnu11 as a default.

Applying to trunk.

2014-10-06 Marek Polacek <***@redhat.com>

* testsuite/libgomp.c/affinity-1.c: Fix implicit declarations.
* testsuite/libgomp.c/nqueens-1.c: Likewise.
* testsuite/libgomp.c/pr26943-3.c: Likewise.
* testsuite/libgomp.c/pr26943-4.c: Likewise.
* testsuite/libgomp.c/pr36802-2.c: Likewise.
* testsuite/libgomp.c/pr36802-3.c: Likewise.
* testsuite/libgomp.c/thread-limit-1.c: Likewise.
* testsuite/libgomp.c/thread-limit-2.c: Likewise.
* testsuite/libgomp.c/appendix-a/a.15.1.c: Include <omp.h>.
* testsuite/libgomp.c/omp-loop02.c: Fix defaulting to int.
* testsuite/libgomp.c/omp-parallel-for.c: Likewise.
* testsuite/libgomp.c/omp-parallel-if.c: Likewise.
* testsuite/libgomp.c/omp-single-1.c: Likewise.
* testsuite/libgomp.c/omp-single-2.c: Likewise.
* testsuite/libgomp.c/omp_matvec.c: Likewise.
* testsuite/libgomp.c/omp_workshare3.c: Likewise.
* testsuite/libgomp.c/omp_workshare4.c: Likewise.
* testsuite/libgomp.c/shared-1.c: Fix defaulting to int. Fix implicit
declarations.

diff --git gcc/libgomp/testsuite/libgomp.c/affinity-1.c gcc/libgomp/testsuite/libgomp.c/affinity-1.c
index b3c1d0c..77efc49 100644
--- gcc/libgomp/testsuite/libgomp.c/affinity-1.c
+++ gcc/libgomp/testsuite/libgomp.c/affinity-1.c
@@ -31,6 +31,7 @@

#ifdef DO_FORK
#include <signal.h>
+pid_t waitpid (pid_t, int *, int);
#endif
#ifdef HAVE_PTHREAD_AFFINITY_NP
#include <sched.h>
diff --git gcc/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c gcc/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c
index 276ac6c..c167dab 100644
--- gcc/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c
+++ gcc/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c
@@ -1,5 +1,6 @@
/* { dg-do run } */

+#include <omp.h>
#include <stdio.h>

void
diff --git gcc/libgomp/testsuite/libgomp.c/nqueens-1.c gcc/libgomp/testsuite/libgomp.c/nqueens-1.c
index 1fdc67b..ed6c179 100644
--- gcc/libgomp/testsuite/libgomp.c/nqueens-1.c
+++ gcc/libgomp/testsuite/libgomp.c/nqueens-1.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <string.h>

+unsigned long int strtoul(const char *, char **, int);
int cnt;
#pragma omp threadprivate (cnt)

diff --git gcc/libgomp/testsuite/libgomp.c/omp-loop02.c gcc/libgomp/testsuite/libgomp.c/omp-loop02.c
index 04aaea2..ae0d748 100644
--- gcc/libgomp/testsuite/libgomp.c/omp-loop02.c
+++ gcc/libgomp/testsuite/libgomp.c/omp-loop02.c
@@ -15,6 +15,7 @@ void parloop (int *a)
a[i] = i + 3;
}

+int
main()
{
int i, a[N];
diff --git gcc/libgomp/testsuite/libgomp.c/omp-parallel-for.c gcc/libgomp/testsuite/libgomp.c/omp-parallel-for.c
index c6631a0..9246976 100644
--- gcc/libgomp/testsuite/libgomp.c/omp-parallel-for.c
+++ gcc/libgomp/testsuite/libgomp.c/omp-parallel-for.c
@@ -1,5 +1,6 @@
extern void abort (void);

+int
main()
{
int i, a;
diff --git gcc/libgomp/testsuite/libgomp.c/omp-parallel-if.c gcc/libgomp/testsuite/libgomp.c/omp-parallel-if.c
index 5e37835..b9c27fd 100644
--- gcc/libgomp/testsuite/libgomp.c/omp-parallel-if.c
+++ gcc/libgomp/testsuite/libgomp.c/omp-parallel-if.c
@@ -8,6 +8,7 @@ foo (void)
return 10;
}

+int
main ()
{
int A = 0;
diff --git gcc/libgomp/testsuite/libgomp.c/omp-single-1.c gcc/libgomp/testsuite/libgomp.c/omp-single-1.c
index a44ca54..91555cb 100644
--- gcc/libgomp/testsuite/libgomp.c/omp-single-1.c
+++ gcc/libgomp/testsuite/libgomp.c/omp-single-1.c
@@ -1,5 +1,6 @@
extern void abort (void);

+int
main()
{
int i = 0;
diff --git gcc/libgomp/testsuite/libgomp.c/omp-single-2.c gcc/libgomp/testsuite/libgomp.c/omp-single-2.c
index 6878559..f16cbbe 100644
--- gcc/libgomp/testsuite/libgomp.c/omp-single-2.c
+++ gcc/libgomp/testsuite/libgomp.c/omp-single-2.c
@@ -9,6 +9,7 @@ struct X
int c;
};

+int
main()
{
int i = 0;
diff --git gcc/libgomp/testsuite/libgomp.c/omp_matvec.c gcc/libgomp/testsuite/libgomp.c/omp_matvec.c
index 12b8c68..44547b6 100644
--- gcc/libgomp/testsuite/libgomp.c/omp_matvec.c
+++ gcc/libgomp/testsuite/libgomp.c/omp_matvec.c
@@ -16,6 +16,7 @@
#define SIZE 10


+int
main ()
{

diff --git gcc/libgomp/testsuite/libgomp.c/omp_workshare3.c gcc/libgomp/testsuite/libgomp.c/omp_workshare3.c
index 913f1f7..4c55f13 100644
--- gcc/libgomp/testsuite/libgomp.c/omp_workshare3.c
+++ gcc/libgomp/testsuite/libgomp.c/omp_workshare3.c
@@ -16,6 +16,7 @@
#define N 50
#define CHUNKSIZE 5

+int
main () {

int i, chunk, tid;
diff --git gcc/libgomp/testsuite/libgomp.c/omp_workshare4.c gcc/libgomp/testsuite/libgomp.c/omp_workshare4.c
index 67605e3..4ebe68c 100644
--- gcc/libgomp/testsuite/libgomp.c/omp_workshare4.c
+++ gcc/libgomp/testsuite/libgomp.c/omp_workshare4.c
@@ -15,6 +15,7 @@
#define N 50
#define CHUNKSIZE 5

+int
main () {

int i, chunk, tid;
diff --git gcc/libgomp/testsuite/libgomp.c/pr26943-3.c gcc/libgomp/testsuite/libgomp.c/pr26943-3.c
index 855a4b2..68278e4 100644
--- gcc/libgomp/testsuite/libgomp.c/pr26943-3.c
+++ gcc/libgomp/testsuite/libgomp.c/pr26943-3.c
@@ -2,6 +2,7 @@
/* { dg-do run } */

extern int omp_set_dynamic (int);
+extern void omp_set_nested (int);
extern int omp_get_thread_num (void);
extern void abort (void);
extern void GOMP_barrier (void);
diff --git gcc/libgomp/testsuite/libgomp.c/pr26943-4.c gcc/libgomp/testsuite/libgomp.c/pr26943-4.c
index 24f253d..ff03704 100644
--- gcc/libgomp/testsuite/libgomp.c/pr26943-4.c
+++ gcc/libgomp/testsuite/libgomp.c/pr26943-4.c
@@ -2,6 +2,7 @@
/* { dg-do run } */

extern int omp_set_dynamic (int);
+extern void omp_set_nested (int);
extern int omp_get_thread_num (void);
extern void abort (void);
extern void GOMP_barrier (void);
diff --git gcc/libgomp/testsuite/libgomp.c/pr36802-2.c gcc/libgomp/testsuite/libgomp.c/pr36802-2.c
index 06e792f..7bda659 100644
--- gcc/libgomp/testsuite/libgomp.c/pr36802-2.c
+++ gcc/libgomp/testsuite/libgomp.c/pr36802-2.c
@@ -1,6 +1,9 @@
/* PR middle-end/36802 */

extern void abort (void);
+extern int omp_set_dynamic (int);
+extern void omp_set_nested (int);
+extern int omp_get_num_threads (void);

int q;

diff --git gcc/libgomp/testsuite/libgomp.c/pr36802-3.c gcc/libgomp/testsuite/libgomp.c/pr36802-3.c
index f11baa0..700c203 100644
--- gcc/libgomp/testsuite/libgomp.c/pr36802-3.c
+++ gcc/libgomp/testsuite/libgomp.c/pr36802-3.c
@@ -1,6 +1,9 @@
/* PR middle-end/36802 */

extern void abort (void);
+extern int omp_set_dynamic (int);
+extern void omp_set_nested (int);
+extern int omp_get_num_threads (void);

int q;

diff --git gcc/libgomp/testsuite/libgomp.c/shared-1.c gcc/libgomp/testsuite/libgomp.c/shared-1.c
index f7d4fb2..8e1980b 100644
--- gcc/libgomp/testsuite/libgomp.c/shared-1.c
+++ gcc/libgomp/testsuite/libgomp.c/shared-1.c
@@ -1,4 +1,5 @@
extern void abort (void);
+extern int omp_get_num_threads (void);

struct Y
{
@@ -51,6 +52,7 @@ parallel (int a, int b)
abort ();
}

+int
main()
{
parallel (1, 2);
diff --git gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c
index 6cc716b..7571f23 100644
--- gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c
+++ gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c
@@ -4,6 +4,11 @@
#include <stdlib.h>
#include <unistd.h>

+extern int omp_get_thread_limit (void);
+extern int omp_set_dynamic (int);
+extern void omp_set_nested (int);
+extern int omp_get_num_threads (void);
+
int
main ()
{
diff --git gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
index 0fc9dae..ca9ad23 100644
--- gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
+++ gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
@@ -4,6 +4,11 @@
#include <stdlib.h>
#include <unistd.h>

+extern int omp_get_thread_limit (void);
+extern int omp_set_dynamic (int);
+extern void omp_set_nested (int);
+extern int omp_get_num_threads (void);
+
int
main ()
{

Marek
Jakub Jelinek
2014-10-06 10:46:51 UTC
Permalink
Post by Marek Polacek
--- gcc/libgomp/testsuite/libgomp.c/affinity-1.c
+++ gcc/libgomp/testsuite/libgomp.c/affinity-1.c
@@ -31,6 +31,7 @@
#ifdef DO_FORK
#include <signal.h>
+pid_t waitpid (pid_t, int *, int);
I'd #include <sys/wait.h> here instead.
Post by Marek Polacek
--- gcc/libgomp/testsuite/libgomp.c/nqueens-1.c
+++ gcc/libgomp/testsuite/libgomp.c/nqueens-1.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <string.h>
+unsigned long int strtoul(const char *, char **, int);
and #include <stdlib.h> here.
Post by Marek Polacek
--- gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c
+++ gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c
@@ -4,6 +4,11 @@
#include <stdlib.h>
#include <unistd.h>
+extern int omp_get_thread_limit (void);
+extern int omp_set_dynamic (int);
+extern void omp_set_nested (int);
+extern int omp_get_num_threads (void);
+
int
main ()
{
diff --git gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
index 0fc9dae..ca9ad23 100644
--- gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
+++ gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
@@ -4,6 +4,11 @@
#include <stdlib.h>
#include <unistd.h>
+extern int omp_get_thread_limit (void);
+extern int omp_set_dynamic (int);
+extern void omp_set_nested (int);
+extern int omp_get_num_threads (void);
Please #include <omp.h> in the above two tests instead.

Thanks.

Jakub
Marek Polacek
2014-10-06 11:53:16 UTC
Permalink
Post by Jakub Jelinek
Post by Marek Polacek
--- gcc/libgomp/testsuite/libgomp.c/affinity-1.c
+++ gcc/libgomp/testsuite/libgomp.c/affinity-1.c
@@ -31,6 +31,7 @@
#ifdef DO_FORK
#include <signal.h>
+pid_t waitpid (pid_t, int *, int);
I'd #include <sys/wait.h> here instead.
Post by Marek Polacek
--- gcc/libgomp/testsuite/libgomp.c/nqueens-1.c
+++ gcc/libgomp/testsuite/libgomp.c/nqueens-1.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <string.h>
+unsigned long int strtoul(const char *, char **, int);
and #include <stdlib.h> here.
Post by Marek Polacek
--- gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c
+++ gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c
@@ -4,6 +4,11 @@
#include <stdlib.h>
#include <unistd.h>
+extern int omp_get_thread_limit (void);
+extern int omp_set_dynamic (int);
+extern void omp_set_nested (int);
+extern int omp_get_num_threads (void);
+
int
main ()
{
diff --git gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
index 0fc9dae..ca9ad23 100644
--- gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
+++ gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
@@ -4,6 +4,11 @@
#include <stdlib.h>
#include <unistd.h>
+extern int omp_get_thread_limit (void);
+extern int omp_set_dynamic (int);
+extern void omp_set_nested (int);
+extern int omp_get_num_threads (void);
Please #include <omp.h> in the above two tests instead.
Ok, sorry. I'm fixing those with the following.

Applying to trunk.

2014-10-06 Marek Polacek <***@redhat.com>

* testsuite/libgomp.c/affinity-1.c: Include <sys/wait.h>.
* testsuite/libgomp.c/nqueens-1.c: Include <stdlib.h>.
* testsuite/libgomp.c/thread-limit-1.c: Include <omp.h>
* testsuite/libgomp.c/thread-limit-2.c: Likewise.

diff --git gcc/libgomp/testsuite/libgomp.c/affinity-1.c gcc/libgomp/testsuite/libgomp.c/affinity-1.c
index a1a2a12..21f344c 100644
--- gcc/libgomp/testsuite/libgomp.c/affinity-1.c
+++ gcc/libgomp/testsuite/libgomp.c/affinity-1.c
@@ -31,7 +31,7 @@

#ifdef DO_FORK
#include <signal.h>
-pid_t waitpid (pid_t, int *, int);
+#include <sys/wait.h>
#endif
#ifdef HAVE_PTHREAD_AFFINITY_NP
#include <sched.h>
diff --git gcc/libgomp/testsuite/libgomp.c/nqueens-1.c gcc/libgomp/testsuite/libgomp.c/nqueens-1.c
index ed6c179..9742b7a 100644
--- gcc/libgomp/testsuite/libgomp.c/nqueens-1.c
+++ gcc/libgomp/testsuite/libgomp.c/nqueens-1.c
@@ -5,8 +5,8 @@
#include <omp.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>

-unsigned long int strtoul(const char *, char **, int);
int cnt;
#pragma omp threadprivate (cnt)

diff --git gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c
index 7571f23..1d9794a 100644
--- gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c
+++ gcc/libgomp/testsuite/libgomp.c/thread-limit-1.c
@@ -3,11 +3,7 @@

#include <stdlib.h>
#include <unistd.h>
-
-extern int omp_get_thread_limit (void);
-extern int omp_set_dynamic (int);
-extern void omp_set_nested (int);
-extern int omp_get_num_threads (void);
+#include <omp.h>

int
main ()
diff --git gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
index ca9ad23..1a97fb6 100644
--- gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
+++ gcc/libgomp/testsuite/libgomp.c/thread-limit-2.c
@@ -3,11 +3,7 @@

#include <stdlib.h>
#include <unistd.h>
-
-extern int omp_get_thread_limit (void);
-extern int omp_set_dynamic (int);
-extern void omp_set_nested (int);
-extern int omp_get_num_threads (void);
+#include <omp.h>

int
main ()

Marek

Loading...