[binutils-gdb] gdb/gdbserver: fix some defined but unused function warnings

Andrew Burgess aburgess@sourceware.org
Tue Mar 26 12:15:00 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f4c19f89ef43dbce8065532c808e1aeb05d08994

commit f4c19f89ef43dbce8065532c808e1aeb05d08994
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Tue Mar 26 12:09:27 2024 +0000

    gdb/gdbserver: fix some defined but unused function warnings
    
    This commit:
    
      commit 198ff6ff819c240545f9fc68b39636fd376d4ba9
      Date:   Tue Jan 30 15:37:23 2024 +0000
    
          gdb/gdbserver: share x86/linux tdesc caching
    
    added some functions which are always defined, but their use is
    guarded within various #ifdef blocks.  As a result we were seeing
    errors about defined, but unused, functions.
    
    I've fixed this problem in this commit by wrapping the function
    definitions within #ifdef blocks.
    
    I'm a little worried that there might be too many #ifdef blocks within
    this file, however, I'm going to commit this fix for now as this will
    fix the build, then I'll think about if there's a better way to split
    this file so we might avoid some of these #ifdef blocks.

Diff:
---
 gdb/nat/x86-linux-tdesc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gdb/nat/x86-linux-tdesc.c b/gdb/nat/x86-linux-tdesc.c
index c438dfae84f..8a02f77fa6a 100644
--- a/gdb/nat/x86-linux-tdesc.c
+++ b/gdb/nat/x86-linux-tdesc.c
@@ -160,6 +160,8 @@ static constexpr x86_tdesc_feature x86_linux_all_tdesc_features[] = {
   { X86_XSTATE_X87,	true,	false, 	false }
 };
 
+#if defined __i386__ || !defined IN_PROCESS_AGENT
+
 /* Return a compile time constant which is a mask of all the cpu features
    that are checked for when building an i386 target description.  */
 
@@ -175,6 +177,10 @@ x86_linux_i386_tdesc_feature_mask ()
   return mask;
 }
 
+#endif /* __i386__ || !IN_PROCESS_AGENT */
+
+#ifdef __x86_64__
+
 /* Return a compile time constant which is a mask of all the cpu features
    that are checked for when building an amd64 target description.  */
 
@@ -205,6 +211,8 @@ x86_linux_x32_tdesc_feature_mask ()
   return mask;
 }
 
+#endif /* __x86_64__ */
+
 /* Return a compile time constant which is a count of the number of cpu
    features that are checked for when building an i386 target description.  */
 
@@ -222,6 +230,8 @@ x86_linux_i386_tdesc_count ()
   return (1 << count);
 }
 
+#if defined __x86_64__ || defined IN_PROCESS_AGENT
+
 /* Return a compile time constant which is a count of the number of cpu
    features that are checked for when building an amd64 target description.  */
 
@@ -256,6 +266,8 @@ x86_linux_x32_tdesc_count ()
   return (1 << count);
 }
 
+#endif /* __x86_64__ || IN_PROCESS_AGENT */
+
 #ifdef IN_PROCESS_AGENT
 
 /* See linux-x86-tdesc.h.  */


More information about the Gdb-cvs mailing list