From f9422b241f6f63912a8ba76456220a1e11f1f887 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Fri, 28 Nov 2014 16:21:44 +0100 Subject: [PATCH] Fix compiler warning about uninitialized variable Fixes #1051 --- repos/base/include/base/rpc_server.h | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/repos/base/include/base/rpc_server.h b/repos/base/include/base/rpc_server.h index ea81ebba67..85ca9f9359 100644 --- a/repos/base/include/base/rpc_server.h +++ b/repos/base/include/base/rpc_server.h @@ -107,22 +107,10 @@ namespace Genode { if (opcode == Index_of::Value) { - /* - * Argument receive buffer - * - * To prevent the compiler from complaining about the - * 'Server_args' data structure from being uninitialized, - * we instantiate the variable as volatile and strip away - * the volatile-ness when using it. - */ - struct { - typedef typename This_rpc_function::Server_args Data; - volatile Data _data; - Data &data() { return *(Data *)(&_data); } - } args; + typename This_rpc_function::Server_args args{}; /* read arguments from istream */ - _read_args(is, args.data()); + _read_args(is, args); { Trace::Rpc_dispatch trace_event(This_rpc_function::name()); @@ -137,7 +125,7 @@ namespace Genode { typename This_rpc_function::Ret_type ret; Rpc_exception_code exc; - exc = _do_serve(args.data(), ret, Overload_selector()); + exc = _do_serve(args, ret, Overload_selector()); os << ret; { @@ -145,7 +133,7 @@ namespace Genode { } /* write results to ostream 'os' */ - _write_results(os, args.data()); + _write_results(os, args); return exc; }