From 3b01a9299cf4628c5bc3d22114051a1f93da8404 Mon Sep 17 00:00:00 2001
From: "raphael.bach" <raphael.bach@etu.hesge.ch>
Date: Tue, 14 Jun 2022 22:39:53 +0200
Subject: [PATCH] Minor doc update

---
 include/fmpi_core.h         | 17 ++++++++++-------
 include/fmpi_data.h         |  2 +-
 include/internal/fmpi_ctx.h |  2 +-
 include/internal/fmpi_mpi.h |  1 -
 src/fmpi_core.c             |  7 ++-----
 src/fmpi_ctx.c              |  6 +++---
 src/fmpi_domain.c           |  2 +-
 src/fmpi_error.c            |  6 +++---
 src/fmpi_futhark.c          |  4 ++--
 src/fmpi_mpi.c              |  6 +++---
 src/fmpi_reduce.c           |  9 +++------
 src/fmpi_stencil.c          |  2 +-
 src/fmpi_task.c             | 11 +++++++----
 13 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/include/fmpi_core.h b/include/fmpi_core.h
index 7505c71..81fc2f6 100644
--- a/include/fmpi_core.h
+++ b/include/fmpi_core.h
@@ -114,6 +114,16 @@ _Noreturn void fmpi_abort(const struct fmpi_ctx * ctx);
  * }
  */
 _Bool fmpi_is_root(const struct fmpi_ctx * ctx);
+/*------------------------------------------------------------------------------
+    fmpi_world_rank()
+------------------------------------------------------------------------------*/
+/**
+ * TODO
+ */
+int fmpi_world_rank(const struct fmpi_ctx * ctx);
+/*==============================================================================
+    MACRO
+==============================================================================*/
 /*------------------------------------------------------------------------------
     fmpi_root_printf()
 ------------------------------------------------------------------------------*/
@@ -123,13 +133,6 @@ do { \
         printf(__VA_ARGS__); \
     } \
 } while(0)
-/*------------------------------------------------------------------------------
-    fmpi_world_rank()
-------------------------------------------------------------------------------*/
-/**
- * TODO
- */
-int fmpi_world_rank(const struct fmpi_ctx * ctx);
 /*==============================================================================
     GUARD
 ==============================================================================*/
diff --git a/include/fmpi_data.h b/include/fmpi_data.h
index 5634d7d..aec3739 100644
--- a/include/fmpi_data.h
+++ b/include/fmpi_data.h
@@ -27,7 +27,7 @@
     INCLUDE
 ==============================================================================*/
 // C Standard Library
-#include <stddef.h>
+#include <stddef.h> // size_t
 #include <stdint.h>
 // Internal
 #include "internal/fmpi_common.h"
diff --git a/include/internal/fmpi_ctx.h b/include/internal/fmpi_ctx.h
index 1ac74a1..f4b3f80 100644
--- a/include/internal/fmpi_ctx.h
+++ b/include/internal/fmpi_ctx.h
@@ -32,7 +32,7 @@
 #include "../fmpi_task.h"
 #include "fmpi_error.h"
 /*==============================================================================
-    STRUCT
+    TYPE
 ==============================================================================*/
 /*------------------------------------------------------------------------------
     fmpi_ctx
diff --git a/include/internal/fmpi_mpi.h b/include/internal/fmpi_mpi.h
index a81bc5b..adbd6b0 100644
--- a/include/internal/fmpi_mpi.h
+++ b/include/internal/fmpi_mpi.h
@@ -26,7 +26,6 @@
 /*==============================================================================
     INCLUDE
 ==============================================================================*/
-// C Standard Library
 // External
 #include <mpi.h> // MPI_MAX_PROCESSOR_NAME
 // Internal
diff --git a/src/fmpi_core.c b/src/fmpi_core.c
index 0bc6ee4..fde5d21 100644
--- a/src/fmpi_core.c
+++ b/src/fmpi_core.c
@@ -26,7 +26,7 @@
 // C Standard Library
 #include <assert.h>
 #include <stdio.h>  // fprintf()
-#include <stdlib.h> // NULL,
+#include <stdlib.h> // NULL, abort()
 // External
 #include <mpi.h>
 // Internal
@@ -34,10 +34,7 @@
 #include "internal/fmpi_futhark.h"
 #include "internal/fmpi_mpi.h"
 /*==============================================================================
-    STRUCT
-==============================================================================*/
-/*==============================================================================
-    PUBLIC FUNCTION
+    PUBLIC FUNCTION DEFINITION
 ==============================================================================*/
 /*------------------------------------------------------------------------------
     fmpi_init()
diff --git a/src/fmpi_ctx.c b/src/fmpi_ctx.c
index 03b87e6..58eca0e 100644
--- a/src/fmpi_ctx.c
+++ b/src/fmpi_ctx.c
@@ -26,8 +26,8 @@
 // C Standard Library
 #include <assert.h>
 #include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <stdio.h>  // fprintf()
+#include <stdlib.h> // NULL, free(), malloc()
 #include <string.h>
 // Internal
 #include "internal/fmpi_error.h"
@@ -93,7 +93,7 @@ struct fmpi_ctx * fmpi_ctx_create(int * argc, char ** argv[])
     return ctx;
 }
 /*------------------------------------------------------------------------------
-    fmpi_ctx_create()
+    fmpi_ctx_destroy()
 ------------------------------------------------------------------------------*/
 int fmpi_ctx_destroy(struct fmpi_ctx ** const ctx)
 {
diff --git a/src/fmpi_domain.c b/src/fmpi_domain.c
index 79f359c..7181323 100644
--- a/src/fmpi_domain.c
+++ b/src/fmpi_domain.c
@@ -25,7 +25,7 @@
 #include "fmpi_domain.h"
 // C Standard Library
 #include <assert.h>
-#include <stdlib.h>
+#include <stdlib.h> // size_t, NULL, malloc()
 // Internal
 #include "fmpi_data.h"
 #include "internal/fmpi_ctx.h"
diff --git a/src/fmpi_error.c b/src/fmpi_error.c
index 8b8b397..707949f 100644
--- a/src/fmpi_error.c
+++ b/src/fmpi_error.c
@@ -26,10 +26,10 @@
 // C Standard Library
 #include <assert.h>
 #include <stdarg.h>
-#include <stdio.h>  // NULL, vsnprintf()
-#include <time.h>   // time_t, time()
+#include <stdio.h>  // NULL, size_t, vsnprintf()
+#include <time.h>   // time_t, struct tm, localtime(), strftime(), time()
 /*==============================================================================
-    PUBLIC FUNCTION
+    PUBLIC FUNCTION DEFINITION
 ==============================================================================*/
 /*------------------------------------------------------------------------------
     fmpi_raise_error()
diff --git a/src/fmpi_futhark.c b/src/fmpi_futhark.c
index c3137f4..5d3f3c5 100644
--- a/src/fmpi_futhark.c
+++ b/src/fmpi_futhark.c
@@ -27,7 +27,7 @@
 #include <assert.h>
 #include <stdbool.h>
 #include <stdint.h> // int64_t
-#include <stdlib.h>
+#include <stdlib.h> // NULL, size_t, free(), malloc()
 // Internal
 #include "internal/fmpi_common.h"
 #include "internal/fmpi_ctx.h"
@@ -55,7 +55,7 @@ do { \
     } \
 } while(0)
 /*==============================================================================
-    PUBLIC FUNCTION
+    PUBLIC FUNCTION DEFINITION
 ==============================================================================*/
 /*------------------------------------------------------------------------------
     fmpi_futhark_init()
diff --git a/src/fmpi_mpi.c b/src/fmpi_mpi.c
index f4ea761..1609ec4 100644
--- a/src/fmpi_mpi.c
+++ b/src/fmpi_mpi.c
@@ -26,8 +26,8 @@
 // C Standard Library
 #include <assert.h>
 #include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <stdio.h>  // printf()
+#include <stdlib.h> // NULL, free(), malloc()
 // External
 #include <mpi.h>
 // Internal
@@ -46,7 +46,7 @@ do { \
     } \
 } while(0)
 /*==============================================================================
-    PUBLIC FUNCTION
+    PUBLIC FUNCTION DEFINITION
 ==============================================================================*/
 /*------------------------------------------------------------------------------
     fmpi_mpi_init()
diff --git a/src/fmpi_reduce.c b/src/fmpi_reduce.c
index 3c0936e..2df7f00 100644
--- a/src/fmpi_reduce.c
+++ b/src/fmpi_reduce.c
@@ -26,8 +26,8 @@
 // C Standard Library
 #include <assert.h>
 #include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <stdio.h>  // fprintf()
+#include <stdlib.h> // NULL, size_t, free(), malloc()
 // Internal
 #include "internal/fmpi_ctx.h"
 #include "internal/fmpi_futhark.h"
@@ -35,10 +35,7 @@
 #include "internal/fmpi_mpi.h"
 #include "internal/generic/fmpi_generic.h"
 /*==============================================================================
-    STRUCT
-==============================================================================*/
-/*==============================================================================
-    PUBLIC FUNCTION
+    PUBLIC FUNCTION DEFINITION
 ==============================================================================*/
 #define FMPI_REDUCE_DEFINITION(T) \
 T fmpi_local_reduce_prod_##T( \
diff --git a/src/fmpi_stencil.c b/src/fmpi_stencil.c
index 2e466a2..825bc50 100644
--- a/src/fmpi_stencil.c
+++ b/src/fmpi_stencil.c
@@ -26,7 +26,7 @@
 // C Standard Library
 #include <stddef.h> // size_t
 /*==============================================================================
-    PUBLIC FUNCTION
+    PUBLIC FUNCTION DEFINITION
 ==============================================================================*/
 /*------------------------------------------------------------------------------
     fmpi_no_stencil()
diff --git a/src/fmpi_task.c b/src/fmpi_task.c
index e65be4d..6f5b799 100644
--- a/src/fmpi_task.c
+++ b/src/fmpi_task.c
@@ -25,7 +25,7 @@
 #include "fmpi_task.h"
 // C Standard Library
 #include <assert.h>
-#include <stdint.h> // int64_t
+#include <stddef.h> // NULL, size_t
 // Internal
 #include "fmpi_domain.h"
 #include "fmpi_stencil.h"
@@ -39,7 +39,7 @@
     PUBLIC FUNCTION DEFINITION
 ==============================================================================*/
 /*------------------------------------------------------------------------------
-    fmpi_task_run()
+    fmpi_task_register()
 ------------------------------------------------------------------------------*/
 struct fmpi_task fmpi_task_register(
     struct fmpi_ctx * ctx, const fmpi_task_func func,
@@ -73,9 +73,12 @@ struct fmpi_task fmpi_task_register(
     futhark_context_sync(ctx->fut->ctx);
     return task;
 }
+/*------------------------------------------------------------------------------
+    fmpi_task_run()
+------------------------------------------------------------------------------*/
 void fmpi_task_run(
-    const struct fmpi_ctx * const ctx, const struct fmpi_task * const  task
-){
+    const struct fmpi_ctx * const ctx, const struct fmpi_task * const task
+) {
     assert(ctx != NULL);
     assert(task != NULL);
     task->func(ctx, &task->args);
-- 
GitLab