You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by "Ed Espino (JIRA)" <ji...@apache.org> on 2016/12/22 06:29:58 UTC

[jira] [Resolved] (HAWQ-1182) Add Macro for unused argument and variable.

     [ https://issues.apache.org/jira/browse/HAWQ-1182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ed Espino resolved HAWQ-1182.
-----------------------------
    Resolution: Fixed

> 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: Paul Guo
>             Fix For: 2.1.0.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)