]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
GDB: maint: Fix build on FreeBSD
authorThiago Jung Bauermann <thiago.bauermann@linaro.org>
Thu, 26 Jun 2025 17:05:24 +0000 (14:05 -0300)
committerThiago Jung Bauermann <thiago.bauermann@linaro.org>
Fri, 27 Jun 2025 20:44:30 +0000 (17:44 -0300)
While trying to build current trunk of GDB on FreeBSD 14.3 on aarch64,
I hit this warning converted to an error:

In file included from /home/bauermann/src/binutils-gdb/gdb/maint.c:37:
/home/bauermann/src/binutils-gdb/gdb/maint.h:64:8: error: private field 'm_start_space' is not used [-Werror,-Wunused-private-field]
   64 |   long m_start_space;
      |        ^
1 error generated.
gmake[2]: *** [Makefile:1973: maint.o] Error 1

I used the default compiler on this system:

$ c++ --version
FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)
Target: aarch64-unknown-freebsd14.3
Thread model: posix
InstalledDir: /usr/bin

The problem is that the only two places that use m_start_space are
guarded by HAVE_USEFUL_SBRK, so also guard the member declaration with
it.

Build-tested on aarch64-unknown-freebsd14.3.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/maint.h

index cccb6f60354f2d13d4dd6cab562ec93ced933663..693001801b2c4fe534b63b2eb0a5ee46b051e272 100644 (file)
@@ -61,7 +61,9 @@ class scoped_command_stats
   bool m_symtab_enabled : 1;
   run_time_clock::time_point m_start_cpu_time;
   std::chrono::steady_clock::time_point m_start_wall_time;
+#ifdef HAVE_USEFUL_SBRK
   long m_start_space;
+#endif
   /* Total number of symtabs (over all objfiles).  */
   int m_start_nr_symtabs;
   /* A count of the compunits.  */