Uploaded image for project: 'Apache HAWQ'
  1. Apache HAWQ
  2. HAWQ-1182

Add Macro for unused argument and variable.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.1.0.0-incubating
    • 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

          Activity

            People

              Paul Guo Paul Guo
              Paul Guo Paul Guo
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: