Print this page
12259 CTF shouldn't assume enum size

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdtrace/common/dt_decl.c
          +++ new/usr/src/lib/libdtrace/common/dt_decl.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  25      - * Copyright (c) 2015 Joyent, Inc. All rights reserved.
       25 + * Copyright 2020 Joyent, Inc.
  26   26   */
  27   27  
  28   28  #include <strings.h>
  29   29  #include <stdlib.h>
  30   30  #include <limits.h>
  31   31  #include <alloca.h>
  32   32  #include <assert.h>
  33   33  
  34   34  #include <dt_decl.h>
  35   35  #include <dt_parser.h>
↓ open down ↓ 651 lines elided ↑ open up ↑
 687  687          if (yypcb->pcb_dstack.ds_next != NULL)
 688  688                  flag = CTF_ADD_NONROOT;
 689  689          else
 690  690                  flag = CTF_ADD_ROOT;
 691  691  
 692  692          (void) snprintf(n, sizeof (n), "enum %s", name ? name : "(anon)");
 693  693  
 694  694          if (name != NULL && (type = ctf_lookup_by_name(ctfp, n)) != CTF_ERR) {
 695  695                  if (ctf_enum_iter(ctfp, type, dt_decl_hasmembers, NULL))
 696  696                          xyerror(D_DECL_TYPERED, "type redeclared: %s\n", n);
 697      -        } else if ((type = ctf_add_enum(ctfp, flag, name)) == CTF_ERR) {
      697 +        } else if ((type = ctf_add_enum(ctfp, flag, name, 0)) == CTF_ERR) {
 698  698                  xyerror(D_UNKNOWN, "failed to define %s: %s\n",
 699  699                      n, ctf_errmsg(ctf_errno(ctfp)));
 700  700          }
 701  701  
 702  702          ddp->dd_ctfp = ctfp;
 703  703          ddp->dd_type = type;
 704  704  
 705  705          dt_scope_push(ctfp, type);
 706  706          return (ddp);
 707  707  }
↓ open down ↓ 438 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX