Merge illumos commit 13455:7205f7794835

1458 D compiler fails to generate error on sizeof() an undefined struct

Reference:
https://www.illumos.org/issues/1458

Tested by:	Fabian Keil
MFC after:	3 weeks
This commit is contained in:
Pedro F. Giffuni 2012-07-14 20:24:00 +00:00
commit b99795d637
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238457
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
BEGIN
{
trace(sizeof (struct suckitlarry));
exit(0);
}

View File

@ -22,7 +22,7 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@ -725,12 +725,19 @@ dt_node_type_name(const dt_node_t *dnp, char *buf, size_t len)
size_t
dt_node_type_size(const dt_node_t *dnp)
{
ctf_id_t base;
if (dnp->dn_kind == DT_NODE_STRING)
return (strlen(dnp->dn_string) + 1);
if (dt_node_is_dynamic(dnp) && dnp->dn_ident != NULL)
return (dt_ident_size(dnp->dn_ident));
base = ctf_type_resolve(dnp->dn_ctfp, dnp->dn_type);
if (ctf_type_kind(dnp->dn_ctfp, base) == CTF_K_FORWARD)
return (0);
return (ctf_type_size(dnp->dn_ctfp, dnp->dn_type));
}