I ran the testsuite on a machine where the C++ compiler was C++20 by
default, and noticed a bunch of errors like this:
gdb compile failed, /tmp/BUILD/gdb-17.1-build/gdb-17.1/gdb/testsuite/gdb.base/infcall-nested-structs.c: In function 'void breakpt()':
/tmp/BUILD/gdb-17.1-build/gdb-17.1/gdb/testsuite/gdb.base/infcall-nested-structs.c:414:3: warning: '++' expression of 'volatile'-qualified type is deprecated [-Wvolatile]
414 | v++;
| ^
UNRESOLVED: gdb.base/infcall-nested-structs-c++.exp: types-tl: failed to compile
My understanding is that, in C++20, some operations on volatile
variables are now deprecated. So things like:
volatile int var = 0;
++var;
--var
var += 1;
var -= 1;
Are now, I believe, all deprecated. However, this is still allowed:
var = var + 1;
There are a few test cases where this impacts us, though in every case
the increment of the volatile only existed in order to create filler
work, as far as I can tell the volatile variable is never inspected
from GDB.
In gdb.base/infcall-nested-structs.c I just deleted the volatile
completely.
In the other tests I replaced the '++' with 'var = var + 1' type code.
I don't believe there should be any change in what is actually being
tested after this patch.
return val;
}
-int volatile v = 1;
-
void __attribute__((noinline)) ATTRIBUTE_NOCLONE
breakpt (void)
{
- v++;
+ /* Nothing. */
}
int
class C1
{
public:
- static void __attribute__((always_inline)) baz () { volatile unsigned i; i++; }
+ static void __attribute__((always_inline)) baz () { volatile unsigned i; i = i + 1; }
};
}
breakpt ()
{
/* Some filler work. */
- global++;
+ global = global + 1;
}
struct MyClass;
}
catch (...)
{
- counter++;
+ counter = counter + 1;
}
usleep (1);