Prevent compilation of frontend-only files in src/common/ with backend
authorMichael Paquier <michael@paquier.xyz>
Tue, 30 Jun 2020 04:26:11 +0000 (13:26 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 30 Jun 2020 04:26:11 +0000 (13:26 +0900)
Any frontend-only file of src/common/ should include a protection to
prevent such code to be included in the backend compilation.
fe_memutils.c and restricted_token.c have been doing that, while
file_utils.c (since bf5bb2e) and logging.c (since fc9a62a) forgot it.

Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/20200625080757.GI130132@paquier.xyz

src/common/file_utils.c
src/common/logging.c

index 7584c1f2fb4eed17a9dce2b45b200f2621a957b8..a2faafdf13a35ff337f24acd17bda75e8545a742 100644 (file)
  *
  *-------------------------------------------------------------------------
  */
+
+#ifndef FRONTEND
+#error "This file is not expected to be compiled for backend code"
+#endif
+
 #include "postgres_fe.h"
 
 #include <dirent.h>
index f3fc0b8262f71f450b0178a77ac3fd2c00e7944c..6a3a437a34bd3163a087fb36c0d407ae3f8cfad2 100644 (file)
@@ -7,6 +7,11 @@
  *
  *-------------------------------------------------------------------------
  */
+
+#ifndef FRONTEND
+#error "This file is not expected to be compiled for backend code"
+#endif
+
 #include "postgres_fe.h"
 
 #include <unistd.h>