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>


   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 by Delphix. All rights reserved.
  25  */
  26 
  27 #include <strings.h>
  28 #include <stdlib.h>
  29 #include <limits.h>
  30 #include <alloca.h>
  31 #include <assert.h>
  32 
  33 #include <dt_decl.h>
  34 #include <dt_parser.h>
  35 #include <dt_module.h>
  36 #include <dt_impl.h>
  37 
  38 static dt_decl_t *
  39 dt_decl_check(dt_decl_t *ddp)
  40 {
  41         if (ddp->dd_kind == CTF_K_UNKNOWN)
  42                 return (ddp); /* nothing to check if the type is not yet set */
  43 
  44         if (ddp->dd_name != NULL && strcmp(ddp->dd_name, "char") == 0 &&


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




















 269         if (attr == DT_DA_LONG && (ddp->dd_attr & DT_DA_LONG)) {
 270                 ddp->dd_attr &= ~DT_DA_LONG;
 271                 attr = DT_DA_LONGLONG;
 272         }
 273 
 274         ddp->dd_attr |= attr;
 275         return (dt_decl_check(ddp));
 276 }
 277 
 278 /*
 279  * Examine the list of formal parameters 'flist' and determine if the formal
 280  * name fnp->dn_string is defined in this list (B_TRUE) or not (B_FALSE).
 281  * If 'fnp' is in 'flist', do not search beyond 'fnp' itself in 'flist'.
 282  */
 283 static int
 284 dt_decl_protoform(dt_node_t *fnp, dt_node_t *flist)
 285 {
 286         dt_node_t *dnp;
 287 
 288         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) 2013 by Delphix. All rights reserved.
  25  */
  26 
  27 #include <strings.h>
  28 #include <stdlib.h>
  29 #include <limits.h>
  30 #include <alloca.h>
  31 #include <assert.h>
  32 
  33 #include <dt_decl.h>
  34 #include <dt_parser.h>
  35 #include <dt_module.h>
  36 #include <dt_impl.h>
  37 
  38 static dt_decl_t *
  39 dt_decl_check(dt_decl_t *ddp)
  40 {
  41         if (ddp->dd_kind == CTF_K_UNKNOWN)
  42                 return (ddp); /* nothing to check if the type is not yet set */
  43 
  44         if (ddp->dd_name != NULL && strcmp(ddp->dd_name, "char") == 0 &&


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