From f8c128d1b7426784acb9111bcd51c1787ad0d876 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Sun, 18 Apr 2021 19:45:19 +0200
Subject: [PATCH] CONFIGURE: Use a macro to mark TODOs

---
 configure                | 6 ++++--
 configure.ac             | 6 ++++--
 inc/lektor/common.h      | 6 ++++++
 src/module/module_repo.c | 2 +-
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 23d9fd91..2f8ad181 100755
--- a/configure
+++ b/configure
@@ -18672,13 +18672,15 @@ fi
 # CFLAGS #
 ##########
 
+LLVM_CFLAGS="-Wno-error=\#pragma-messages -Wno-error=\#warnings"
 BASEFLAGS=`test "x${LKT_DEBUG_ENABLED}" = 'xyes' && echo "-g" || echo "-O3"`
-CFLAGS="-Werror -Wall -Wextra ${BASEFLAGS} -std=c11 -Wno-error=unknown-warning -Wno-error=\#warnings"
+CFLAGS="-Werror -Wall -Wextra ${BASEFLAGS} -std=c11"
 LDFLAGS="-rdynamic"
 ARFLAGS="cr"
 AR_FLAGS=$ARFLAGS
 if test "x$LKT_LTO" == "xyes" ; then
-    CFLAGS="-flto $CFLAGS"
+    # LTO <=> LLVM
+    CFLAGS="-flto $CFLAGS $LLVM_CFLAGS"
     LDFLAGS="-flto $LDFLAGS"
 fi
 
diff --git a/configure.ac b/configure.ac
index b6604c14..f626c8f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -264,13 +264,15 @@ fi
 # CFLAGS #
 ##########
 
+LLVM_CFLAGS="-Wno-error=\#pragma-messages -Wno-error=\#warnings"
 BASEFLAGS=`test "x${LKT_DEBUG_ENABLED}" = 'xyes' && echo "-g" || echo "-O3"`
-CFLAGS="-Werror -Wall -Wextra ${BASEFLAGS} -std=c11 -Wno-error=unknown-warning -Wno-error=\#warnings"
+CFLAGS="-Werror -Wall -Wextra ${BASEFLAGS} -std=c11"
 LDFLAGS="-rdynamic"
 ARFLAGS="cr"
 AR_FLAGS=$ARFLAGS
 if test "x$LKT_LTO" == "xyes" ; then
-    CFLAGS="-flto $CFLAGS"
+    # LTO <=> LLVM
+    CFLAGS="-flto $CFLAGS $LLVM_CFLAGS"
     LDFLAGS="-flto $LDFLAGS"
 fi
 
diff --git a/inc/lektor/common.h b/inc/lektor/common.h
index 5f36fde2..d3cab23b 100644
--- a/inc/lektor/common.h
+++ b/inc/lektor/common.h
@@ -42,6 +42,12 @@ extern EXIT_FUNCTION __not_implemented(const char *func, char *file, int line);
 
 #endif
 
+/* TODO macro, use like:
+ * #pragma message(TODO "What to do")*/
+#define _QUOTE(x) # x
+#define QUOTE(x) _QUOTE(x)
+#define TODO __FILE__ "(+" QUOTE(__LINE__) ") : "
+
 /* Max value for any buffer, to not squash the stack. */
 #define BUFFER_MAX 4096
 
diff --git a/src/module/module_repo.c b/src/module/module_repo.c
index b27dab28..7e782797 100644
--- a/src/module/module_repo.c
+++ b/src/module/module_repo.c
@@ -570,7 +570,7 @@ ___worker_rescan(void UNUSED *worker, void *___repo)
     repo->updating &= REPO_UPDATE_KARA;
     GOTO_IF(pthread_mutex_unlock(&(repo->mtx)), "Failed to unlock", end_no_lock);
 
-#warning "Pass the check stop condition to the database_update from the REPO module"
+#pragma message(TODO "Pass the check stop condition to the database_update from the REPO module")
     database_update(repo->db, kara_prefix, 0);
     /* Don't check timestamp. TODO: Sometimes we want to check them */
 
-- 
GitLab