]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd macro conversion to inline functions, asymbol
authorAlan Modra <amodra@gmail.com>
Thu, 19 Sep 2019 02:45:16 +0000 (12:15 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 20 Sep 2019 08:34:02 +0000 (18:04 +0930)
* bfd-in.h (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_asymbol_flavour, bfd_set_asymbol_name): Delete.
* bfd.c (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_set_asymbol_name): New inline functions.
* targets.c (bfd_asymbol_flavour): Likewise.
* bfd-in2.h: Regenerate.

bfd/ChangeLog
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/bfd.c
bfd/targets.c

index 1c700dbfff7f679752ef451143dae6a6bc616fb5..5222063bf015e35b55253709762fe73eaf0df188 100644 (file)
@@ -1,3 +1,12 @@
+2019-09-20  Alan Modra  <amodra@gmail.com>
+
+       * bfd-in.h (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
+       (bfd_asymbol_bfd, bfd_asymbol_flavour, bfd_set_asymbol_name): Delete.
+       * bfd.c (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
+       (bfd_asymbol_bfd, bfd_set_asymbol_name): New inline functions.
+       * targets.c (bfd_asymbol_flavour): Likewise.
+       * bfd-in2.h: Regenerate.
+
 2019-09-20  Alan Modra  <amodra@gmail.com>
 
        * archive.c (bfd_generic_archive_p): Use bfd_set_thin_archive.
index 34c1c3ad0e9cfc6495729824ea9a2cb75b1cb989..e9ada8d27fbd9f9562332c02035de1a39ebd6ce5 100644 (file)
@@ -237,19 +237,6 @@ typedef unsigned long symindex;
 
 #define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
 
-/* General purpose part of a symbol X;
-   target specific parts are in libcoff.h, libaout.h, etc.  */
-
-#define bfd_asymbol_section(sy) ((sy)->section)
-#define bfd_asymbol_value(sy) ((sy)->section->vma + (sy)->value)
-#define bfd_asymbol_name(sy) ((sy)->name)
-#define bfd_asymbol_bfd(sy) ((sy)->the_bfd)
-#define bfd_asymbol_flavour(sy)                        \
-  (((sy)->flags & BSF_SYNTHETIC) != 0          \
-   ? bfd_target_unknown_flavour                        \
-   : (sy)->the_bfd->xvec->flavour)
-#define bfd_set_asymbol_name(sy, n) do { (sy)->name = (n); } while (0)
-
 /* A canonical archive symbol.  */
 /* This is a type pun with struct ranlib on purpose!  */
 typedef struct carsym
index 4f158679b2ef49a0103d7a93ccddf31cee113321..5ac3f41b7adc8eb88845f0485d7177bf676dc30f 100644 (file)
@@ -244,19 +244,6 @@ typedef unsigned long symindex;
 
 #define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
 
-/* General purpose part of a symbol X;
-   target specific parts are in libcoff.h, libaout.h, etc.  */
-
-#define bfd_asymbol_section(sy) ((sy)->section)
-#define bfd_asymbol_value(sy) ((sy)->section->vma + (sy)->value)
-#define bfd_asymbol_name(sy) ((sy)->name)
-#define bfd_asymbol_bfd(sy) ((sy)->the_bfd)
-#define bfd_asymbol_flavour(sy)                        \
-  (((sy)->flags & BSF_SYNTHETIC) != 0          \
-   ? bfd_target_unknown_flavour                        \
-   : (sy)->the_bfd->xvec->flavour)
-#define bfd_set_asymbol_name(sy, n) do { (sy)->name = (n); } while (0)
-
 /* A canonical archive symbol.  */
 /* This is a type pun with struct ranlib on purpose!  */
 typedef struct carsym
@@ -7381,6 +7368,36 @@ bfd_set_usrdata (bfd *abfd, void *val)
   abfd->usrdata = val;
 }
 
+static inline asection *
+bfd_asymbol_section (const asymbol *sy)
+{
+  return sy->section;
+}
+
+static inline bfd_vma
+bfd_asymbol_value (const asymbol *sy)
+{
+  return sy->section->vma + sy->value;
+}
+
+static inline const char *
+bfd_asymbol_name (const asymbol *sy)
+{
+  return sy->name;
+}
+
+static inline struct bfd *
+bfd_asymbol_bfd (const asymbol *sy)
+{
+  return sy->the_bfd;
+}
+
+static inline void
+bfd_set_asymbol_name (asymbol *sy, const char *name)
+{
+  sy->name = name;
+}
+
 
 typedef enum bfd_error
 {
@@ -8135,6 +8152,14 @@ bfd_get_symbol_leading_char (const bfd *abfd)
   return abfd->xvec->symbol_leading_char;
 }
 
+static inline enum bfd_flavour
+bfd_asymbol_flavour (const asymbol *sy)
+{
+  if ((sy->flags & BSF_SYNTHETIC) != 0)
+    return bfd_target_unknown_flavour;
+  return sy->the_bfd->xvec->flavour;
+}
+
 bfd_boolean bfd_set_default_target (const char *name);
 
 const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
index c11274c187f0b09dca7cdbd3d51f1d25cc82a2af..9270e118d3f5e62344553b6e7ab9d5fc6eb593be 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -447,6 +447,36 @@ CODE_FRAGMENT
 .  abfd->usrdata = val;
 .}
 .
+.static inline asection *
+.bfd_asymbol_section (const asymbol *sy)
+.{
+.  return sy->section;
+.}
+.
+.static inline bfd_vma
+.bfd_asymbol_value (const asymbol *sy)
+.{
+.  return sy->section->vma + sy->value;
+.}
+.
+.static inline const char *
+.bfd_asymbol_name (const asymbol *sy)
+.{
+.  return sy->name;
+.}
+.
+.static inline struct bfd *
+.bfd_asymbol_bfd (const asymbol *sy)
+.{
+.  return sy->the_bfd;
+.}
+.
+.static inline void
+.bfd_set_asymbol_name (asymbol *sy, const char *name)
+.{
+.  sy->name = name;
+.}
+.
 */
 
 #include "sysdep.h"
index 116a5c34de88d6791faa1c833a72492895764aa6..717657fba4450615fa858ff6e99970e2c344b166 100644 (file)
@@ -644,6 +644,14 @@ to find an alternative output format that is suitable.
 .  return abfd->xvec->symbol_leading_char;
 .}
 .
+.static inline enum bfd_flavour
+.bfd_asymbol_flavour (const asymbol *sy)
+.{
+.  if ((sy->flags & BSF_SYNTHETIC) != 0)
+.    return bfd_target_unknown_flavour;
+.  return sy->the_bfd->xvec->flavour;
+.}
+.
 */
 
 /* All known xvecs (even those that don't compile on all systems).