Skip to content

Commit

Permalink
Bug#28099963 POSSIBLY UNUSED FUNCTIONS IN XDR_UTILS
Browse files Browse the repository at this point in the history
Problem
-------
Clang generates warnings when compiling XCom.

Analysis
--------
We make use of the define_xdr_funcs macro even when we do not need all the
functions it generates.

Solution
--------
The community contributed a patch that marked all the functions generated by
define_xdr_funcs as unused. The patch's approach fixes the symptoms by telling
the compiler that all the functions generated by the define_xdr_funcs are always
unused. That is not true, although it does shut the compiler up.

Since the contributed patch does not apply cleanly anymore, we improve on the
submitted patch by only generating the functions that are needed.

Reviewed-by: Luis Soares <[email protected]>
  • Loading branch information
tvale committed Jun 25, 2018
1 parent f7bfaea commit 1f610f7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -33,8 +33,7 @@
#include "node_list.h"
#include "xcom_vp_str.h"

define_xdr_funcs(synode_no)
define_xdr_funcs(app_data_ptr)
clone_xdr_array(synode_no)

static app_data_list nextp(app_data_list l);
static unsigned long msg_count(app_data_ptr a);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ struct site_def_ptr_array {
};
typedef struct site_def_ptr_array site_def_ptr_array;

define_xdr_funcs(site_def_ptr)
init_xdr_array(site_def_ptr)
free_xdr_array(site_def_ptr)
set_xdr_array(site_def_ptr)

/* FIFO of site definitions */
static site_def_ptr_array site_defs;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -60,8 +60,6 @@ int synode_gt(synode_no x, synode_no y)
}

/* purecov: begin deadcode */
define_xdr_funcs(synode_no)

synode_no vp_count_to_synode(u_long high, u_long low, node_no nodeid,
uint32_t groupid)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ typedef struct {
task_env_p *task_env_p_array_val;
} task_env_p_array;

define_xdr_funcs(pollfd)
define_xdr_funcs(task_env_p)
init_xdr_array(pollfd)
free_xdr_array(pollfd)
set_xdr_array(pollfd)
get_xdr_array(pollfd)
init_xdr_array(task_env_p)
free_xdr_array(task_env_p)
set_xdr_array(task_env_p)
get_xdr_array(task_env_p)

struct iotasks {
int nwait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,6 @@ static bool_t is_dead_site(uint32_t id)
return FALSE;
}

define_xdr_funcs(node_no)


extern node_set *init_node_set(node_set *set, u_int n);
extern node_set *alloc_node_set(node_set *set, u_int n);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -45,9 +45,6 @@ int client_boot_done = 0;
int netboot_ok = 0;
int booting = 0;

define_xdr_funcs(synode_no)
define_xdr_funcs(app_data_ptr)

/* purecov: begin deadcode */
void init_recover_vars()
{
Expand Down

0 comments on commit 1f610f7

Please sign in to comment.