Replace PREPARE_VERSION macro with inline function
authorTobias Klauser <tklauser@distanz.ch>
Fri, 28 Jun 2019 11:46:00 +0000 (08:46 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 28 Jun 2019 11:46:51 +0000 (08:46 -0300)
* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
(prepare_version_base): New helper inline function.
(prepare_version): New macro replacing PREPARE_VERSION.
(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
ChangeLog
sysdeps/unix/sysv/linux/dl-vdso.h

index 2bb4d83..e1d6327 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-06-28  Tobias Klauser  <tklauser@distanz.ch>
+
+       * sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
+       (prepare_version_base): New helper inline function.
+       (prepare_version): New macro replacing PREPARE_VERSION.
+       (PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.
+
 2019-06-28  Florian Weimer  <fweimer@redhat.com>
 
        [BZ #24741]
index 9e61ca7..c418c69 100644 (file)
 #include <dl-hash.h>
 
 /* Create version number record for lookup.  */
-#define PREPARE_VERSION(var, vname, vhash) \
-  struct r_found_version var;                                                \
-  var.name = vname;                                                          \
-  var.hidden = 1;                                                            \
-  var.hash = vhash;                                                          \
-  assert (var.hash == _dl_elf_hash (var.name));                                      \
-  /* We don't have a specific file where the symbol can be found.  */        \
-  var.filename = NULL
+static inline struct r_found_version
+prepare_version_base (const char *name, ElfW(Word) hash)
+{
+  assert (hash == _dl_elf_hash (name));
+  return (struct r_found_version) { name, hash, 1, NULL };
+}
+#define prepare_version(vname) \
+  prepare_version_base (VDSO_NAME_##vname, VDSO_HASH_##vname)
 
 /* Use this for the known version sets defined below, where we
    record their precomputed hash values only once, in this file.  */
 #define PREPARE_VERSION_KNOWN(var, vname) \
-  PREPARE_VERSION (var, VDSO_NAME_##vname, VDSO_HASH_##vname)
+  struct r_found_version var = prepare_version (vname);
 
 #define VDSO_NAME_LINUX_2_6    "LINUX_2.6"
 #define VDSO_HASH_LINUX_2_6    61765110