diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-10-31 12:02:03 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-11-04 15:48:57 -0400 |
commit | fcef6471ed3c07d6eac2d9e0010552994f0891aa (patch) | |
tree | 22738befcaa3ea4f3f4533b733fe5a2ae17ca5bf /opcodes/xstormy16-asm.c | |
parent | 7ead06a8b65ef038abd65344ff6aea76054ea1d5 (diff) | |
download | gdb-fcef6471ed3c07d6eac2d9e0010552994f0891aa.zip gdb-fcef6471ed3c07d6eac2d9e0010552994f0891aa.tar.gz gdb-fcef6471ed3c07d6eac2d9e0010552994f0891aa.tar.bz2 |
gdb: pass/return setting setter/getter scalar values by value
The getter and setter in struct setting always receive and return values
by const reference. This is not necessary for scalar values (like bool
and int), but more importantly it makes it a bit annoying to write a
getter, you have to use a scratch static variable or something similar
that you can refer to:
const bool &
my_getter ()
{
static bool value;
value = function_returning_bool ();
return value;
}
Change the getter and setter function signatures to receive and return
value by value instead of by reference, when the underlying data type is
scalar. This means that string-based settings will still use
references, but all others will be by value. The getter above would
then be re-written as:
bool
my_getter ()
{
return function_returning_bool ();
}
This is useful for a patch later in this series that defines a boolean
setting with a getter and a setter.
Change-Id: Ieca3a2419fcdb75a6f75948b2c920b548a0af0fd
Diffstat (limited to 'opcodes/xstormy16-asm.c')
0 files changed, 0 insertions, 0 deletions