aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2020-10-27 18:20:57 +0100
committerThomas Koenig <tkoenig@gcc.gnu.org>2020-10-27 18:20:57 +0100
commit0c261d5b5c931d9e9214d06531bdc7e9e16aeaab (patch)
tree6c3434493dce1cbf59469df55b5fc7a84d1e5814
parent9dca1f29608df4bda70b33be735373ac18b8714b (diff)
downloadgcc-0c261d5b5c931d9e9214d06531bdc7e9e16aeaab.zip
gcc-0c261d5b5c931d9e9214d06531bdc7e9e16aeaab.tar.gz
gcc-0c261d5b5c931d9e9214d06531bdc7e9e16aeaab.tar.bz2
Always include libgfortran.h first; sanitize header dependencies.
libgfortran/ChangeLog: * nca/coarraynative.c: Do not include util.h. Remove commented include for stdlib.h.. * nca/collective_subroutine.c: Move #include <string.h> after other #include statement. * nca/hashmap.c: Include shared_memory.h and allocator.h * nca/hashmap.h: Remove includess. * nca/libcoarraynative.h: Include only those headers which are needed. * nca/shared_memory.c: Do not include util.h * nca/shared_memory.h: Do not include other headers. * nca/sync.c: Move include of string.h after other headers. * nca/sync.h: Remove include of shared_memory.h and alloc.h. * nca/util.h: Do not include stdint.h and stddef.h; include limits.h and assert.h. * nca/wrapper.c: Remove include for sync.h, util.h and collective_subroutine.h. Move include of string.h after other headers.
-rw-r--r--libgfortran/nca/coarraynative.c2
-rw-r--r--libgfortran/nca/collective_subroutine.c3
-rw-r--r--libgfortran/nca/hashmap.c2
-rw-r--r--libgfortran/nca/hashmap.h7
-rw-r--r--libgfortran/nca/libcoarraynative.h12
-rw-r--r--libgfortran/nca/shared_memory.c4
-rw-r--r--libgfortran/nca/shared_memory.h10
-rw-r--r--libgfortran/nca/sync.c6
-rw-r--r--libgfortran/nca/sync.h2
-rw-r--r--libgfortran/nca/util.h4
-rw-r--r--libgfortran/nca/wrapper.c6
11 files changed, 14 insertions, 44 deletions
diff --git a/libgfortran/nca/coarraynative.c b/libgfortran/nca/coarraynative.c
index 109bf88..251e7c9 100644
--- a/libgfortran/nca/coarraynative.c
+++ b/libgfortran/nca/coarraynative.c
@@ -27,13 +27,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libcoarraynative.h"
#include "allocator.h"
#include "hashmap.h"
-#include "util.h"
#include "lock.h"
#include "collective_subroutine.h"
#include <unistd.h>
#include <sys/mman.h>
-// #include <stdlib.h>
#include <sys/wait.h>
#define GFORTRAN_ENV_NUM_IMAGES "GFORTRAN_NUM_IMAGES"
diff --git a/libgfortran/nca/collective_subroutine.c b/libgfortran/nca/collective_subroutine.c
index cc7cbb7..14bd517 100644
--- a/libgfortran/nca/collective_subroutine.c
+++ b/libgfortran/nca/collective_subroutine.c
@@ -22,12 +22,13 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#include <string.h>
#include "libgfortran.h"
#include "libcoarraynative.h"
#include "collective_subroutine.h"
#include "allocator.h"
+#include <string.h>
+
void *
get_collsub_buf (collsub_iface *ci, size_t size)
{
diff --git a/libgfortran/nca/hashmap.c b/libgfortran/nca/hashmap.c
index 865ec6a..61fe966 100644
--- a/libgfortran/nca/hashmap.c
+++ b/libgfortran/nca/hashmap.c
@@ -23,6 +23,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
+#include "shared_memory.h"
+#include "allocator.h"
#include "hashmap.h"
#include <string.h>
diff --git a/libgfortran/nca/hashmap.h b/libgfortran/nca/hashmap.h
index 2949095..10a43d0 100644
--- a/libgfortran/nca/hashmap.h
+++ b/libgfortran/nca/hashmap.h
@@ -24,13 +24,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef HASHMAP_H
-#include "shared_memory.h"
-#include "allocator.h"
-
-#include <stdint.h>
-#include <stddef.h>
-
-
/* Data structures and variables:
memid is a unique identifier for the coarray, the address of its
diff --git a/libgfortran/nca/libcoarraynative.h b/libgfortran/nca/libcoarraynative.h
index 85746f3..4bd7e3c 100644
--- a/libgfortran/nca/libcoarraynative.h
+++ b/libgfortran/nca/libcoarraynative.h
@@ -25,12 +25,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef COARRAY_NATIVE_HDR
#define COARRAY_NATIVE_HDR
-#include "libgfortran.h"
-
-#include <sys/types.h>
-#include <stdint.h>
-#include <stdio.h>
-
#define DEBUG_NATIVE_COARRAY 0
#if defined(DEBUG_NATIVE_COARRAY) && DEBUG_NATIVE_COARRAY
@@ -39,10 +33,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define DEBUG_PRINTF(...) do {} while(0)
#endif
-#include "allocator.h"
-#include "hashmap.h"
+#include "shared_memory.h"
+#include "alloc.h"
#include "sync.h"
-#include "lock.h"
+#include "util.h"
#include "collective_subroutine.h"
typedef struct {
diff --git a/libgfortran/nca/shared_memory.c b/libgfortran/nca/shared_memory.c
index 7d68126..0d80b79 100644
--- a/libgfortran/nca/shared_memory.c
+++ b/libgfortran/nca/shared_memory.c
@@ -24,13 +24,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include "libcoarraynative.h"
-#include "util.h"
+
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
-#include "shared_memory.h"
-
/* This implements shared memory based on POSIX mmap. We start with
memory block of the size of the global shared memory data, rounded
up to one pagesize, and enlarge as needed.
diff --git a/libgfortran/nca/shared_memory.h b/libgfortran/nca/shared_memory.h
index 5912368..09692fc 100644
--- a/libgfortran/nca/shared_memory.h
+++ b/libgfortran/nca/shared_memory.h
@@ -25,16 +25,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef SHARED_MEMORY_H
#define SHARED_MEMORY_H
-#include <stdbool.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <sys/types.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <limits.h>
-
/* A struct to serve as an opaque shared memory object. */
struct shared_memory_act;
diff --git a/libgfortran/nca/sync.c b/libgfortran/nca/sync.c
index cd30f2f..7cf5ee2 100644
--- a/libgfortran/nca/sync.c
+++ b/libgfortran/nca/sync.c
@@ -23,12 +23,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#include <string.h>
-
#include "libgfortran.h"
#include "libcoarraynative.h"
-#include "sync.h"
-#include "util.h"
+
+#include <string.h>
static void
sync_all_init (pthread_barrier_t *b)
diff --git a/libgfortran/nca/sync.h b/libgfortran/nca/sync.h
index 6eec14e..53aa3dc 100644
--- a/libgfortran/nca/sync.h
+++ b/libgfortran/nca/sync.h
@@ -25,8 +25,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef IPSYNC_HDR
#define IPSYNC_HDR
-#include "shared_memory.h"
-#include "alloc.h"
#include <pthread.h>
typedef struct {
diff --git a/libgfortran/nca/util.h b/libgfortran/nca/util.h
index 9abd7ad..1d33512 100644
--- a/libgfortran/nca/util.h
+++ b/libgfortran/nca/util.h
@@ -25,9 +25,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef UTIL_HDR
#define UTIL_HDR
-#include <stdint.h>
-#include <stddef.h>
#include <pthread.h>
+#include <limits.h>
+#include <assert.h>
#define PTR_BITS (CHAR_BIT*sizeof(void *))
diff --git a/libgfortran/nca/wrapper.c b/libgfortran/nca/wrapper.c
index b31e750..d3d50f5 100644
--- a/libgfortran/nca/wrapper.c
+++ b/libgfortran/nca/wrapper.c
@@ -22,13 +22,11 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#include <string.h>
#include "libgfortran.h"
#include "libcoarraynative.h"
-#include "sync.h"
#include "lock.h"
-#include "util.h"
-#include "collective_subroutine.h"
+
+#include <string.h>
static inline int
div_ru (int divident, int divisor)