diff mbox series

[shared,coarrays,committed] Make header use more consistent

Message ID 03c2155b-c196-2d0a-ef80-185179766c5c@netcologne.de
State New
Headers show
Series [shared,coarrays,committed] Make header use more consistent | expand

Commit Message

Thomas Koenig Oct. 27, 2020, 5:31 p.m. UTC
I just committed

https://gcc.gnu.org/g:0c261d5b5c931d9e9214d06531bdc7e9e16aeaab

to hopefully fix the header issue on the native_coarray branch.

If anybody wants to give this a spin, please go right ahead.

I've also discussed with Nicolas on how best to proceed.  The
best way forward is probably to merge the branch into trunk at
the end of stage 1 and follow Richard's suggestion to use configure.tgt
to only compile the shared coarray library for systems where it is
known to at least compile. As people test more systems, we can then
add these to configure.tgt.

Best regards

	Thomas

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.

Comments

David Edelsohn Oct. 27, 2020, 9:18 p.m. UTC | #1
The current COARRAYS branch correctly bootstraps on AIX.  Thanks for
correcting the contents and ordering of the header files.

Thanks, David

On Tue, Oct 27, 2020 at 1:31 PM Thomas Koenig <tkoenig@netcologne.de> wrote:
>
> I just committed
>
> https://gcc.gnu.org/g:0c261d5b5c931d9e9214d06531bdc7e9e16aeaab
>
> to hopefully fix the header issue on the native_coarray branch.
>
> If anybody wants to give this a spin, please go right ahead.
>
> I've also discussed with Nicolas on how best to proceed.  The
> best way forward is probably to merge the branch into trunk at
> the end of stage 1 and follow Richard's suggestion to use configure.tgt
> to only compile the shared coarray library for systems where it is
> known to at least compile. As people test more systems, we can then
> add these to configure.tgt.
>
> Best regards
>
>         Thomas
>
> 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.
>
Andre Vehreschild Oct. 28, 2020, 8:25 a.m. UTC | #2
Hi Nicolas, Thomas,

are you planing to also rename the directory and library name from "nca" to
"shared_caf" or the like?

Regards,
	Andre

On Tue, 27 Oct 2020 17:18:21 -0400
David Edelsohn via Fortran <fortran@gcc.gnu.org> wrote:

> The current COARRAYS branch correctly bootstraps on AIX.  Thanks for
> correcting the contents and ordering of the header files.
>
> Thanks, David
>
> On Tue, Oct 27, 2020 at 1:31 PM Thomas Koenig <tkoenig@netcologne.de> wrote:
> >
> > I just committed
> >
> > https://gcc.gnu.org/g:0c261d5b5c931d9e9214d06531bdc7e9e16aeaab
> >
> > to hopefully fix the header issue on the native_coarray branch.
> >
> > If anybody wants to give this a spin, please go right ahead.
> >
> > I've also discussed with Nicolas on how best to proceed.  The
> > best way forward is probably to merge the branch into trunk at
> > the end of stage 1 and follow Richard's suggestion to use configure.tgt
> > to only compile the shared coarray library for systems where it is
> > known to at least compile. As people test more systems, we can then
> > add these to configure.tgt.
> >
> > Best regards
> >
> >         Thomas
> >
> > 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.
> >


--
Andre Vehreschild * Email: vehre ad gmx dot de
Nicolas König Oct. 28, 2020, 6:05 p.m. UTC | #3
Hi Andre,

I'll make another pass after I'm done implementing stat & errmsg to 
remove any reference to native coarrays I find.

Kind regards,

   Nicolas

On 28/10/2020 09:25, Andre Vehreschild wrote:
> Hi Nicolas, Thomas,
> 
> are you planing to also rename the directory and library name from "nca" to
> "shared_caf" or the like?
> 
> Regards,
> 	Andre
> 
> On Tue, 27 Oct 2020 17:18:21 -0400
> David Edelsohn via Fortran <fortran@gcc.gnu.org> wrote:
> 
>> The current COARRAYS branch correctly bootstraps on AIX.  Thanks for
>> correcting the contents and ordering of the header files.
>>
>> Thanks, David
>>
>> On Tue, Oct 27, 2020 at 1:31 PM Thomas Koenig <tkoenig@netcologne.de> wrote:
>>>
>>> I just committed
>>>
>>> https://gcc.gnu.org/g:0c261d5b5c931d9e9214d06531bdc7e9e16aeaab
>>>
>>> to hopefully fix the header issue on the native_coarray branch.
>>>
>>> If anybody wants to give this a spin, please go right ahead.
>>>
>>> I've also discussed with Nicolas on how best to proceed.  The
>>> best way forward is probably to merge the branch into trunk at
>>> the end of stage 1 and follow Richard's suggestion to use configure.tgt
>>> to only compile the shared coarray library for systems where it is
>>> known to at least compile. As people test more systems, we can then
>>> add these to configure.tgt.
>>>
>>> Best regards
>>>
>>>          Thomas
>>>
>>> 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.
>>>
> 
> 
> --
> Andre Vehreschild * Email: vehre ad gmx dot de
>
diff mbox series

Patch

diff --git a/libgfortran/nca/coarraynative.c b/libgfortran/nca/coarraynative.c
index 109bf88b30f..251e7c9dd57 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 cc7cbb7fbaf..14bd517d576 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 865ec6a1488..61fe966a3f0 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 29490951575..10a43d0be91 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 85746f3189c..4bd7e3ca740 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 7d68126f40f..0d80b79a6b3 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 59123688de5..09692fce601 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 cd30f2f863b..7cf5ee28d9b 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 6eec14e3864..53aa3dcb15f 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 9abd7adf708..1d335129520 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 b31e750ead3..d3d50f5d211 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)