diff --git a/cpp-btree b/cpp-btree index 903ec858..45e6d1f1 160000 --- a/cpp-btree +++ b/cpp-btree @@ -1 +1 @@ -Subproject commit 903ec858bc8ab00fc0fbd44c23f0ab7770772353 +Subproject commit 45e6d1f13196a0824e2089a586c53b9de0283f17 diff --git a/src/cli_common.cpp b/src/cli_common.cpp index afe61fc4..99092f85 100644 --- a/src/cli_common.cpp +++ b/src/cli_common.cpp @@ -12,7 +12,7 @@ void cli_tool_t::change_parent(inode_t cur, inode_t new_parent, cli_result_t *re { char buf[128]; snprintf(buf, 128, "Inode 0x%lx disappeared", cur); - *result = { .err = EIO, .text = buf }; + *result = (cli_result_t){ .err = EIO, .text = buf }; return; } inode_config_t new_cfg = cur_cfg_it->second; @@ -44,18 +44,18 @@ void cli_tool_t::change_parent(inode_t cur, inode_t new_parent, cli_result_t *re { if (err != "") { - *result = { .err = EIO, .text = "Error changing parent of "+cur_name+": "+err }; + *result = (cli_result_t){ .err = EIO, .text = "Error changing parent of "+cur_name+": "+err }; } else if (!res["succeeded"].bool_value()) { - *result = { .err = EAGAIN, .text = "Image "+cur_name+" was modified during change" }; + *result = (cli_result_t){ .err = EAGAIN, .text = "Image "+cur_name+" was modified during change" }; } else if (new_parent) { auto new_parent_it = cli->st_cli.inode_config.find(new_parent); std::string new_parent_name = new_parent_it != cli->st_cli.inode_config.end() ? new_parent_it->second.name : ""; - *result = { + *result = (cli_result_t){ .text = "Parent of layer "+cur_name+" (inode "+std::to_string(INODE_NO_POOL(cur))+ " in pool "+std::to_string(INODE_POOL(cur))+") changed to "+new_parent_name+ " (inode "+std::to_string(INODE_NO_POOL(new_parent))+" in pool "+std::to_string(INODE_POOL(new_parent))+")", @@ -63,7 +63,7 @@ void cli_tool_t::change_parent(inode_t cur, inode_t new_parent, cli_result_t *re } else { - *result = { + *result = (cli_result_t){ .text = "Parent of layer "+cur_name+" (inode "+std::to_string(INODE_NO_POOL(cur))+ " in pool "+std::to_string(INODE_POOL(cur))+") detached", }; @@ -80,9 +80,9 @@ void cli_tool_t::etcd_txn(json11::Json txn) { waiting--; if (err != "") - etcd_err = { .err = EIO, .text = "Error communicating with etcd: "+err }; + etcd_err = (cli_result_t){ .err = EIO, .text = "Error communicating with etcd: "+err }; else - etcd_err = { .err = 0 }; + etcd_err = (cli_result_t){ .err = 0 }; etcd_result = res; ringloop->wakeup(); }); diff --git a/src/cli_merge.cpp b/src/cli_merge.cpp index 9b333a25..420b7b1b 100644 --- a/src/cli_merge.cpp +++ b/src/cli_merge.cpp @@ -331,7 +331,7 @@ struct snap_merger_t printf("\rOverwriting blocks: %lu/%lu\n", to_process, to_process); } // Done - result = { .text = "Done, layers from "+from_name+" to "+to_name+" merged into "+target_name }; + result = (cli_result_t){ .text = "Done, layers from "+from_name+" to "+to_name+" merged into "+target_name }; state = 100; resume_100: return; diff --git a/src/nfs_conn.cpp b/src/nfs_conn.cpp index 5418f6bf..53e6142d 100644 --- a/src/nfs_conn.cpp +++ b/src/nfs_conn.cpp @@ -1152,11 +1152,15 @@ static int nfs3_pathconf_proc(void *opaque, rpc_op_t *rop) else { // Fill info + bool_t x = FALSE; *reply = (PATHCONF3res){ .status = NFS3_OK, .resok = (PATHCONF3resok){ .obj_attributes = { - .attributes_follow = FALSE, + // Without at least one reference to a non-constant value (local variable or something else), + // with gcc 8 we get "internal compiler error: side-effects element in no-side-effects CONSTRUCTOR" here + // FIXME: get rid of this after raising compiler requirement + .attributes_follow = x, }, .linkmax = 0, .name_max = 255, @@ -1243,7 +1247,7 @@ static int mount3_export_proc(void *opaque, rpc_op_t *rop) { nfs_client_t *self = (nfs_client_t*)opaque; nfs_exports *reply = (nfs_exports*)rop->reply; - *reply = (struct nfs_exportnode*)malloc(sizeof(struct nfs_exportnode) + sizeof(struct nfs_groupnode)); + *reply = (struct nfs_exportnode*)calloc_or_die(1, sizeof(struct nfs_exportnode) + sizeof(struct nfs_groupnode)); xdr_add_malloc(rop->xdrs, *reply); (*reply)->ex_dir = xdr_copy_string(rop->xdrs, self->parent->export_root); (*reply)->ex_groups = (struct nfs_groupnode*)(reply+1); diff --git a/src/nfs_portmap.cpp b/src/nfs_portmap.cpp index 96c57194..19675418 100644 --- a/src/nfs_portmap.cpp +++ b/src/nfs_portmap.cpp @@ -131,7 +131,7 @@ static std::string netid_tcp6 = "tcp6"; static int pmap3_dump_proc(portmap_service_t *self, rpc_op_t *rop) { PMAP3DUMPres *reply = (PMAP3DUMPres *)rop->reply; - pmap3_mapping_list *list = (pmap3_mapping_list*)malloc(sizeof(pmap3_mapping_list*) * self->reg_ports.size()); + pmap3_mapping_list *list = (pmap3_mapping_list*)malloc_or_die(sizeof(pmap3_mapping_list*) * self->reg_ports.size()); xdr_add_malloc(rop->xdrs, list); int i = 0; for (auto it = self->reg_ports.begin(); it != self->reg_ports.end(); it++) diff --git a/src/nfs_proxy.cpp b/src/nfs_proxy.cpp index 1c759bd3..3cf79280 100644 --- a/src/nfs_proxy.cpp +++ b/src/nfs_proxy.cpp @@ -827,8 +827,9 @@ int nfs_client_t::handle_rpc_message(void *base_buf, void *msg_buf, uint32_t msg if (inmsg->body.cbody.rpcvers != RPC_MSG_VERSION) { // Bad RPC version - rpc_op_t *rop = (rpc_op_t*)malloc(sizeof(rpc_op_t)); - *rop = { + rpc_op_t *rop = (rpc_op_t*)malloc_or_die(sizeof(rpc_op_t)); + u_int x = RPC_MSG_VERSION; + *rop = (rpc_op_t){ .client = this, .xdrs = xdrs, .out_msg = (rpc_msg){ @@ -840,7 +841,10 @@ int nfs_client_t::handle_rpc_message(void *base_buf, void *msg_buf, uint32_t msg .rreply = (rpc_rejected_reply){ .stat = RPC_MISMATCH, .mismatch_info = (rpc_mismatch_info){ - .min_version = RPC_MSG_VERSION, + // Without at least one reference to a non-constant value (local variable or something else), + // with gcc 8 we get "internal compiler error: side-effects element in no-side-effects CONSTRUCTOR" here + // FIXME: get rid of this after raising compiler requirement + .min_version = x, .max_version = RPC_MSG_VERSION, }, }, @@ -877,7 +881,7 @@ int nfs_client_t::handle_rpc_message(void *base_buf, void *msg_buf, uint32_t msg max_vers = max_vers_it->vers; } rpc_op_t *rop = (rpc_op_t*)malloc_or_die(sizeof(rpc_op_t)); - *rop = { + *rop = (rpc_op_t){ .client = this, .xdrs = xdrs, .out_msg = (rpc_msg){ @@ -909,6 +913,7 @@ int nfs_client_t::handle_rpc_message(void *base_buf, void *msg_buf, uint32_t msg rpc_op_t *rop = (rpc_op_t*)malloc_or_die( sizeof(rpc_op_t) + proc_it->req_size + proc_it->resp_size ); + rpc_reply_stat x = RPC_MSG_ACCEPTED; *rop = (rpc_op_t){ .client = this, .buffer = (uint8_t*)base_buf, @@ -918,7 +923,10 @@ int nfs_client_t::handle_rpc_message(void *base_buf, void *msg_buf, uint32_t msg .body = (rpc_msg_body){ .dir = RPC_REPLY, .rbody = (rpc_reply_body){ - .stat = RPC_MSG_ACCEPTED, + // Without at least one reference to a non-constant value (local variable or something else), + // with gcc 8 we get "internal compiler error: side-effects element in no-side-effects CONSTRUCTOR" here + // FIXME: get rid of this after raising compiler requirement + .stat = x, }, }, },