]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/tdep] Simplify i386_thiscall_push_dummy_call
authorTom de Vries <tdevries@suse.de>
Thu, 27 Nov 2025 11:52:03 +0000 (12:52 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 27 Nov 2025 11:52:03 +0000 (12:52 +0100)
commit24ea21fe77db8b3e6d8e4c91cd137fc537718a4a
tree714640efa7dcc0db4c9f7deb807088cdbdb1ad35
parentda97e9a1d95ac980c44b76d233301e4896039145
[gdb/tdep] Simplify i386_thiscall_push_dummy_call

I came across this code in i386_thiscall_push_dummy_call:
...
  int args_space = 0;
  ...
  for (write_pass = 0; write_pass < 2; write_pass++)
    {
      int args_space_used = 0;
      ...
  if (write_pass)
    {
      store_unsigned_integer (buf, 4, byte_order, struct_addr);
      write_memory (sp, buf, 4);
      args_space_used += 4;
    }
  else
    args_space += 4;
...
and wondered about the difference between arg_space and arg_space_used.

AFAICT, there is none:
- args_space is available after the loop, but unused after the loop
- in the loop body:
  - if write_pass == 0: args_space is used
  - if write_pass == 1: arg_space_used
- the code modifying args_space and args_space_used is identical

Simplify the loop body by using just one variable: args_space.

Tested on x86_64-linux with target board unix/-m32.
gdb/i386-tdep.c