]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libctf: create: check the right root-visible flag when adding enumerands
authorNick Alcock <nick.alcock@oracle.com>
Thu, 26 Jun 2025 14:47:25 +0000 (15:47 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 1 Jul 2025 14:54:27 +0000 (15:54 +0100)
The root-visible flag we're dealing with here is directly out of the dict,
not a flag passed in to the API, so it does not have the values CTF_ADD_ROOT
or CTF_ADD_NONROOT: instead it's simply zero for non-root-visible, nonzero
otherwise.  Fix the test.

libctf/
* ctf-create.c (ctf_add_enumerator): Fix root-visibility test.

libctf/ctf-create.c

index ca984e81b5119844844216e1a29fb3bfeb60960b..5820830f0868eddad47182271773de4f855a2efa 100644 (file)
@@ -1073,7 +1073,7 @@ ctf_add_enumerator (ctf_dict_t *fp, ctf_id_t enid, const char *name,
   /* Enumeration constant names are only added, and only checked for duplicates,
      if the enum they are part of is a root-visible type.  */
 
-  if (root == CTF_ADD_ROOT && ctf_dynhash_lookup (fp->ctf_names, name))
+  if (root && ctf_dynhash_lookup (fp->ctf_names, name))
     {
       if (fp->ctf_flags & LCTF_STRICT_NO_DUP_ENUMERATORS)
        return (ctf_set_errno (ofp, ECTF_DUPLICATE));