Print this page
10075 make usr/src/tools smatch clean


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 
  25 /*




  26  * This file is a sewer.
  27  */
  28 
  29 #include <limits.h>
  30 #include <stdarg.h>
  31 #include <stdio.h>
  32 #include <assert.h>
  33 #include <strings.h>
  34 #include <setjmp.h>
  35 #include <ctype.h>
  36 #include <uts/common/sys/ctf.h>
  37 
  38 #include "ctftools.h"
  39 #include "memory.h"
  40 #include "list.h"
  41 
  42 #define HASH(NUM)       ((int)(NUM & (BUCKETS - 1)))
  43 #define BUCKETS         128
  44 
  45 #define TYPEPAIRMULT    10000


 612                                             "something else: %s\n",
 613                                             TYPEFILE(h2), TYPENUM(h2),
 614                                             c2 - 1);
 615                                 }
 616                                 free(nm);
 617 
 618                                 h2 = faketypenumber++;
 619                                 ntdp = NULL;
 620                         } else {
 621                                 terminate("Stabs error: Attempting to "
 622                                     "redefine type (%d,%d)\n", TYPEFILE(h2),
 623                                     TYPENUM(h2));
 624                         }
 625                 }
 626 
 627                 if (ntdp == NULL) {  /* if that type isn't defined yet */
 628                         if (*cp != '=') {
 629                                 /* record it as unresolved */
 630                                 parse_debug(3, NULL, "tdefdecl unres type %d",
 631                                     h2);
 632                                 *rtdp = calloc(sizeof (**rtdp), 1);
 633                                 (*rtdp)->t_type = TYPEDEF_UNRES;
 634                                 (*rtdp)->t_id = h2;
 635                                 break;
 636                         } else
 637                                 cp++;
 638 
 639                         /* define a new type */
 640                         cp = tdefdecl(cp, h2, rtdp);
 641                         if ((*rtdp)->t_id && (*rtdp)->t_id != h2) {
 642                                 ntdp = calloc(sizeof (*ntdp), 1);
 643                                 ntdp->t_type = TYPEDEF;
 644                                 ntdp->t_tdesc = *rtdp;
 645                                 *rtdp = ntdp;
 646                         }
 647 
 648                         addhash(*rtdp, h2);
 649 
 650                 } else { /* that type is already defined */
 651                         if (ntdp->t_type != TYPEDEF || ntdp->t_name != NULL) {
 652                                 *rtdp = ntdp;
 653                         } else {
 654                                 parse_debug(3, NULL,
 655                                     "No duplicate typedef anon for ref");
 656                                 *rtdp = ntdp;
 657                         }
 658                 }
 659                 break;
 660         case '*':
 661                 ntdp = NULL;
 662                 cp = tdefdecl(cp + 1, h, &ntdp);




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 
  25 /*
  26  * Copyright (c) 2018, Joyent, Inc.
  27  */
  28 
  29 /*
  30  * This file is a sewer.
  31  */
  32 
  33 #include <limits.h>
  34 #include <stdarg.h>
  35 #include <stdio.h>
  36 #include <assert.h>
  37 #include <strings.h>
  38 #include <setjmp.h>
  39 #include <ctype.h>
  40 #include <uts/common/sys/ctf.h>
  41 
  42 #include "ctftools.h"
  43 #include "memory.h"
  44 #include "list.h"
  45 
  46 #define HASH(NUM)       ((int)(NUM & (BUCKETS - 1)))
  47 #define BUCKETS         128
  48 
  49 #define TYPEPAIRMULT    10000


 616                                             "something else: %s\n",
 617                                             TYPEFILE(h2), TYPENUM(h2),
 618                                             c2 - 1);
 619                                 }
 620                                 free(nm);
 621 
 622                                 h2 = faketypenumber++;
 623                                 ntdp = NULL;
 624                         } else {
 625                                 terminate("Stabs error: Attempting to "
 626                                     "redefine type (%d,%d)\n", TYPEFILE(h2),
 627                                     TYPENUM(h2));
 628                         }
 629                 }
 630 
 631                 if (ntdp == NULL) {  /* if that type isn't defined yet */
 632                         if (*cp != '=') {
 633                                 /* record it as unresolved */
 634                                 parse_debug(3, NULL, "tdefdecl unres type %d",
 635                                     h2);
 636                                 *rtdp = calloc(1, sizeof (**rtdp));
 637                                 (*rtdp)->t_type = TYPEDEF_UNRES;
 638                                 (*rtdp)->t_id = h2;
 639                                 break;
 640                         } else
 641                                 cp++;
 642 
 643                         /* define a new type */
 644                         cp = tdefdecl(cp, h2, rtdp);
 645                         if ((*rtdp)->t_id && (*rtdp)->t_id != h2) {
 646                                 ntdp = calloc(1, sizeof (*ntdp));
 647                                 ntdp->t_type = TYPEDEF;
 648                                 ntdp->t_tdesc = *rtdp;
 649                                 *rtdp = ntdp;
 650                         }
 651 
 652                         addhash(*rtdp, h2);
 653 
 654                 } else { /* that type is already defined */
 655                         if (ntdp->t_type != TYPEDEF || ntdp->t_name != NULL) {
 656                                 *rtdp = ntdp;
 657                         } else {
 658                                 parse_debug(3, NULL,
 659                                     "No duplicate typedef anon for ref");
 660                                 *rtdp = ntdp;
 661                         }
 662                 }
 663                 break;
 664         case '*':
 665                 ntdp = NULL;
 666                 cp = tdefdecl(cp + 1, h, &ntdp);