[Pacemaker] [PATCH] Dev: build: avoid GCC 4.6 warnings

Andrew Beekhof andrew at beekhof.net
Fri Jul 1 06:34:34 UTC 2011


2011/6/28 Pádraig Brady <P at draigbrady.com>:
> # HG changeset patch
> # User Pádraig Brady <P at draigBrady.com>
> # Date 1309255312 -3600
> # Node ID 7948a86a7e9510db13baa318fe64e9015fdbbd72
> # Parent  75575ce398615dff21e2309c6b97523e99499498
> Dev: build: avoid GCC 4.6 warnings
>
> diff -r 75575ce39861 -r 7948a86a7e95 crmd/election.c
> --- a/crmd/election.c   Tue Jun 21 15:54:20 2011 +0200
> +++ b/crmd/election.c   Tue Jun 28 11:01:52 2011 +0100
> @@ -445,6 +445,8 @@
>            }
>
>            last_election_win = time(NULL);
> +#else
> +            (void) last_election_win;
>  #endif
>            register_fsa_input(C_FSA_INTERNAL, I_ELECTION, NULL);
>            g_hash_table_destroy(voted);

Why is this necessary?  last_election_win is already used outside of
the #if 0 block.


> diff -r 75575ce39861 -r 7948a86a7e95 crmd/lrm.c
> --- a/crmd/lrm.c        Tue Jun 21 15:54:20 2011 +0200
> +++ b/crmd/lrm.c        Tue Jun 28 11:01:52 2011 +0100
> @@ -621,6 +621,8 @@
>     if(non_empty) {
>        crm_log_xml_debug(restart, "restart digest source");
>     }
> +#else
> +    (void) non_empty;
>  #endif

Same here.  I'd like to know why the compiler is complaining before
applying these.

>
>     free_xml(restart);
> @@ -1275,7 +1277,7 @@
>        fsa_cib_update(XML_CIB_TAG_STATUS, fragment,
>                       cib_quorum_override, rc, user_name);
>        free_xml(fragment);
> -
> +       (void) rc;
>     } else if(safe_str_eq(crm_op, CRM_OP_LRM_QUERY)) {
>        xmlNode *data = do_lrm_query(FALSE);
>        xmlNode *reply = create_reply(input->msg, data);
> diff -r 75575ce39861 -r 7948a86a7e95 crmd/te_actions.c
> --- a/crmd/te_actions.c Tue Jun 21 15:54:20 2011 +0200
> +++ b/crmd/te_actions.c Tue Jun 28 11:01:52 2011 +0100
> @@ -240,7 +240,6 @@
>        lrm_op_t *op = NULL;
>        xmlNode *state    = NULL;
>        xmlNode *rsc      = NULL;
> -       xmlNode *xml_op   = NULL;
>        xmlNode *action_rsc = NULL;
>
>        enum cib_errors rc = cib_ok;
> @@ -310,7 +309,7 @@
>        op->user_data = generate_transition_key(
>            transition_graph->id, action->id, target_rc, te_uuid);
>
> -       xml_op = create_operation_update(
> +       create_operation_update(
>            rsc, op, CRM_FEATURE_SET, target_rc, __FUNCTION__, LOG_INFO);
>        free_lrm_op(op);
>
> diff -r 75575ce39861 -r 7948a86a7e95 lib/cib/cib_ops.c
> --- a/lib/cib/cib_ops.c Tue Jun 21 15:54:20 2011 +0200
> +++ b/lib/cib/cib_ops.c Tue Jun 28 11:01:52 2011 +0100
> @@ -169,7 +169,6 @@
>     xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
>  {
>     const char *tag = NULL;
> -    gboolean verbose       = FALSE;
>     enum cib_errors result = cib_ok;
>
>     crm_debug_2("Processing \"%s\" event for section=%s",
> @@ -188,9 +187,6 @@
>
>     tag = crm_element_name(input);
>
> -    if (options & cib_verbose) {
> -       verbose = TRUE;
> -    }
>     if(safe_str_eq(XML_CIB_TAG_SECTION_ALL, section)) {
>        section = NULL;
>
> diff -r 75575ce39861 -r 7948a86a7e95 lib/cib/cib_remote.c
> --- a/lib/cib/cib_remote.c      Tue Jun 21 15:54:20 2011 +0200
> +++ b/lib/cib/cib_remote.c      Tue Jun 28 11:01:52 2011 +0100
> @@ -364,20 +364,27 @@
>
>     if(private->passwd == NULL) {
>        struct termios settings;
> -       int rc;
> -
> -       rc = tcgetattr (0, &settings);
> +       int rtc;
> +
> +       rtc = tcgetattr (0, &settings);
>        settings.c_lflag &= ~ECHO;
> -       rc = tcsetattr (0, TCSANOW, &settings);
> +       if (rtc == 0) {
> +           rtc = tcsetattr (0, TCSANOW, &settings);
> +       }
>
> -       fprintf(stderr, "Password: ");
> -       crm_malloc0(private->passwd, 1024);
> -       scanf("%s", private->passwd);
> -       fprintf(stdout, "\n");
> -       /* fprintf(stderr, "entered: '%s'\n", buffer); */
> +       if (rtc) {
> +           fprintf(stderr, "Error disabling terminal echo: [%d]\n", errno);
> +           rc = cib_unknown;
> +       } else {
> +           fprintf(stderr, "Password: ");
> +           crm_malloc0(private->passwd, 1024);
> +           scanf("%s", private->passwd);
> +           fprintf(stdout, "\n");
> +           /* fprintf(stderr, "entered: '%s'\n", buffer); */
>
> -       settings.c_lflag |= ECHO;
> -       rc = tcsetattr (0, TCSANOW, &settings);
> +           settings.c_lflag |= ECHO;
> +           tcsetattr (0, TCSANOW, &settings);
> +       }
>     }
>
>     if(private->server == NULL || private->user == NULL) {
> diff -r 75575ce39861 -r 7948a86a7e95 lib/common/utils.c
> --- a/lib/common/utils.c        Tue Jun 21 15:54:20 2011 +0200
> +++ b/lib/common/utils.c        Tue Jun 28 11:01:52 2011 +0100
> @@ -2253,7 +2253,7 @@
>        return TRUE;
>     }
>
> -    crm_info("Could not send update: %s=%s for %s", name, value, host?host:"localhost");
> +    crm_info("Could not send update: %s=%s for %s: %s", name, value, host?host:"localhost", reason);
>     return FALSE;
>  }
>
> diff -r 75575ce39861 -r 7948a86a7e95 lib/common/xml.c
> --- a/lib/common/xml.c  Tue Jun 21 15:54:20 2011 +0200
> +++ b/lib/common/xml.c  Tue Jun 28 11:01:52 2011 +0100
> @@ -1168,7 +1168,6 @@
>     const char *prefix, xmlNode *data, int depth, gboolean formatted)
>  {
>     xmlNode *a_child = NULL;
> -    int child_result = 0;
>
>     int offset = 0;
>     int printed = 0;
> @@ -1230,7 +1229,7 @@
>     }
>
>     for(a_child = __xml_first_child(data); a_child != NULL; a_child = __xml_next(a_child)) {
> -       child_result = log_data_element(
> +       log_data_element(
>            log_level, file, function, line, prefix, a_child, depth+1, formatted);
>     }
>
> diff -r 75575ce39861 -r 7948a86a7e95 pengine/clone.c
> --- a/pengine/clone.c   Tue Jun 21 15:54:20 2011 +0200
> +++ b/pengine/clone.c   Tue Jun 28 11:01:52 2011 +0100
> @@ -750,8 +750,6 @@
>     action_t *started = NULL;
>
>     GListPtr gIter = rsc->children;
> -    resource_t *last_start_rsc = NULL;
> -    resource_t *last_stop_rsc = NULL;
>     clone_variant_data_t *clone_data = NULL;
>
>     get_clone_variant_data(clone_data, rsc);
> @@ -764,13 +762,6 @@
>        child_rsc->cmds->create_actions(child_rsc, data_set);
>        clone_update_pseudo_status(
>            child_rsc, &child_stopping, &child_starting, &child_active);
> -
> -       if(is_set(child_rsc->flags, pe_rsc_starting)) {
> -           last_start_rsc = child_rsc;
> -       }
> -       if(is_set(child_rsc->flags, pe_rsc_stopping)) {
> -           last_stop_rsc = child_rsc;
> -       }
>     }
>
>     /* start */
> @@ -869,9 +860,7 @@
>  {
>     node_t *node = NULL;
>     GListPtr gIter = NULL;
> -    clone_variant_data_t *clone_data = NULL;
> -    get_clone_variant_data(clone_data, rsc);
> -
> +
>     if(local_node == NULL) {
>        crm_err("Can't colocate unrunnable child %s with %s",
>                local_child->id, rsc->id);
> @@ -918,9 +907,7 @@
>     GListPtr gIter = NULL;
>     GListPtr scratch = NULL;
>     node_t *local_node = NULL;
> -    clone_variant_data_t *clone_data = NULL;
> -    get_clone_variant_data(clone_data, rsc);
> -
> +
>     local_node = local_child->fns->location(local_child, NULL, current);
>     if(local_node) {
>        return find_compatible_child_by_node(local_child, local_node, rsc, filter, current);
> diff -r 75575ce39861 -r 7948a86a7e95 pengine/group.c
> --- a/pengine/group.c   Tue Jun 21 15:54:20 2011 +0200
> +++ b/pengine/group.c   Tue Jun 28 11:01:52 2011 +0100
> @@ -437,8 +437,6 @@
>  void group_expand(resource_t *rsc, pe_working_set_t *data_set)
>  {
>     GListPtr gIter = rsc->children;
> -    group_variant_data_t *group_data = NULL;
> -    get_group_variant_data(group_data, rsc);
>
>     crm_debug_3("Processing actions from %s", rsc->id);
>
> diff -r 75575ce39861 -r 7948a86a7e95 pengine/main.c
> --- a/pengine/main.c    Tue Jun 21 15:54:20 2011 +0200
> +++ b/pengine/main.c    Tue Jun 28 11:01:52 2011 +0100
> @@ -99,7 +99,6 @@
>  {
>        int flag;
>        int argerr = 0;
> -       gboolean allow_cores = TRUE;
>        IPC_Channel *old_instance = NULL;
>
>        crm_system_name = CRM_SYSTEM_PENGINE;
> @@ -114,7 +113,7 @@
>                                usage(crm_system_name, LSB_EXIT_OK);
>                                break;
>                        case 'c':
> -                               allow_cores = TRUE;
> +                                /* ignore */
>                                break;
>                        default:
>                                ++argerr;
> diff -r 75575ce39861 -r 7948a86a7e95 pengine/master.c
> --- a/pengine/master.c  Tue Jun 21 15:54:20 2011 +0200
> +++ b/pengine/master.c  Tue Jun 28 11:01:52 2011 +0100
> @@ -862,9 +862,7 @@
>     resource_t *rsc_lh, resource_t *rsc_rh, rsc_colocation_t *constraint)
>  {
>     GListPtr gIter = NULL;
> -    clone_variant_data_t *clone_data = NULL;
> -    get_clone_variant_data(clone_data, rsc_rh);
> -
> +
>     CRM_CHECK(rsc_rh != NULL, return);
>     if(is_set(rsc_rh->flags, pe_rsc_provisional)) {
>        return;
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker
>




More information about the Pacemaker mailing list