]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/testsuite: update C++ tests for volatile changes in C++20
authorAndrew Burgess <aburgess@redhat.com>
Thu, 12 Feb 2026 18:22:50 +0000 (18:22 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Thu, 19 Feb 2026 10:43:37 +0000 (10:43 +0000)
commit120072c7cdc14f2e6e2ca1fe4a8eb5bec9e6e36b
treef28fbfc5972ccaa7accf9e613eda04d77268d35e
parent13a7a6aa0d18e1faced5d3b88ab81fa6f95e845f
gdb/testsuite: update C++ tests for volatile changes in C++20

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.
gdb/testsuite/gdb.base/infcall-nested-structs.c
gdb/testsuite/gdb.cp/breakpoint-locs.h
gdb/testsuite/gdb.opt/empty-inline-cxx.cc
gdb/testsuite/gdb.threads/next-while-other-thread-longjmps.c