From 70609152a1403e471e821f6b3a2c1b10ac677579 Mon Sep 17 00:00:00 2001
From: "raphael.bach" <raphael.bach@etu.hesge.ch>
Date: Wed, 18 May 2022 22:51:34 +0200
Subject: [PATCH] Add `fmpi_root_printf()`

---
 include/fmpi_core.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/fmpi_core.h b/include/fmpi_core.h
index 798833e..bd23f24 100644
--- a/include/fmpi_core.h
+++ b/include/fmpi_core.h
@@ -108,6 +108,15 @@ _Noreturn void fmpi_abort(void);
  * }
  */
 _Bool fmpi_is_root(const struct fmpi_ctx * ctx);
+/*------------------------------------------------------------------------------
+    fmpi_root_printf()
+------------------------------------------------------------------------------*/
+#define fmpi_root_printf(ctx, ...) \
+do { \
+    if(fmpi_is_root((ctx))) { \
+        printf(__VA_ARGS__); \
+    } \
+} while(0)
 /*==============================================================================
     GUARD
 ==============================================================================*/
-- 
GitLab