Print this page
4210 unsigned unsigned short short is valid in dtrace
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Eric Diven <eric.diven@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Dan McDonald <danmcd@omniti.com>


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   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 /*
  23  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2013 by Delphix. All rights reserved.
  25  * Copyright (c) 2013 Joyent, Inc. All rights reserved.
  26  */
  27 
  28 #include <strings.h>
  29 #include <stdlib.h>
  30 #include <limits.h>
  31 #include <alloca.h>
  32 #include <assert.h>
  33 
  34 #include <dt_decl.h>
  35 #include <dt_parser.h>
  36 #include <dt_module.h>
  37 #include <dt_impl.h>
  38 
  39 static dt_decl_t *
  40 dt_decl_check(dt_decl_t *ddp)
  41 {
  42         if (ddp->dd_kind == CTF_K_UNKNOWN)
  43                 return (ddp); /* nothing to check if the type is not yet set */
  44 


 250         if (ddp->dd_name != NULL || ddp->dd_kind != CTF_K_UNKNOWN)
 251                 xyerror(D_DECL_COMBO, "invalid type combination\n");
 252 
 253         ddp->dd_kind = kind;
 254         ddp->dd_name = name;
 255 
 256         return (dt_decl_check(ddp));
 257 }
 258 
 259 dt_decl_t *
 260 dt_decl_attr(ushort_t attr)
 261 {
 262         dt_decl_t *ddp = yypcb->pcb_dstack.ds_decl;
 263 
 264         if (ddp == NULL) {
 265                 ddp = dt_decl_push(dt_decl_alloc(CTF_K_UNKNOWN, NULL));
 266                 ddp->dd_attr = attr;
 267                 return (ddp);
 268         }
 269 




















 270         if (attr == DT_DA_LONG && (ddp->dd_attr & DT_DA_LONG)) {
 271                 ddp->dd_attr &= ~DT_DA_LONG;
 272                 attr = DT_DA_LONGLONG;
 273         }
 274 
 275         ddp->dd_attr |= attr;
 276         return (dt_decl_check(ddp));
 277 }
 278 
 279 /*
 280  * Examine the list of formal parameters 'flist' and determine if the formal
 281  * name fnp->dn_string is defined in this list (B_TRUE) or not (B_FALSE).
 282  * If 'fnp' is in 'flist', do not search beyond 'fnp' itself in 'flist'.
 283  */
 284 static int
 285 dt_decl_protoform(dt_node_t *fnp, dt_node_t *flist)
 286 {
 287         dt_node_t *dnp;
 288 
 289         for (dnp = flist; dnp != fnp && dnp != NULL; dnp = dnp->dn_list) {




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   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 /*
  23  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  25  * Copyright (c) 2013 Joyent, Inc. All rights reserved.
  26  */
  27 
  28 #include <strings.h>
  29 #include <stdlib.h>
  30 #include <limits.h>
  31 #include <alloca.h>
  32 #include <assert.h>
  33 
  34 #include <dt_decl.h>
  35 #include <dt_parser.h>
  36 #include <dt_module.h>
  37 #include <dt_impl.h>
  38 
  39 static dt_decl_t *
  40 dt_decl_check(dt_decl_t *ddp)
  41 {
  42         if (ddp->dd_kind == CTF_K_UNKNOWN)
  43                 return (ddp); /* nothing to check if the type is not yet set */
  44 


 250         if (ddp->dd_name != NULL || ddp->dd_kind != CTF_K_UNKNOWN)
 251                 xyerror(D_DECL_COMBO, "invalid type combination\n");
 252 
 253         ddp->dd_kind = kind;
 254         ddp->dd_name = name;
 255 
 256         return (dt_decl_check(ddp));
 257 }
 258 
 259 dt_decl_t *
 260 dt_decl_attr(ushort_t attr)
 261 {
 262         dt_decl_t *ddp = yypcb->pcb_dstack.ds_decl;
 263 
 264         if (ddp == NULL) {
 265                 ddp = dt_decl_push(dt_decl_alloc(CTF_K_UNKNOWN, NULL));
 266                 ddp->dd_attr = attr;
 267                 return (ddp);
 268         }
 269 
 270         if ((attr & DT_DA_LONG) && (ddp->dd_attr & DT_DA_LONGLONG)) {
 271                 xyerror(D_DECL_COMBO, "the attribute 'long' may only "
 272                     "be used at most twice in a declaration");
 273         }
 274 
 275         if ((attr & DT_DA_SHORT) && (ddp->dd_attr & DT_DA_SHORT)) {
 276                 xyerror(D_DECL_COMBO, "the attribute 'short' may only be "
 277                     "used at most once in a declaration");
 278         }
 279 
 280         if ((attr & DT_DA_SIGNED) && (ddp->dd_attr & DT_DA_SIGNED)) {
 281                 xyerror(D_DECL_COMBO, "the attribute 'signed' may only be "
 282                     "used at most once in a declaration");
 283         }
 284 
 285         if ((attr & DT_DA_UNSIGNED) && (ddp->dd_attr & DT_DA_UNSIGNED)) {
 286                 xyerror(D_DECL_COMBO, "the attribute 'unsigned' may only be "
 287                     "used at most once in a declaration");
 288         }
 289 
 290         if (attr == DT_DA_LONG && (ddp->dd_attr & DT_DA_LONG)) {
 291                 ddp->dd_attr &= ~DT_DA_LONG;
 292                 attr = DT_DA_LONGLONG;
 293         }
 294 
 295         ddp->dd_attr |= attr;
 296         return (dt_decl_check(ddp));
 297 }
 298 
 299 /*
 300  * Examine the list of formal parameters 'flist' and determine if the formal
 301  * name fnp->dn_string is defined in this list (B_TRUE) or not (B_FALSE).
 302  * If 'fnp' is in 'flist', do not search beyond 'fnp' itself in 'flist'.
 303  */
 304 static int
 305 dt_decl_protoform(dt_node_t *fnp, dt_node_t *flist)
 306 {
 307         dt_node_t *dnp;
 308 
 309         for (dnp = flist; dnp != fnp && dnp != NULL; dnp = dnp->dn_list) {