Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Per discussion on the dev mail list. I want to add the Macros below to help eliminate some "unused" variable/argument warnings.
Typical cases:
1) Variable is only used with some configurations, etc. val for Assert(val). Then you could add the code below to eliminate the warning when cassert is not enabled.
POSSIBLE_UNUSED_VAR(val);
2) For argument that is explicitly unused but might be kept for compatibility, you could use UNUSED_ARG().
A simple patch, see below:
[pguo@host67:/data2/github/incubator-hawq-a/src/include]$ git diff
diff --git a/src/include/postgres.h b/src/include/postgres.h
index 1138f20..9391d6b 100644
— a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -513,6 +513,18 @@ extern void gp_set_thread_sigmasks(void);
extern void OnMoveOutCGroupForQE(void);
+#ifndef POSSIBLE_UNUSED_VAR
+#define POSSIBLE_UNUSED_VAR ((void)x)
+#endif
+
+#ifndef POSSIBLE_UNUSED_ARG
+#define POSSIBLE_UNUSED_ARG ((void)x)
+#endif
+
+#ifndef UNUSED_ARG
+#define UNUSED_ARG ((void)x)
+#endif
+
#ifdef __cplusplus
} /* extern "C" */
#endif
Attachments
Issue Links
- links to