Paul Guo created HAWQ-1182:
------------------------------
Summary: Add Macro for unused argument and variable.
Key: HAWQ-1182
URL: https://issues.apache.org/jira/browse/HAWQ-1182
Project: Apache HAWQ
Issue Type: Bug
Reporter: Paul Guo
Assignee: Lei Chang
Fix For: 2.0.1.0-incubating
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(x) ((void)x)
+#endif
+
+#ifndef POSSIBLE_UNUSED_ARG
+#define POSSIBLE_UNUSED_ARG(x) ((void)x)
+#endif
+
+#ifndef UNUSED_ARG
+#define UNUSED_ARG(x) ((void)x)
+#endif
+
#ifdef __cplusplus
} /* extern "C" */
#endif
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)