Fix compiler warning about uninitialized variable

Fixes #1051
This commit is contained in:
Christian Helmuth 2014-11-28 16:21:44 +01:00
parent 9c0ced0a85
commit f9422b241f

View File

@ -107,22 +107,10 @@ namespace Genode {
if (opcode == Index_of<Rpc_functions, This_rpc_function>::Value) { if (opcode == Index_of<Rpc_functions, This_rpc_function>::Value) {
/* typename This_rpc_function::Server_args args{};
* 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;
/* read arguments from istream */ /* read arguments from istream */
_read_args(is, args.data()); _read_args(is, args);
{ {
Trace::Rpc_dispatch trace_event(This_rpc_function::name()); Trace::Rpc_dispatch trace_event(This_rpc_function::name());
@ -137,7 +125,7 @@ namespace Genode {
typename This_rpc_function::Ret_type ret; typename This_rpc_function::Ret_type ret;
Rpc_exception_code exc; Rpc_exception_code exc;
exc = _do_serve(args.data(), ret, Overload_selector<This_rpc_function, Exceptions>()); exc = _do_serve(args, ret, Overload_selector<This_rpc_function, Exceptions>());
os << ret; os << ret;
{ {
@ -145,7 +133,7 @@ namespace Genode {
} }
/* write results to ostream 'os' */ /* write results to ostream 'os' */
_write_results(os, args.data()); _write_results(os, args);
return exc; return exc;
} }