MFH: tracking commit (head@r260486)

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Glen Barber 2014-01-09 17:27:00 +00:00
commit e01ff6218a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/user/gjb/hacking/release-embedded/; revision=260487
644 changed files with 50117 additions and 9149 deletions

View File

@ -4,7 +4,7 @@
The compilation of software known as FreeBSD is distributed under the
following terms:
Copyright (c) 1992-2013 The FreeBSD Project. All rights reserved.
Copyright (c) 1992-2014 The FreeBSD Project. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions

View File

@ -1369,15 +1369,6 @@ kernel-tools: .MAKE
mkdir -p ${MAKEOBJDIRPREFIX}/usr
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
-p ${MAKEOBJDIRPREFIX}/usr >/dev/null
.for _tool in \
sys/dev/aic7xxx/aicasm
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_tool} && \
${MAKE} DIRPRFX=${_tool}/ obj && \
${MAKE} DIRPRFX=${_tool}/ depend && \
${MAKE} DIRPRFX=${_tool}/ all && \
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
.endfor
#
# cross-tools: Build cross-building tools

View File

@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd November 1, 2013
.Dd January 3, 2014
.Dt SH 1
.Os
.Sh NAME
@ -235,10 +235,16 @@ or
.Dq Li ||
operator; or if the command is a pipeline preceded by the
.Ic !\&
operator.
keyword.
If a shell function is executed and its exit status is explicitly
tested, all commands of the function are considered to be tested as
well.
.Pp
It is recommended to check for failures explicitly
instead of relying on
.Fl e
because it tends to behave in unexpected ways,
particularly in larger scripts.
.It Fl f Li noglob
Disable pathname expansion.
.It Fl h Li trackall

View File

@ -14,11 +14,12 @@
.\"
.\" Copyright 2012, Richard Lowe.
.\" Copyright (c) 2012, Marcelo Araujo <araujo@FreeBSD.org>.
.\" Copyright (c) 2012 by Delphix. All rights reserved.
.\" All Rights Reserved.
.\"
.\" $FreeBSD$
.\"
.Dd May 10, 2012
.Dd December 31, 2013
.Dt ZDB 8
.Os
.Sh NAME
@ -29,27 +30,35 @@
.Op Fl CumdibcsDvhLXFPA
.Op Fl e Op Fl p Ar path...
.Op Fl t Ar txg
.Op Fl U Ar cache
.Op Fl M Ar inflight I/Os
.Ar poolname
.Op Ar object ...
.Nm
.Op Fl divPA
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar dataset
.Op Ar object ...
.Nm
.Fl m Op Fl LXFPA
.Op Fl t Ar txg
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar poolname
.Nm
.Fl R Op Fl A
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar poolname
.Ar poolname
.Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags
.Nm
.Fl S
.Op Fl AP
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
.Ar poolname
.Ar poolname
.Nm
.Fl l
@ -205,6 +214,11 @@ flag specifies the path under which devices are to be searched.
.It Fl F
Attempt to make an unreadable pool readable by trying progressively older
transactions.
.It Fl M Ar inflight I/Os
Limit the number of outstanding checksum I/Os to the specified value.
The default value is 200. This option affects the performance of the
.Fl c
option.
.It Fl P
Print numbers in an unscaled form more amenable to parsing, eg. 1000000 rather
than 1M.
@ -218,9 +232,7 @@ options for a means to see the available uberblocks and their associated
transaction numbers.
.It Fl U Ar cachefile
Use a cache file other than
.Pa /etc/zfs/zpool.cache .
This option is only valid with
.Fl C
.Pa /boot/zfs/zpool.cache .
.It Fl v
Enable verbosity.
Specify multiple times for increased verbosity.

View File

@ -89,6 +89,7 @@ extern void dump_intent_log(zilog_t *);
uint64_t *zopt_object = NULL;
int zopt_objects = 0;
libzfs_handle_t *g_zfs;
uint64_t max_inflight = 200;
/*
* These libumem hooks provide a reasonable set of defaults for the allocator's
@ -110,16 +111,17 @@ static void
usage(void)
{
(void) fprintf(stderr,
"Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]]"
"poolname [object...]\n"
" %s [-divPA] [-e -p path...] dataset [object...]\n"
" %s -m [-LXFPA] [-t txg] [-e [-p path...]]"
"poolname [vdev [metaslab...]]\n"
" %s -R [-A] [-e [-p path...]] poolname "
"vdev:offset:size[:flags]\n"
" %s -S [-PA] [-e [-p path...]] poolname\n"
" %s -l [-uA] device\n"
" %s -C [-A] [-U config]\n\n",
"Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]] "
"[-U config] [-M inflight I/Os] poolname [object...]\n"
" %s [-divPA] [-e -p path...] [-U config] dataset "
"[object...]\n"
" %s -m [-LXFPA] [-t txg] [-e [-p path...]] [-U config] "
"poolname [vdev [metaslab...]]\n"
" %s -R [-A] [-e [-p path...]] poolname "
"vdev:offset:size[:flags]\n"
" %s -S [-PA] [-e [-p path...]] [-U config] poolname\n"
" %s -l [-uA] device\n"
" %s -C [-A] [-U config]\n\n",
cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname);
(void) fprintf(stderr, " Dataset name must include at least one "
@ -164,6 +166,8 @@ usage(void)
(void) fprintf(stderr, " -P print numbers in parseable form\n");
(void) fprintf(stderr, " -t <txg> -- highest txg to use when "
"searching for uberblocks\n");
(void) fprintf(stderr, " -M <number of inflight I/Os> -- "
"specify the maximum number of checksumming I/Os [default is 200]");
(void) fprintf(stderr, "Specify an option more than once (e.g. -bb) "
"to make only that option verbose\n");
(void) fprintf(stderr, "Default is to dump everything non-verbosely\n");
@ -760,7 +764,7 @@ dump_dde(const ddt_t *ddt, const ddt_entry_t *dde, uint64_t index)
if (ddp->ddp_phys_birth == 0)
continue;
ddt_bp_create(ddt->ddt_checksum, ddk, ddp, &blk);
sprintf_blkptr(blkbuf, &blk);
snprintf_blkptr(blkbuf, sizeof (blkbuf), &blk);
(void) printf("index %llx refcnt %llu %s %s\n",
(u_longlong_t)index, (u_longlong_t)ddp->ddp_refcnt,
types[p], blkbuf);
@ -1020,31 +1024,39 @@ blkid2offset(const dnode_phys_t *dnp, const blkptr_t *bp, const zbookmark_t *zb)
}
static void
sprintf_blkptr_compact(char *blkbuf, const blkptr_t *bp)
snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp)
{
const dva_t *dva = bp->blk_dva;
int ndvas = dump_opt['d'] > 5 ? BP_GET_NDVAS(bp) : 1;
if (dump_opt['b'] >= 6) {
sprintf_blkptr(blkbuf, bp);
snprintf_blkptr(blkbuf, buflen, bp);
return;
}
blkbuf[0] = '\0';
for (int i = 0; i < ndvas; i++)
(void) sprintf(blkbuf + strlen(blkbuf), "%llu:%llx:%llx ",
(void) snprintf(blkbuf + strlen(blkbuf),
buflen - strlen(blkbuf), "%llu:%llx:%llx ",
(u_longlong_t)DVA_GET_VDEV(&dva[i]),
(u_longlong_t)DVA_GET_OFFSET(&dva[i]),
(u_longlong_t)DVA_GET_ASIZE(&dva[i]));
(void) sprintf(blkbuf + strlen(blkbuf),
"%llxL/%llxP F=%llu B=%llu/%llu",
(u_longlong_t)BP_GET_LSIZE(bp),
(u_longlong_t)BP_GET_PSIZE(bp),
(u_longlong_t)bp->blk_fill,
(u_longlong_t)bp->blk_birth,
(u_longlong_t)BP_PHYSICAL_BIRTH(bp));
if (BP_IS_HOLE(bp)) {
(void) snprintf(blkbuf + strlen(blkbuf),
buflen - strlen(blkbuf), "B=%llu",
(u_longlong_t)bp->blk_birth);
} else {
(void) snprintf(blkbuf + strlen(blkbuf),
buflen - strlen(blkbuf),
"%llxL/%llxP F=%llu B=%llu/%llu",
(u_longlong_t)BP_GET_LSIZE(bp),
(u_longlong_t)BP_GET_PSIZE(bp),
(u_longlong_t)bp->blk_fill,
(u_longlong_t)bp->blk_birth,
(u_longlong_t)BP_PHYSICAL_BIRTH(bp));
}
}
static void
@ -1069,7 +1081,7 @@ print_indirect(blkptr_t *bp, const zbookmark_t *zb,
}
}
sprintf_blkptr_compact(blkbuf, bp);
snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp);
(void) printf("%s\n", blkbuf);
}
@ -1084,7 +1096,7 @@ visit_indirect(spa_t *spa, const dnode_phys_t *dnp,
print_indirect(bp, zb, dnp);
if (BP_GET_LEVEL(bp) > 0) {
if (BP_GET_LEVEL(bp) > 0 && !BP_IS_HOLE(bp)) {
uint32_t flags = ARC_WAIT;
int i;
blkptr_t *cbp;
@ -1209,7 +1221,7 @@ dump_dsl_dataset(objset_t *os, uint64_t object, void *data, size_t size)
zdb_nicenum(ds->ds_compressed_bytes, compressed);
zdb_nicenum(ds->ds_uncompressed_bytes, uncompressed);
zdb_nicenum(ds->ds_unique_bytes, unique);
sprintf_blkptr(blkbuf, &ds->ds_bp);
snprintf_blkptr(blkbuf, sizeof (blkbuf), &ds->ds_bp);
(void) printf("\t\tdir_obj = %llu\n",
(u_longlong_t)ds->ds_dir_obj);
@ -1254,7 +1266,7 @@ dump_bptree_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
char blkbuf[BP_SPRINTF_LEN];
if (bp->blk_birth != 0) {
sprintf_blkptr(blkbuf, bp);
snprintf_blkptr(blkbuf, sizeof (blkbuf), bp);
(void) printf("\t%s\n", blkbuf);
}
return (0);
@ -1292,7 +1304,7 @@ dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
char blkbuf[BP_SPRINTF_LEN];
ASSERT(bp->blk_birth != 0);
sprintf_blkptr_compact(blkbuf, bp);
snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp);
(void) printf("\t%s\n", blkbuf);
return (0);
}
@ -1791,8 +1803,9 @@ dump_dir(objset_t *os)
zdb_nicenum(refdbytes, numbuf);
if (verbosity >= 4) {
(void) sprintf(blkbuf, ", rootbp ");
(void) sprintf_blkptr(blkbuf + strlen(blkbuf), os->os_rootbp);
(void) snprintf(blkbuf, sizeof (blkbuf), ", rootbp ");
(void) snprintf_blkptr(blkbuf + strlen(blkbuf),
sizeof (blkbuf) - strlen(blkbuf), os->os_rootbp);
} else {
blkbuf[0] = '\0';
}
@ -1822,7 +1835,7 @@ dump_dir(objset_t *os)
if (verbosity < 2)
return;
if (os->os_rootbp->blk_birth == 0)
if (BP_IS_HOLE(os->os_rootbp))
return;
dump_object(os, 0, verbosity, &print_header);
@ -1863,7 +1876,7 @@ dump_uberblock(uberblock_t *ub, const char *header, const char *footer)
(u_longlong_t)ub->ub_timestamp, asctime(localtime(&timestamp)));
if (dump_opt['u'] >= 3) {
char blkbuf[BP_SPRINTF_LEN];
sprintf_blkptr(blkbuf, &ub->ub_rootbp);
snprintf_blkptr(blkbuf, sizeof (blkbuf), &ub->ub_rootbp);
(void) printf("\trootbp = %s\n", blkbuf);
}
(void) printf(footer ? footer : "");
@ -2154,16 +2167,68 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp,
bp, NULL, NULL, ZIO_FLAG_CANFAIL)), ==, 0);
}
/* ARGSUSED */
static void
zdb_blkptr_done(zio_t *zio)
{
spa_t *spa = zio->io_spa;
blkptr_t *bp = zio->io_bp;
int ioerr = zio->io_error;
zdb_cb_t *zcb = zio->io_private;
zbookmark_t *zb = &zio->io_bookmark;
zio_data_buf_free(zio->io_data, zio->io_size);
mutex_enter(&spa->spa_scrub_lock);
spa->spa_scrub_inflight--;
cv_broadcast(&spa->spa_scrub_io_cv);
if (ioerr && !(zio->io_flags & ZIO_FLAG_SPECULATIVE)) {
char blkbuf[BP_SPRINTF_LEN];
zcb->zcb_haderrors = 1;
zcb->zcb_errors[ioerr]++;
if (dump_opt['b'] >= 2)
snprintf_blkptr(blkbuf, sizeof (blkbuf), bp);
else
blkbuf[0] = '\0';
(void) printf("zdb_blkptr_cb: "
"Got error %d reading "
"<%llu, %llu, %lld, %llx> %s -- skipping\n",
ioerr,
(u_longlong_t)zb->zb_objset,
(u_longlong_t)zb->zb_object,
(u_longlong_t)zb->zb_level,
(u_longlong_t)zb->zb_blkid,
blkbuf);
}
mutex_exit(&spa->spa_scrub_lock);
}
/* ARGSUSED */
static int
zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg)
{
zdb_cb_t *zcb = arg;
char blkbuf[BP_SPRINTF_LEN];
dmu_object_type_t type;
boolean_t is_metadata;
if (bp == NULL)
if (dump_opt['b'] >= 5 && bp->blk_birth > 0) {
char blkbuf[BP_SPRINTF_LEN];
snprintf_blkptr(blkbuf, sizeof (blkbuf), bp);
(void) printf("objset %llu object %llu "
"level %lld offset 0x%llx %s\n",
(u_longlong_t)zb->zb_objset,
(u_longlong_t)zb->zb_object,
(longlong_t)zb->zb_level,
(u_longlong_t)blkid2offset(dnp, bp, zb),
blkbuf);
}
if (BP_IS_HOLE(bp))
return (0);
type = BP_GET_TYPE(bp);
@ -2174,53 +2239,26 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
is_metadata = (BP_GET_LEVEL(bp) != 0 || DMU_OT_IS_METADATA(type));
if (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata)) {
int ioerr;
size_t size = BP_GET_PSIZE(bp);
void *data = malloc(size);
void *data = zio_data_buf_alloc(size);
int flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCRUB | ZIO_FLAG_RAW;
/* If it's an intent log block, failure is expected. */
if (zb->zb_level == ZB_ZIL_LEVEL)
flags |= ZIO_FLAG_SPECULATIVE;
ioerr = zio_wait(zio_read(NULL, spa, bp, data, size,
NULL, NULL, ZIO_PRIORITY_ASYNC_READ, flags, zb));
mutex_enter(&spa->spa_scrub_lock);
while (spa->spa_scrub_inflight > max_inflight)
cv_wait(&spa->spa_scrub_io_cv, &spa->spa_scrub_lock);
spa->spa_scrub_inflight++;
mutex_exit(&spa->spa_scrub_lock);
free(data);
if (ioerr && !(flags & ZIO_FLAG_SPECULATIVE)) {
zcb->zcb_haderrors = 1;
zcb->zcb_errors[ioerr]++;
if (dump_opt['b'] >= 2)
sprintf_blkptr(blkbuf, bp);
else
blkbuf[0] = '\0';
(void) printf("zdb_blkptr_cb: "
"Got error %d reading "
"<%llu, %llu, %lld, %llx> %s -- skipping\n",
ioerr,
(u_longlong_t)zb->zb_objset,
(u_longlong_t)zb->zb_object,
(u_longlong_t)zb->zb_level,
(u_longlong_t)zb->zb_blkid,
blkbuf);
}
zio_nowait(zio_read(NULL, spa, bp, data, size,
zdb_blkptr_done, zcb, ZIO_PRIORITY_ASYNC_READ, flags, zb));
}
zcb->zcb_readfails = 0;
if (dump_opt['b'] >= 5) {
sprintf_blkptr(blkbuf, bp);
(void) printf("objset %llu object %llu "
"level %lld offset 0x%llx %s\n",
(u_longlong_t)zb->zb_objset,
(u_longlong_t)zb->zb_object,
(longlong_t)zb->zb_level,
(u_longlong_t)blkid2offset(dnp, bp, zb),
blkbuf);
}
if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) &&
gethrtime() > zcb->zcb_lastprint + NANOSEC) {
uint64_t now = gethrtime();
@ -2377,7 +2415,7 @@ count_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
if (dump_opt['b'] >= 5) {
char blkbuf[BP_SPRINTF_LEN];
sprintf_blkptr(blkbuf, bp);
snprintf_blkptr(blkbuf, sizeof (blkbuf), bp);
(void) printf("[%s] %s\n",
"deferred free", blkbuf);
}
@ -2433,6 +2471,18 @@ dump_block_stats(spa_t *spa)
zcb.zcb_start = zcb.zcb_lastprint = gethrtime();
zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb);
/*
* If we've traversed the data blocks then we need to wait for those
* I/Os to complete. We leverage "The Godfather" zio to wait on
* all async I/Os to complete.
*/
if (dump_opt['c']) {
(void) zio_wait(spa->spa_async_zio_root);
spa->spa_async_zio_root = zio_root(spa, NULL, NULL,
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE |
ZIO_FLAG_GODFATHER);
}
if (zcb.zcb_haderrors) {
(void) printf("\nError counts:\n\n");
(void) printf("\t%5s %s\n", "errno", "count");
@ -2599,7 +2649,7 @@ zdb_ddt_add_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
avl_index_t where;
zdb_ddt_entry_t *zdde, zdde_search;
if (bp == NULL)
if (BP_IS_HOLE(bp))
return (0);
if (dump_opt['S'] > 1 && zb->zb_level == ZB_ROOT_LEVEL) {
@ -2766,7 +2816,7 @@ zdb_print_blkptr(blkptr_t *bp, int flags)
if (flags & ZDB_FLAG_BSWAP)
byteswap_uint64_array((void *)bp, sizeof (blkptr_t));
sprintf_blkptr(blkbuf, bp);
snprintf_blkptr(blkbuf, sizeof (blkbuf), bp);
(void) printf("%s\n", blkbuf);
}
@ -3202,7 +3252,7 @@ main(int argc, char **argv)
dprintf_setup(&argc, argv);
while ((c = getopt(argc, argv, "bcdhilmsuCDRSAFLXevp:t:U:P")) != -1) {
while ((c = getopt(argc, argv, "bcdhilmM:suCDRSAFLXevp:t:U:P")) != -1) {
switch (c) {
case 'b':
case 'c':
@ -3231,6 +3281,15 @@ main(int argc, char **argv)
case 'v':
verbose++;
break;
case 'M':
max_inflight = strtoull(optarg, NULL, 0);
if (max_inflight == 0) {
(void) fprintf(stderr, "maximum number "
"of inflight I/Os must be greater "
"than 0\n");
usage();
}
break;
case 'p':
if (searchdirs == NULL) {
searchdirs = umem_alloc(sizeof (char *),

View File

@ -23,6 +23,10 @@
* Use is subject to license terms.
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
/*
* Print intent log header and statistics.
*/
@ -47,7 +51,7 @@ print_log_bp(const blkptr_t *bp, const char *prefix)
{
char blkbuf[BP_SPRINTF_LEN];
sprintf_blkptr(blkbuf, bp);
snprintf_blkptr(blkbuf, sizeof (blkbuf), bp);
(void) printf("%s%s\n", prefix, blkbuf);
}
@ -132,6 +136,7 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr)
if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) {
(void) printf("%shas blkptr, %s\n", prefix,
!BP_IS_HOLE(bp) &&
bp->blk_birth >= spa_first_txg(zilog->zl_spa) ?
"will claim" : "won't claim");
print_log_bp(bp, prefix);
@ -139,8 +144,6 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, lr_write_t *lr)
if (BP_IS_HOLE(bp)) {
(void) printf("\t\t\tLSIZE 0x%llx\n",
(u_longlong_t)BP_GET_LSIZE(bp));
}
if (bp->blk_birth == 0) {
bzero(buf, sizeof (buf));
(void) printf("%s<hole>\n", prefix);
return;
@ -313,7 +316,8 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg)
if (verbose >= 5) {
(void) strcpy(blkbuf, ", ");
sprintf_blkptr(blkbuf + strlen(blkbuf), bp);
snprintf_blkptr(blkbuf + strlen(blkbuf),
sizeof (blkbuf) - strlen(blkbuf), bp);
} else {
blkbuf[0] = '\0';
}
@ -361,7 +365,7 @@ dump_intent_log(zilog_t *zilog)
int verbose = MAX(dump_opt['d'], dump_opt['i']);
int i;
if (zh->zh_log.blk_birth == 0 || verbose < 1)
if (BP_IS_HOLE(&zh->zh_log) || verbose < 1)
return;
(void) printf("\n ZIL header: claim_txg %llu, "

View File

@ -18,7 +18,7 @@
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2012 by Delphix. All rights reserved.
.\" Copyright (c) 2013 by Delphix. All rights reserved.
.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
.\" Copyright (c) 2012, Bryan Drewery <bdrewery@FreeBSD.org>
@ -26,10 +26,11 @@
.\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
.\" Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org>
.\" Copyright (c) 2014, Xin LI <delphij@FreeBSD.org>
.\"
.\" $FreeBSD$
.\"
.Dd December 24, 2013
.Dd January 2, 2014
.Dt ZFS 8
.Os
.Sh NAME
@ -57,11 +58,16 @@
.Cm destroy
.Op Fl dnpRrv
.Sm off
.Ar snapshot
.Op % Ns Ar snapname
.Ar filesystem Ns | Ns volume
.Ns @snap
.Op % Ns Ar snap
.Op , Ns Ar snap Op % Ns Ar snap
.Op , Ns ...
.Sm on
.Nm
.Cm destroy
.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
.Nm
.Cm snapshot Ns | Ns Cm snap
.Op Fl r
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
@ -168,11 +174,19 @@
.Cm unshare
.Fl a | Ar filesystem Ns | Ns Ar mountpoint
.Nm
.Cm bookmark
.Ar snapshot
.Ar bookmark
.Nm
.Cm send
.Op Fl DnPpRv
.Op Fl i Ar snapshot | Fl I Ar snapshot
.Ar snapshot
.Nm
.Cm send
.Op Fl i Ar snapshot Ns | Ns bookmark
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Nm
.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
@ -1654,6 +1668,13 @@ options, as they can destroy large portions of a pool and cause unexpected
behavior for mounted file systems in use.
.It Xo
.Nm
.Cm destroy
.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
.Xc
.Pp
The given bookmark is destroyed.
.It Xo
.Nm
.Cm snapshot Ns | Ns Cm snap
.Op Fl r
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
@ -1686,14 +1707,24 @@ Roll back the given dataset to a previous snapshot. When a dataset is rolled
back, all data that has changed since the snapshot is discarded, and the
dataset reverts to the state at the time of the snapshot. By default, the
command refuses to roll back to a snapshot other than the most recent one. In
order to do so, all intermediate snapshots must be destroyed by specifying the
order to do so, all intermediate snapshots and bookmarks must be destroyed
by specifying the
.Fl r
option.
.Pp
The
.Fl rR
options do not recursively destroy the child snapshots of a
recursive snapshot.
Only direct snapshots of the specified filesystem
are destroyed by either of these options.
To completely roll back a
recursive snapshot, you must rollback the individual child snapshots.
.Bl -tag -width indent
.It Fl r
Recursively destroy any snapshots more recent than the one specified.
Destroy any snapshots and bookmarks more recent than the one specified.
.It Fl R
Recursively destroy any more recent snapshots, as well as any clones of those
Destroy any more recent snapshots and bookmarks, as well as any clones of those
snapshots.
.It Fl f
Used with the
@ -1868,7 +1899,7 @@ syntax.
A comma-separated list of types to display, where
.Ar type
is one of
.Sy filesystem , snapshot , snap, volume , No or Sy all .
.Sy filesystem , snapshot , snap , volume , bookmark , No or Sy all .
For example, specifying
.Fl t Cm snapshot
displays only snapshots.
@ -1965,7 +1996,7 @@ sections.
The special value
.Cm all
can be used to display all properties that apply to the given dataset's type
(filesystem, volume, or snapshot).
(filesystem, volume, snapshot, or bookmark).
.Bl -tag -width indent
.It Fl r
Recursively display properties for any children.
@ -2283,6 +2314,26 @@ file system shared on the system.
.El
.It Xo
.Nm
.Cm bookmark
.Ar snapshot
.Ar bookmark
.Xc
.Pp
Creates a bookmark of the given snapshot.
Bookmarks mark the point in time
when the snapshot was created, and can be used as the incremental source for
a
.Qq Nm Cm send
command.
.Pp
This feature must be enabled to be used.
See
.Xr zpool-features 7
for details on ZFS feature flags and the
.Sy bookmark
feature.
.It Xo
.Nm
.Cm send
.Op Fl DnPpRv
.Op Fl i Ar snapshot | Fl I Ar snapshot
@ -2301,17 +2352,15 @@ a file or to a different system (for example, using
By default, a full stream is generated.
.Bl -tag -width indent
.It Fl i Ar snapshot
Generate an incremental stream from the
.Fl i Ar snapshot
to the last
.Ar snapshot .
The incremental source (the
.Fl i Ar snapshot )
can be specified as the last component of the snapshot name (for example, the
part after the
.Sy @ ) ,
and it is assumed to be from the same file system as the last
.Ar snapshot .
Generate an incremental stream from the first
.Ar snapshot Pq the incremental source
to the second
.Ar snapshot Pq the incremental target .
The incremental source can be specified as the last component of the
snapshot name
.Pq the Em @ No character and following
and
it is assumed to be from the same file system as the incremental target.
.Pp
If the destination is a clone, the source may be the origin snapshot, which
must be fully specified (for example,
@ -2319,15 +2368,16 @@ must be fully specified (for example,
not just
.Cm @origin ) .
.It Fl I Ar snapshot
Generate a stream package that sends all intermediary snapshots from the
.Fl I Ar snapshot
to the last
Generate a stream package that sends all intermediary snapshots from the first
.Ar snapshot
to the second
.Ar snapshot .
For example,
.Ic -I @a fs@d
is similar to
.Ic -i @a fs@b; -i @b fs@c; -i @c fs@d .
The incremental source snapshot may be specified as with the
The incremental
source may be specified as with the
.Fl i
option.
.It Fl R
@ -2380,6 +2430,35 @@ on future versions of
.Tn ZFS .
.It Xo
.Nm
.Cm send
.Op Fl i Ar snapshot Ns | Ns Ar bookmark
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Xc
.Pp
Generate a send stream, which may be of a filesystem, and may be
incremental from a bookmark.
If the destination is a filesystem or volume,
the pool must be read-only, or the filesystem must not be mounted.
When the
stream generated from a filesystem or volume is received, the default snapshot
name will be
.Pq --head-- .
.Bl -tag -width indent
.It Fl i Ar snapshot Ns | Ns bookmark
Generate an incremental send stream.
The incremental source must be an earlier
snapshot in the destination's history.
It will commonly be an earlier
snapshot in the destination's filesystem, in which case it can be
specified as the last component of the name
.Pq the Em # No or Em @ No character and following .
.Pp
If the incremental target is a clone, the incremental source can
be the origin snapshot, or an earlier snapshot in the origin's filesystem,
or the origin's origin, etc.
.El
.It Xo
.Nm
.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot

View File

@ -24,6 +24,7 @@
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <libintl.h>
@ -72,7 +73,7 @@ uu_avl_pool_t *avl_pool;
* Include snaps if they were requested or if this a zfs list where types
* were not specified and the "listsnapshots" property is set on this pool.
*/
static int
static boolean_t
zfs_include_snapshots(zfs_handle_t *zhp, callback_data_t *cb)
{
zpool_handle_t *zph;
@ -92,8 +93,9 @@ static int
zfs_callback(zfs_handle_t *zhp, void *data)
{
callback_data_t *cb = data;
int dontclose = 0;
int include_snaps = zfs_include_snapshots(zhp, cb);
boolean_t dontclose = B_FALSE;
boolean_t include_snaps = zfs_include_snapshots(zhp, cb);
boolean_t include_bmarks = (cb->cb_types & ZFS_TYPE_BOOKMARK);
if ((zfs_get_type(zhp) & cb->cb_types) ||
((zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT) && include_snaps)) {
@ -119,7 +121,7 @@ zfs_callback(zfs_handle_t *zhp, void *data)
}
}
uu_avl_insert(cb->cb_avl, node, idx);
dontclose = 1;
dontclose = B_TRUE;
} else {
free(node);
}
@ -134,11 +136,14 @@ zfs_callback(zfs_handle_t *zhp, void *data)
cb->cb_depth++;
if (zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM)
(void) zfs_iter_filesystems(zhp, zfs_callback, data);
if ((zfs_get_type(zhp) != ZFS_TYPE_SNAPSHOT) && include_snaps) {
if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT |
ZFS_TYPE_BOOKMARK)) == 0) && include_snaps)
(void) zfs_iter_snapshots(zhp,
(cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback,
data);
}
if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT |
ZFS_TYPE_BOOKMARK)) == 0) && include_bmarks)
(void) zfs_iter_bookmarks(zhp, zfs_callback, data);
cb->cb_depth--;
}

View File

@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
@ -107,6 +107,7 @@ static int zfs_do_release(int argc, char **argv);
static int zfs_do_diff(int argc, char **argv);
static int zfs_do_jail(int argc, char **argv);
static int zfs_do_unjail(int argc, char **argv);
static int zfs_do_bookmark(int argc, char **argv);
/*
* Enable a reasonable set of defaults for libumem debugging on DEBUG builds.
@ -155,6 +156,7 @@ typedef enum {
HELP_HOLDS,
HELP_RELEASE,
HELP_DIFF,
HELP_BOOKMARK,
} zfs_help_t;
typedef struct zfs_command {
@ -181,6 +183,7 @@ static zfs_command_t command_table[] = {
{ "clone", zfs_do_clone, HELP_CLONE },
{ "promote", zfs_do_promote, HELP_PROMOTE },
{ "rename", zfs_do_rename, HELP_RENAME },
{ "bookmark", zfs_do_bookmark, HELP_BOOKMARK },
{ NULL },
{ "list", zfs_do_list, HELP_LIST },
{ NULL },
@ -231,11 +234,12 @@ get_usage(zfs_help_t idx)
case HELP_DESTROY:
return (gettext("\tdestroy [-fnpRrv] <filesystem|volume>\n"
"\tdestroy [-dnpRrv] "
"<snapshot>[%<snapname>][,...]\n"));
"<filesystem|volume>@<snap>[%<snap>][,...]\n"
"\tdestroy <filesystem|volume>#<bookmark>\n"));
case HELP_GET:
return (gettext("\tget [-rHp] [-d max] "
"[-o \"all\" | field[,...]] [-t type[,...]] "
"[-s source[,...]]\n"
"[-o \"all\" | field[,...]]\n"
"\t [-t type[,...]] [-s source[,...]]\n"
"\t <\"all\" | property[,...]> "
"[filesystem|volume|snapshot] ...\n"));
case HELP_INHERIT:
@ -264,15 +268,16 @@ get_usage(zfs_help_t idx)
case HELP_RENAME:
return (gettext("\trename [-f] <filesystem|volume|snapshot> "
"<filesystem|volume|snapshot>\n"
"\trename [-f] -p <filesystem|volume> "
"<filesystem|volume>\n"
"\trename [-f] -p <filesystem|volume> <filesystem|volume>\n"
"\trename -r <snapshot> <snapshot>\n"
"\trename -u [-p] <filesystem> <filesystem>"));
case HELP_ROLLBACK:
return (gettext("\trollback [-rRf] <snapshot>\n"));
case HELP_SEND:
return (gettext("\tsend [-DnPpRv] "
"[-i snapshot | -I snapshot] <snapshot>\n"));
return (gettext("\tsend [-DnPpRv] [-[iI] snapshot] "
"<snapshot>\n"
"\tsend [-i snapshot|bookmark] "
"<filesystem|volume|snapshot>\n"));
case HELP_SET:
return (gettext("\tset <property=value> "
"<filesystem|volume|snapshot> ...\n"));
@ -280,7 +285,7 @@ get_usage(zfs_help_t idx)
return (gettext("\tshare <-a | filesystem>\n"));
case HELP_SNAPSHOT:
return (gettext("\tsnapshot|snap [-r] [-o property=value] ... "
"<filesystem@snapname|volume@snapname> ...\n"));
"<filesystem|volume>@<snap> ...\n"));
case HELP_UNMOUNT:
return (gettext("\tunmount|umount [-f] "
"<-a | filesystem|mountpoint>\n"));
@ -309,11 +314,13 @@ get_usage(zfs_help_t idx)
"<filesystem|volume>\n"));
case HELP_USERSPACE:
return (gettext("\tuserspace [-Hinp] [-o field[,...]] "
"[-s field]...\n\t [-S field]... [-t type[,...]] "
"[-s field] ...\n"
"\t [-S field] ... [-t type[,...]] "
"<filesystem|snapshot>\n"));
case HELP_GROUPSPACE:
return (gettext("\tgroupspace [-Hinp] [-o field[,...]] "
"[-s field]...\n\t [-S field]... [-t type[,...]] "
"[-s field] ...\n"
"\t [-S field] ... [-t type[,...]] "
"<filesystem|snapshot>\n"));
case HELP_HOLD:
return (gettext("\thold [-r] <tag> <snapshot> ...\n"));
@ -324,6 +331,8 @@ get_usage(zfs_help_t idx)
case HELP_DIFF:
return (gettext("\tdiff [-FHt] <snapshot> "
"[snapshot|filesystem]\n"));
case HELP_BOOKMARK:
return (gettext("\tbookmark <snapshot> <bookmark>\n"));
}
abort();
@ -926,6 +935,7 @@ typedef struct destroy_cbdata {
char *cb_prevsnap;
int64_t cb_snapused;
char *cb_snapspec;
char *cb_bookmark;
} destroy_cbdata_t;
/*
@ -1195,7 +1205,7 @@ zfs_do_destroy(int argc, char **argv)
int err = 0;
int c;
zfs_handle_t *zhp = NULL;
char *at;
char *at, *pound;
zfs_type_t type = ZFS_TYPE_DATASET;
/* check options */
@ -1247,6 +1257,7 @@ zfs_do_destroy(int argc, char **argv)
}
at = strchr(argv[0], '@');
pound = strchr(argv[0], '#');
if (at != NULL) {
/* Build the list of snaps to destroy in cb_nvl. */
@ -1308,6 +1319,46 @@ zfs_do_destroy(int argc, char **argv)
if (err != 0)
rv = 1;
} else if (pound != NULL) {
int err;
nvlist_t *nvl;
if (cb.cb_dryrun) {
(void) fprintf(stderr,
"dryrun is not supported with bookmark\n");
return (-1);
}
if (cb.cb_defer_destroy) {
(void) fprintf(stderr,
"defer destroy is not supported with bookmark\n");
return (-1);
}
if (cb.cb_recurse) {
(void) fprintf(stderr,
"recursive is not supported with bookmark\n");
return (-1);
}
if (!zfs_bookmark_exists(argv[0])) {
(void) fprintf(stderr, gettext("bookmark '%s' "
"does not exist.\n"), argv[0]);
return (1);
}
nvl = fnvlist_alloc();
fnvlist_add_boolean(nvl, argv[0]);
err = lzc_destroy_bookmarks(nvl, NULL);
if (err != 0) {
(void) zfs_standard_error(g_zfs, err,
"cannot destroy bookmark");
}
nvlist_free(cb.cb_nvl);
return (err);
} else {
/* Open the given dataset */
if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL)
@ -1670,7 +1721,8 @@ zfs_do_get(int argc, char **argv)
flags &= ~ZFS_ITER_PROP_LISTSNAPS;
while (*optarg != '\0') {
static char *type_subopts[] = { "filesystem",
"volume", "snapshot", "all", NULL };
"volume", "snapshot", "bookmark",
"all", NULL };
switch (getsubopt(&optarg, type_subopts,
&value)) {
@ -1684,7 +1736,11 @@ zfs_do_get(int argc, char **argv)
types |= ZFS_TYPE_SNAPSHOT;
break;
case 3:
types = ZFS_TYPE_DATASET;
types |= ZFS_TYPE_BOOKMARK;
break;
case 4:
types = ZFS_TYPE_DATASET |
ZFS_TYPE_BOOKMARK;
break;
default:
@ -2157,7 +2213,7 @@ static int us_type_bits[] = {
USTYPE_SMB_USR,
USTYPE_ALL
};
static char *us_type_names[] = { "posixgroup", "posxiuser", "smbgroup",
static char *us_type_names[] = { "posixgroup", "posixuser", "smbgroup",
"smbuser", "all" };
typedef struct us_node {
@ -3029,7 +3085,8 @@ zfs_do_list(int argc, char **argv)
flags &= ~ZFS_ITER_PROP_LISTSNAPS;
while (*optarg != '\0') {
static char *type_subopts[] = { "filesystem",
"volume", "snapshot", "snap", "all", NULL };
"volume", "snapshot", "snap", "bookmark",
"all", NULL };
switch (getsubopt(&optarg, type_subopts,
&value)) {
@ -3044,9 +3101,12 @@ zfs_do_list(int argc, char **argv)
types |= ZFS_TYPE_SNAPSHOT;
break;
case 4:
types = ZFS_TYPE_DATASET;
types |= ZFS_TYPE_BOOKMARK;
break;
case 5:
types = ZFS_TYPE_DATASET |
ZFS_TYPE_BOOKMARK;
break;
default:
(void) fprintf(stderr,
gettext("invalid type '%s'\n"),
@ -3286,9 +3346,29 @@ typedef struct rollback_cbdata {
char *cb_target;
int cb_error;
boolean_t cb_recurse;
boolean_t cb_dependent;
} rollback_cbdata_t;
static int
rollback_check_dependent(zfs_handle_t *zhp, void *data)
{
rollback_cbdata_t *cbp = data;
if (cbp->cb_first && cbp->cb_recurse) {
(void) fprintf(stderr, gettext("cannot rollback to "
"'%s': clones of previous snapshots exist\n"),
cbp->cb_target);
(void) fprintf(stderr, gettext("use '-R' to "
"force deletion of the following clones and "
"dependents:\n"));
cbp->cb_first = 0;
cbp->cb_error = 1;
}
(void) fprintf(stderr, "%s\n", zfs_get_name(zhp));
zfs_close(zhp);
return (0);
}
/*
* Report any snapshots more recent than the one specified. Used when '-r' is
* not specified. We reuse this same callback for the snapshot dependents - if
@ -3305,52 +3385,30 @@ rollback_check(zfs_handle_t *zhp, void *data)
return (0);
}
if (!cbp->cb_dependent) {
if (strcmp(zfs_get_name(zhp), cbp->cb_target) != 0 &&
zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT &&
zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG) >
cbp->cb_create) {
if (cbp->cb_first && !cbp->cb_recurse) {
(void) fprintf(stderr, gettext("cannot "
"rollback to '%s': more recent snapshots "
"exist\n"),
cbp->cb_target);
(void) fprintf(stderr, gettext("use '-r' to "
"force deletion of the following "
"snapshots:\n"));
cbp->cb_first = 0;
cbp->cb_error = 1;
}
if (cbp->cb_recurse) {
cbp->cb_dependent = B_TRUE;
if (zfs_iter_dependents(zhp, B_TRUE,
rollback_check, cbp) != 0) {
zfs_close(zhp);
return (-1);
}
cbp->cb_dependent = B_FALSE;
} else {
(void) fprintf(stderr, "%s\n",
zfs_get_name(zhp));
}
}
} else {
if (cbp->cb_first && cbp->cb_recurse) {
(void) fprintf(stderr, gettext("cannot rollback to "
"'%s': clones of previous snapshots exist\n"),
if (zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG) > cbp->cb_create) {
if (cbp->cb_first && !cbp->cb_recurse) {
(void) fprintf(stderr, gettext("cannot "
"rollback to '%s': more recent snapshots "
"or bookmarks exist\n"),
cbp->cb_target);
(void) fprintf(stderr, gettext("use '-R' to "
"force deletion of the following clones and "
"dependents:\n"));
(void) fprintf(stderr, gettext("use '-r' to "
"force deletion of the following "
"snapshots and bookmarks:\n"));
cbp->cb_first = 0;
cbp->cb_error = 1;
}
(void) fprintf(stderr, "%s\n", zfs_get_name(zhp));
if (cbp->cb_recurse) {
if (zfs_iter_dependents(zhp, B_TRUE,
rollback_check_dependent, cbp) != 0) {
zfs_close(zhp);
return (-1);
}
} else {
(void) fprintf(stderr, "%s\n",
zfs_get_name(zhp));
}
}
zfs_close(zhp);
return (0);
}
@ -3420,7 +3478,9 @@ zfs_do_rollback(int argc, char **argv)
cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG);
cb.cb_first = B_TRUE;
cb.cb_error = 0;
if ((ret = zfs_iter_children(zhp, rollback_check, &cb)) != 0)
if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb)) != 0)
goto out;
if ((ret = zfs_iter_bookmarks(zhp, rollback_check, &cb)) != 0)
goto out;
if ((ret = cb.cb_error) != 0)
@ -3715,12 +3775,45 @@ zfs_do_send(int argc, char **argv)
return (1);
}
cp = strchr(argv[0], '@');
if (cp == NULL) {
(void) fprintf(stderr,
gettext("argument must be a snapshot\n"));
usage(B_FALSE);
/*
* Special case sending a filesystem, or from a bookmark.
*/
if (strchr(argv[0], '@') == NULL ||
(fromname && strchr(fromname, '#') != NULL)) {
char frombuf[ZFS_MAXNAMELEN];
if (flags.replicate || flags.doall || flags.props ||
flags.dedup || flags.dryrun || flags.verbose ||
flags.progress) {
(void) fprintf(stderr,
gettext("Error: "
"Unsupported flag with filesystem or bookmark.\n"));
return (1);
}
zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET);
if (zhp == NULL)
return (1);
if (fromname != NULL &&
(fromname[0] == '#' || fromname[0] == '@')) {
/*
* Incremental source name begins with # or @.
* Default to same fs as target.
*/
(void) strncpy(frombuf, argv[0], sizeof (frombuf));
cp = strchr(frombuf, '@');
if (cp != NULL)
*cp = '\0';
(void) strlcat(frombuf, fromname, sizeof (frombuf));
fromname = frombuf;
}
err = zfs_send_one(zhp, fromname, STDOUT_FILENO);
zfs_close(zhp);
return (err != 0);
}
cp = strchr(argv[0], '@');
*cp = '\0';
toname = cp + 1;
zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME);
@ -3876,6 +3969,7 @@ zfs_do_receive(int argc, char **argv)
#define ZFS_DELEG_PERM_HOLD "hold"
#define ZFS_DELEG_PERM_RELEASE "release"
#define ZFS_DELEG_PERM_DIFF "diff"
#define ZFS_DELEG_PERM_BOOKMARK "bookmark"
#define ZFS_NUM_DELEG_NOTES ZFS_DELEG_NOTE_NONE
@ -3895,6 +3989,7 @@ static zfs_deleg_perm_tab_t zfs_deleg_perm_tbl[] = {
{ ZFS_DELEG_PERM_SEND, ZFS_DELEG_NOTE_SEND },
{ ZFS_DELEG_PERM_SHARE, ZFS_DELEG_NOTE_SHARE },
{ ZFS_DELEG_PERM_SNAPSHOT, ZFS_DELEG_NOTE_SNAPSHOT },
{ ZFS_DELEG_PERM_BOOKMARK, ZFS_DELEG_NOTE_BOOKMARK },
{ ZFS_DELEG_PERM_GROUPQUOTA, ZFS_DELEG_NOTE_GROUPQUOTA },
{ ZFS_DELEG_PERM_GROUPUSED, ZFS_DELEG_NOTE_GROUPUSED },
@ -6666,6 +6761,108 @@ zfs_do_diff(int argc, char **argv)
return (err != 0);
}
/*
* zfs bookmark <fs@snap> <fs#bmark>
*
* Creates a bookmark with the given name from the given snapshot.
*/
static int
zfs_do_bookmark(int argc, char **argv)
{
char snapname[ZFS_MAXNAMELEN];
zfs_handle_t *zhp;
nvlist_t *nvl;
int ret = 0;
int c;
/* check options */
while ((c = getopt(argc, argv, "")) != -1) {
switch (c) {
case '?':
(void) fprintf(stderr,
gettext("invalid option '%c'\n"), optopt);
goto usage;
}
}
argc -= optind;
argv += optind;
/* check number of arguments */
if (argc < 1) {
(void) fprintf(stderr, gettext("missing snapshot argument\n"));
goto usage;
}
if (argc < 2) {
(void) fprintf(stderr, gettext("missing bookmark argument\n"));
goto usage;
}
if (strchr(argv[1], '#') == NULL) {
(void) fprintf(stderr,
gettext("invalid bookmark name '%s' -- "
"must contain a '#'\n"), argv[1]);
goto usage;
}
if (argv[0][0] == '@') {
/*
* Snapshot name begins with @.
* Default to same fs as bookmark.
*/
(void) strncpy(snapname, argv[1], sizeof (snapname));
*strchr(snapname, '#') = '\0';
(void) strlcat(snapname, argv[0], sizeof (snapname));
} else {
(void) strncpy(snapname, argv[0], sizeof (snapname));
}
zhp = zfs_open(g_zfs, snapname, ZFS_TYPE_SNAPSHOT);
if (zhp == NULL)
goto usage;
zfs_close(zhp);
nvl = fnvlist_alloc();
fnvlist_add_string(nvl, argv[1], snapname);
ret = lzc_bookmark(nvl, NULL);
fnvlist_free(nvl);
if (ret != 0) {
const char *err_msg;
char errbuf[1024];
(void) snprintf(errbuf, sizeof (errbuf),
dgettext(TEXT_DOMAIN,
"cannot create bookmark '%s'"), argv[1]);
switch (ret) {
case EXDEV:
err_msg = "bookmark is in a different pool";
break;
case EEXIST:
err_msg = "bookmark exists";
break;
case EINVAL:
err_msg = "invalid argument";
break;
case ENOTSUP:
err_msg = "bookmark feature not enabled";
break;
default:
err_msg = "unknown error";
break;
}
(void) fprintf(stderr, "%s: %s\n", errbuf,
dgettext(TEXT_DOMAIN, err_msg));
}
return (ret);
usage:
usage(B_FALSE);
return (-1);
}
int
main(int argc, char **argv)
{

View File

@ -277,6 +277,9 @@ zhack_do_feature_stat(int argc, char **argv)
dump_obj(os, spa->spa_feat_for_read_obj, "for_read");
dump_obj(os, spa->spa_feat_for_write_obj, "for_write");
dump_obj(os, spa->spa_feat_desc_obj, "descriptions");
if (spa_feature_is_active(spa, SPA_FEATURE_ENABLED_TXG)) {
dump_obj(os, spa->spa_feat_enabled_txg_obj, "enabled_txg");
}
dump_mos(spa);
spa_close(spa, FTAG);
@ -313,7 +316,9 @@ zhack_do_feature_enable(int argc, char **argv)
feature.fi_uname = "zhack";
feature.fi_mos = B_FALSE;
feature.fi_can_readonly = B_FALSE;
feature.fi_activate_on_enable = B_FALSE;
feature.fi_depends = nodeps;
feature.fi_feature = SPA_FEATURE_NONE;
optind = 1;
while ((c = getopt(argc, argv, "rmd:")) != -1) {
@ -371,7 +376,7 @@ feature_incr_sync(void *arg, dmu_tx_t *tx)
zfeature_info_t *feature = arg;
uint64_t refcount;
VERIFY0(feature_get_refcount(spa, feature, &refcount));
VERIFY0(feature_get_refcount_from_disk(spa, feature, &refcount));
feature_sync(spa, feature, refcount + 1, tx);
spa_history_log_internal(spa, "zhack feature incr", tx,
"name=%s", feature->fi_guid);
@ -384,7 +389,7 @@ feature_decr_sync(void *arg, dmu_tx_t *tx)
zfeature_info_t *feature = arg;
uint64_t refcount;
VERIFY0(feature_get_refcount(spa, feature, &refcount));
VERIFY0(feature_get_refcount_from_disk(spa, feature, &refcount));
feature_sync(spa, feature, refcount - 1, tx);
spa_history_log_internal(spa, "zhack feature decr", tx,
"name=%s", feature->fi_guid);
@ -411,6 +416,7 @@ zhack_do_feature_ref(int argc, char **argv)
feature.fi_mos = B_FALSE;
feature.fi_desc = NULL;
feature.fi_depends = nodeps;
feature.fi_feature = SPA_FEATURE_NONE;
optind = 1;
while ((c = getopt(argc, argv, "md")) != -1) {
@ -459,8 +465,8 @@ zhack_do_feature_ref(int argc, char **argv)
if (decr) {
uint64_t count;
if (feature_get_refcount(spa, &feature, &count) == 0 &&
count != 0) {
if (feature_get_refcount_from_disk(spa, &feature,
&count) == 0 && count != 0) {
fatal(spa, FTAG, "feature refcount already 0: %s",
feature.fi_guid);
}

View File

@ -23,7 +23,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd October 08, 2013
.Dd January 2, 2014
.Dt ZPOOL-FEATURES 7
.Os
.Sh NAME
@ -222,12 +222,16 @@ command. Please note that doing so will
immediately activate the
.Sy lz4_compress
feature on the underlying
pool (even before any data is written). Since this feature is not
read-only compatible, this operation will render the pool unimportable
on systems without support for the
pool
.Pq even before any data is written ,
and the feature will not be
deactivated.
Since this feature is not read-only compatible, this
operation will render the pool unimportable on systems without support
for the
.Sy lz4_compress
feature. At the
moment, this operation cannot be reversed. Booting off of
feature.
Booting off of
.Sy lz4
-compressed root pools is supported.
.It Sy multi_vdev_crash_dump
@ -286,6 +290,95 @@ and will be returned to the
.Sy enabled
state when all datasets that use
this feature are destroyed.
.It Sy bookmarks
.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:bookmarks"
.It GUID Ta com.delphix:bookmarks
.It READ\-ONLY COMPATIBLE Ta yes
.It DEPENDENCIES Ta extensible_dataset
.El
.Pp
This feature enables use of the
.Nm zfs
.Cm bookmark
subcommand.
.Pp
This feature is
.Sy active
while any bookmarks exist in the pool.
All bookmarks in the pool can be listed by running
.Nm zfs
.Cm list
.Fl t No bookmark Fl r Ar poolname .
.It Sy enabled_txg
.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:enabled_txg"
.It GUID Ta com.delphix:enabled_txg
.It READ\-ONLY COMPATIBLE Ta yes
.It DEPENDENCIES Ta none
.El
.Pp
Once this feature is enabled ZFS records the transaction group number
in which new features are enabled. This has no user-visible impact,
but other features may depend on this feature.
.Pp
This feature becomes
.Sy active
as soon as it is enabled and will
never return to being
.Sy enabled .
.It Sy hole_birth
.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:hole_birth"
.It GUID Ta com.delphix:hole_birth
.It READ\-ONLY COMPATIBLE Ta no
.It DEPENDENCIES Ta enabled_txg
.El
.Pp
This feature improves performance of incremental sends
.Pq Dq zfs send -i
and receives for objects with many holes.
The most common case of
hole-filled objects is zvols.
.Pp
An incremental send stream from snapshot
.Sy A
to snapshot
.Sy B
contains information about every block that changed between
.Sy A
and
.Sy B .
Blocks which did not change between those snapshots can be
identified and omitted from the stream using a piece of metadata called
the 'block birth time', but birth times are not recorded for holes
.Pq blocks filled only with zeroes .
Since holes created after
.Sy A
cannot be
distinguished from holes created before
.Sy A ,
information about every
hole in the entire filesystem or zvol is included in the send stream.
.Pp
For workloads where holes are rare this is not a problem.
However, when
incrementally replicating filesystems or zvols with many holes
.Pq for example a zvol formatted with another filesystem
a lot of time will
be spent sending and receiving unnecessary information about holes that
already exist on the receiving side.
.Pp
Once the
.Sy hole_birth
feature has been enabled the block birth times
of all new holes will be recorded.
Incremental sends between snapshots
created after this feature is enabled will use this new metadata to avoid
sending information about holes that already exist on the receiving side.
.Pp
This feature becomes
.Sy active
as soon as it is enabled and will
never return to being
.Sy enabled .
.El
.Sh SEE ALSO
.Xr zpool 8

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd March 14, 2013
.Dd December 31, 2013
.Dt ZPOOL 8
.Os
.Sh NAME
@ -141,6 +141,9 @@
.Cm remove
.Ar pool device ...
.Nm
.Cm reopen
.Ar pool
.Nm
.Cm replace
.Op Fl f
.Ar pool device
@ -1431,6 +1434,13 @@ command. Non-redundant and
devices cannot be removed from a pool.
.It Xo
.Nm
.Cm reopen
.Ar pool
.Xc
.Pp
Reopen all the vdevs associated with the pool.
.It Xo
.Nm
.Cm replace
.Op Fl f
.Ar pool device

View File

@ -248,7 +248,7 @@ get_usage(zpool_help_t idx) {
case HELP_REMOVE:
return (gettext("\tremove <pool> <device> ...\n"));
case HELP_REOPEN:
return (""); /* Undocumented command */
return (gettext("\treopen <pool>\n"));
case HELP_SCRUB:
return (gettext("\tscrub [-s] <pool> ...\n"));
case HELP_STATUS:
@ -3720,22 +3720,37 @@ zpool_do_reguid(int argc, char **argv)
* zpool reopen <pool>
*
* Reopen the pool so that the kernel can update the sizes of all vdevs.
*
* NOTE: This command is currently undocumented. If the command is ever
* exposed then the appropriate usage() messages will need to be made.
*/
int
zpool_do_reopen(int argc, char **argv)
{
int c;
int ret = 0;
zpool_handle_t *zhp;
char *pool;
/* check options */
while ((c = getopt(argc, argv, "")) != -1) {
switch (c) {
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
usage(B_FALSE);
}
}
argc--;
argv++;
if (argc != 1)
return (2);
if (argc < 1) {
(void) fprintf(stderr, gettext("missing pool name\n"));
usage(B_FALSE);
}
if (argc > 1) {
(void) fprintf(stderr, gettext("too many arguments\n"));
usage(B_FALSE);
}
pool = argv[0];
if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL)

View File

@ -18,10 +18,11 @@
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2013, Delphix. All Rights Reserved.
.\"
.\" $FreeBSD$
.\"
.Dd November 26, 2011
.Dd December 31, 2013
.Dt ZSTREAMDUMP 8
.Os
.Sh NAME
@ -30,6 +31,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl C
.Op Fl d
.Op Fl v
.Sh DESCRIPTION
The
@ -43,6 +45,8 @@ The following options are supported:
.Bl -tag -width indent
.It Fl C
Suppress the validation of checksums.
.It Fl d
Dump contents of blocks modified, implies verbose.
.It Fl v
Verbose. Dump all headers, not only begin and end headers.
.El

View File

@ -24,6 +24,11 @@
* Use is subject to license terms.
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <ctype.h>
#include <libnvpair.h>
#include <stdio.h>
#include <stdlib.h>
@ -34,6 +39,16 @@
#include <sys/zfs_ioctl.h>
#include <zfs_fletcher.h>
/*
* If dump mode is enabled, the number of bytes to print per line
*/
#define BYTES_PER_LINE 16
/*
* If dump mode is enabled, the number of bytes to group together, separated
* by newlines or spaces
*/
#define DUMP_GROUPING 4
uint64_t drr_record_count[DRR_NUMTYPES];
uint64_t total_write_size = 0;
uint64_t total_stream_len = 0;
@ -45,9 +60,11 @@ boolean_t do_cksum = B_TRUE;
static void
usage(void)
{
(void) fprintf(stderr, "usage: zstreamdump [-v] [-C] < file\n");
(void) fprintf(stderr, "usage: zstreamdump [-v] [-C] [-d] < file\n");
(void) fprintf(stderr, "\t -v -- verbose\n");
(void) fprintf(stderr, "\t -C -- suppress checksum verification\n");
(void) fprintf(stderr, "\t -d -- dump contents of blocks modified, "
"implies verbose\n");
exit(1);
}
@ -75,6 +92,70 @@ ssread(void *buf, size_t len, zio_cksum_t *cksum)
return (outlen);
}
/*
* Print part of a block in ASCII characters
*/
static void
print_ascii_block(char *subbuf, int length)
{
int i;
for (i = 0; i < length; i++) {
char char_print = isprint(subbuf[i]) ? subbuf[i] : '.';
if (i != 0 && i % DUMP_GROUPING == 0) {
(void) printf(" ");
}
(void) printf("%c", char_print);
}
(void) printf("\n");
}
/*
* print_block - Dump the contents of a modified block to STDOUT
*
* Assume that buf has capacity evenly divisible by BYTES_PER_LINE
*/
static void
print_block(char *buf, int length)
{
int i;
/*
* Start printing ASCII characters at a constant offset, after
* the hex prints. Leave 3 characters per byte on a line (2 digit
* hex number plus 1 space) plus spaces between characters and
* groupings
*/
int ascii_start = BYTES_PER_LINE * 3 +
BYTES_PER_LINE / DUMP_GROUPING + 2;
for (i = 0; i < length; i += BYTES_PER_LINE) {
int j;
int this_line_length = MIN(BYTES_PER_LINE, length - i);
int print_offset = 0;
for (j = 0; j < this_line_length; j++) {
int buf_offset = i + j;
/*
* Separate every DUMP_GROUPING bytes by a space.
*/
if (buf_offset % DUMP_GROUPING == 0) {
print_offset += printf(" ");
}
/*
* Print the two-digit hex value for this byte.
*/
unsigned char hex_print = buf[buf_offset];
print_offset += printf("%02x ", hex_print);
}
(void) printf("%*s", ascii_start - print_offset, " ");
print_ascii_block(buf + i, this_line_length);
}
}
int
main(int argc, char *argv[])
{
@ -92,11 +173,17 @@ main(int argc, char *argv[])
char c;
boolean_t verbose = B_FALSE;
boolean_t first = B_TRUE;
/*
* dump flag controls whether the contents of any modified data blocks
* are printed to the console during processing of the stream. Warning:
* for large streams, this can obviously lead to massive prints.
*/
boolean_t dump = B_FALSE;
int err;
zio_cksum_t zc = { 0 };
zio_cksum_t pcksum = { 0 };
while ((c = getopt(argc, argv, ":vC")) != -1) {
while ((c = getopt(argc, argv, ":vCd")) != -1) {
switch (c) {
case 'C':
do_cksum = B_FALSE;
@ -104,6 +191,10 @@ main(int argc, char *argv[])
case 'v':
verbose = B_TRUE;
break;
case 'd':
dump = B_TRUE;
verbose = B_TRUE;
break;
case ':':
(void) fprintf(stderr,
"missing argument for '%c' option\n", optopt);
@ -128,6 +219,10 @@ main(int argc, char *argv[])
pcksum = zc;
while (ssread(drr, sizeof (dmu_replay_record_t), &zc)) {
/*
* If this is the first DMU record being processed, check for
* the magic bytes and figure out the endian-ness based on them.
*/
if (first) {
if (drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC)) {
do_byteswap = B_TRUE;
@ -209,7 +304,7 @@ main(int argc, char *argv[])
nvlist_t *nv;
int sz = drr->drr_payloadlen;
if (sz > 1<<20) {
if (sz > INITIAL_BUFLEN) {
free(buf);
buf = malloc(sz);
}
@ -283,6 +378,10 @@ main(int argc, char *argv[])
if (drro->drr_bonuslen > 0) {
(void) ssread(buf, P2ROUNDUP(drro->drr_bonuslen,
8), &zc);
if (dump) {
print_block(buf,
P2ROUNDUP(drro->drr_bonuslen, 8));
}
}
break;
@ -312,6 +411,10 @@ main(int argc, char *argv[])
drrw->drr_key.ddk_prop =
BSWAP_64(drrw->drr_key.ddk_prop);
}
/*
* If this is verbose and/or dump output,
* print info on the modified block
*/
if (verbose) {
(void) printf("WRITE object = %llu type = %u "
"checksum type = %u\n"
@ -324,7 +427,16 @@ main(int argc, char *argv[])
(u_longlong_t)drrw->drr_length,
(u_longlong_t)drrw->drr_key.ddk_prop);
}
/*
* Read the contents of the block in from STDIN to buf
*/
(void) ssread(buf, drrw->drr_length, &zc);
/*
* If in dump mode
*/
if (dump) {
print_block(buf, drrw->drr_length);
}
total_write_size += drrw->drr_length;
break;
@ -390,6 +502,9 @@ main(int argc, char *argv[])
drrs->drr_length);
}
(void) ssread(buf, drrs->drr_length, &zc);
if (dump) {
print_block(buf, drrs->drr_length);
}
break;
}
pcksum = zc;

View File

@ -1620,10 +1620,17 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
* the executable file as the symbol is going to be
* change from UND to ABS.
*/
rela.r_offset = 0;
rela.r_info = 0;
rela.r_addend = 0;
(void) gelf_update_rela(data_rel, i, &rela);
if (shdr_rel.sh_type == SHT_RELA) {
rela.r_offset = 0;
rela.r_info = 0;
rela.r_addend = 0;
(void) gelf_update_rela(data_rel, i, &rela);
} else {
GElf_Rel rel;
rel.r_offset = 0;
rel.r_info = 0;
(void) gelf_update_rel(data_rel, i, &rel);
}
#endif
mod = 1;

View File

@ -23,7 +23,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
@ -193,6 +193,7 @@ extern int zpool_log_history(libzfs_handle_t *, const char *);
extern int libzfs_errno(libzfs_handle_t *);
extern const char *libzfs_error_action(libzfs_handle_t *);
extern const char *libzfs_error_description(libzfs_handle_t *);
extern int zfs_standard_error(libzfs_handle_t *, int, const char *);
extern void libzfs_mnttab_init(libzfs_handle_t *);
extern void libzfs_mnttab_fini(libzfs_handle_t *);
extern void libzfs_mnttab_cache(libzfs_handle_t *, boolean_t);
@ -537,6 +538,7 @@ extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *);
extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *);
extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *);
extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *);
typedef struct get_all_cb {
zfs_handle_t **cb_handles;
@ -611,6 +613,7 @@ typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);
extern int zfs_send(zfs_handle_t *, const char *, const char *,
sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **);
extern int zfs_send_one(zfs_handle_t *, const char *, int);
extern int zfs_promote(zfs_handle_t *);
extern int zfs_hold(zfs_handle_t *, const char *, const char *,
@ -680,6 +683,7 @@ extern zfs_handle_t *zfs_path_to_zhandle(libzfs_handle_t *, char *, zfs_type_t);
extern boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *,
zfs_type_t);
extern int zfs_spa_version(zfs_handle_t *, int *);
extern boolean_t zfs_bookmark_exists(const char *path);
/*
* Mount support functions.

View File

@ -295,7 +295,7 @@ zpool_handle(zfs_handle_t *zhp)
int len;
zpool_handle_t *zph;
len = strcspn(zhp->zfs_name, "/@") + 1;
len = strcspn(zhp->zfs_name, "/@#") + 1;
pool_name = zfs_alloc(zhp->zfs_hdl, len);
(void) strlcpy(pool_name, zhp->zfs_name, len);
@ -579,6 +579,70 @@ zfs_handle_dup(zfs_handle_t *zhp_orig)
return (zhp);
}
boolean_t
zfs_bookmark_exists(const char *path)
{
nvlist_t *bmarks;
nvlist_t *props;
char fsname[ZFS_MAXNAMELEN];
char *bmark_name;
char *pound;
int err;
boolean_t rv;
(void) strlcpy(fsname, path, sizeof (fsname));
pound = strchr(fsname, '#');
if (pound == NULL)
return (B_FALSE);
*pound = '\0';
bmark_name = pound + 1;
props = fnvlist_alloc();
err = lzc_get_bookmarks(fsname, props, &bmarks);
nvlist_free(props);
if (err != 0) {
nvlist_free(bmarks);
return (B_FALSE);
}
rv = nvlist_exists(bmarks, bmark_name);
nvlist_free(bmarks);
return (rv);
}
zfs_handle_t *
make_bookmark_handle(zfs_handle_t *parent, const char *path,
nvlist_t *bmark_props)
{
zfs_handle_t *zhp = calloc(sizeof (zfs_handle_t), 1);
if (zhp == NULL)
return (NULL);
/* Fill in the name. */
zhp->zfs_hdl = parent->zfs_hdl;
(void) strlcpy(zhp->zfs_name, path, sizeof (zhp->zfs_name));
/* Set the property lists. */
if (nvlist_dup(bmark_props, &zhp->zfs_props, 0) != 0) {
free(zhp);
return (NULL);
}
/* Set the types. */
zhp->zfs_head_type = parent->zfs_head_type;
zhp->zfs_type = ZFS_TYPE_BOOKMARK;
if ((zhp->zpool_hdl = zpool_handle(zhp)) == NULL) {
nvlist_free(zhp->zfs_props);
free(zhp);
return (NULL);
}
return (zhp);
}
/*
* Opens the given snapshot, filesystem, or volume. The 'types'
* argument is a mask of acceptable types. The function will print an
@ -2271,6 +2335,9 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
case ZFS_TYPE_SNAPSHOT:
str = "snapshot";
break;
case ZFS_TYPE_BOOKMARK:
str = "bookmark";
break;
default:
abort();
}
@ -3133,6 +3200,19 @@ zfs_destroy(zfs_handle_t *zhp, boolean_t defer)
{
zfs_cmd_t zc = { 0 };
if (zhp->zfs_type == ZFS_TYPE_BOOKMARK) {
nvlist_t *nv = fnvlist_alloc();
fnvlist_add_boolean(nv, zhp->zfs_name);
int error = lzc_destroy_bookmarks(nv, NULL);
fnvlist_free(nv);
if (error != 0) {
return (zfs_standard_error_fmt(zhp->zfs_hdl, errno,
dgettext(TEXT_DOMAIN, "cannot destroy '%s'"),
zhp->zfs_name));
}
return (0);
}
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
if (ZFS_IS_VOLUME(zhp)) {
@ -3515,45 +3595,44 @@ typedef struct rollback_data {
const char *cb_target; /* the snapshot */
uint64_t cb_create; /* creation time reference */
boolean_t cb_error;
boolean_t cb_dependent;
boolean_t cb_force;
} rollback_data_t;
static int
rollback_destroy_dependent(zfs_handle_t *zhp, void *data)
{
rollback_data_t *cbp = data;
prop_changelist_t *clp;
/* We must destroy this clone; first unmount it */
clp = changelist_gather(zhp, ZFS_PROP_NAME, 0,
cbp->cb_force ? MS_FORCE: 0);
if (clp == NULL || changelist_prefix(clp) != 0) {
cbp->cb_error = B_TRUE;
zfs_close(zhp);
return (0);
}
if (zfs_destroy(zhp, B_FALSE) != 0)
cbp->cb_error = B_TRUE;
else
changelist_remove(clp, zhp->zfs_name);
(void) changelist_postfix(clp);
changelist_free(clp);
zfs_close(zhp);
return (0);
}
static int
rollback_destroy(zfs_handle_t *zhp, void *data)
{
rollback_data_t *cbp = data;
if (!cbp->cb_dependent) {
if (strcmp(zhp->zfs_name, cbp->cb_target) != 0 &&
zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT &&
zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG) >
cbp->cb_create) {
if (zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG) > cbp->cb_create) {
cbp->cb_error |= zfs_iter_dependents(zhp, B_FALSE,
rollback_destroy_dependent, cbp);
cbp->cb_dependent = B_TRUE;
cbp->cb_error |= zfs_iter_dependents(zhp, B_FALSE,
rollback_destroy, cbp);
cbp->cb_dependent = B_FALSE;
cbp->cb_error |= zfs_destroy(zhp, B_FALSE);
}
} else {
/* We must destroy this clone; first unmount it */
prop_changelist_t *clp;
clp = changelist_gather(zhp, ZFS_PROP_NAME, 0,
cbp->cb_force ? MS_FORCE: 0);
if (clp == NULL || changelist_prefix(clp) != 0) {
cbp->cb_error = B_TRUE;
zfs_close(zhp);
return (0);
}
if (zfs_destroy(zhp, B_FALSE) != 0)
cbp->cb_error = B_TRUE;
else
changelist_remove(clp, zhp->zfs_name);
(void) changelist_postfix(clp);
changelist_free(clp);
cbp->cb_error |= zfs_destroy(zhp, B_FALSE);
}
zfs_close(zhp);
@ -3564,8 +3643,8 @@ rollback_destroy(zfs_handle_t *zhp, void *data)
* Given a dataset, rollback to a specific snapshot, discarding any
* data changes since then and making it the active dataset.
*
* Any snapshots more recent than the target are destroyed, along with
* their dependents.
* Any snapshots and bookmarks more recent than the target are
* destroyed, along with their dependents (i.e. clones).
*/
int
zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, boolean_t force)
@ -3585,7 +3664,8 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, boolean_t force)
cb.cb_force = force;
cb.cb_target = snap->zfs_name;
cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG);
(void) zfs_iter_children(zhp, rollback_destroy, &cb);
(void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb);
(void) zfs_iter_bookmarks(zhp, rollback_destroy, &cb);
if (cb.cb_error)
return (-1);

View File

@ -23,7 +23,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
@ -191,6 +191,8 @@ int create_parents(libzfs_handle_t *, char *, int);
boolean_t isa_child_of(const char *dataset, const char *parent);
zfs_handle_t *make_dataset_handle(libzfs_handle_t *, const char *);
zfs_handle_t *make_bookmark_handle(zfs_handle_t *, const char *,
nvlist_t *props);
int zpool_open_silent(libzfs_handle_t *, const char *, zpool_handle_t **);

View File

@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
@ -146,7 +146,8 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple, zfs_iter_f func,
zfs_handle_t *nzhp;
int ret;
if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT)
if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT ||
zhp->zfs_type == ZFS_TYPE_BOOKMARK)
return (0);
zc.zc_simple = simple;
@ -172,6 +173,59 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple, zfs_iter_f func,
return ((ret < 0) ? ret : 0);
}
/*
* Iterate over all bookmarks
*/
int
zfs_iter_bookmarks(zfs_handle_t *zhp, zfs_iter_f func, void *data)
{
zfs_handle_t *nzhp;
nvlist_t *props = NULL;
nvlist_t *bmarks = NULL;
int err;
if ((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT | ZFS_TYPE_BOOKMARK)) != 0)
return (0);
/* Setup the requested properties nvlist. */
props = fnvlist_alloc();
fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_GUID));
fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATETXG));
fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATION));
/* Allocate an nvlist to hold the bookmarks. */
bmarks = fnvlist_alloc();
if ((err = lzc_get_bookmarks(zhp->zfs_name, props, &bmarks)) != 0)
goto out;
for (nvpair_t *pair = nvlist_next_nvpair(bmarks, NULL);
pair != NULL; pair = nvlist_next_nvpair(bmarks, pair)) {
char name[ZFS_MAXNAMELEN];
char *bmark_name;
nvlist_t *bmark_props;
bmark_name = nvpair_name(pair);
bmark_props = fnvpair_value_nvlist(pair);
(void) snprintf(name, sizeof (name), "%s#%s", zhp->zfs_name,
bmark_name);
nzhp = make_bookmark_handle(zhp, name, bmark_props);
if (nzhp == NULL)
continue;
if ((err = func(nzhp, data)) != 0)
goto out;
}
out:
fnvlist_free(props);
fnvlist_free(bmarks);
return (err);
}
/*
* Routines for dealing with the sorted snapshot functionality
*/
@ -406,13 +460,13 @@ static int
iter_dependents_cb(zfs_handle_t *zhp, void *arg)
{
iter_dependents_arg_t *ida = arg;
int err;
int err = 0;
boolean_t first = ida->first;
ida->first = B_FALSE;
if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT) {
err = zfs_iter_clones(zhp, iter_dependents_cb, ida);
} else {
} else if (zhp->zfs_type != ZFS_TYPE_BOOKMARK) {
iter_stack_frame_t isf;
iter_stack_frame_t *f;

View File

@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
@ -1619,6 +1619,62 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
return (err);
}
int
zfs_send_one(zfs_handle_t *zhp, const char *from, int fd)
{
int err;
libzfs_handle_t *hdl = zhp->zfs_hdl;
char errbuf[1024];
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
"warning: cannot send '%s'"), zhp->zfs_name);
err = lzc_send(zhp->zfs_name, from, fd);
if (err != 0) {
switch (errno) {
case EXDEV:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"not an earlier snapshot from the same fs"));
return (zfs_error(hdl, EZFS_CROSSTARGET, errbuf));
case ENOENT:
case ESRCH:
if (lzc_exists(zhp->zfs_name)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"incremental source (%s) does not exist"),
from);
}
return (zfs_error(hdl, EZFS_NOENT, errbuf));
case EBUSY:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"target is busy; if a filesystem, "
"it must not be mounted"));
return (zfs_error(hdl, EZFS_BUSY, errbuf));
case EDQUOT:
case EFBIG:
case EIO:
case ENOLINK:
case ENOSPC:
#ifdef illumos
case ENOSTR:
#endif
case ENXIO:
case EPIPE:
case ERANGE:
case EFAULT:
case EROFS:
zfs_error_aux(hdl, strerror(errno));
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
default:
return (zfs_standard_error(hdl, errno, errbuf));
}
}
return (err != 0);
}
/*
* Routines specific to "zfs recv"
*/

View File

@ -486,18 +486,30 @@ lzc_get_holds(const char *snapname, nvlist_t **holdsp)
}
/*
* If fromsnap is NULL, a full (non-incremental) stream will be sent.
*
* "snapname" is the full name of the snapshot to send (e.g. "pool/fs@snap")
*
* If "from" is NULL, a full (non-incremental) stream will be sent.
* If "from" is non-NULL, it must be the full name of a snapshot or
* bookmark to send an incremental from (e.g. "pool/fs@earlier_snap" or
* "pool/fs#earlier_bmark"). If non-NULL, the specified snapshot or
* bookmark must represent an earlier point in the history of "snapname").
* It can be an earlier snapshot in the same filesystem or zvol as "snapname",
* or it can be the origin of "snapname"'s filesystem, or an earlier
* snapshot in the origin, etc.
*
* "fd" is the file descriptor to write the send stream to.
*/
int
lzc_send(const char *snapname, const char *fromsnap, int fd)
lzc_send(const char *snapname, const char *from, int fd)
{
nvlist_t *args;
int err;
args = fnvlist_alloc();
fnvlist_add_int32(args, "fd", fd);
if (fromsnap != NULL)
fnvlist_add_string(args, "fromsnap", fromsnap);
if (from != NULL)
fnvlist_add_string(args, "fromsnap", from);
err = lzc_ioctl(ZFS_IOC_SEND_NEW, snapname, args, NULL);
nvlist_free(args);
return (err);
@ -652,3 +664,97 @@ lzc_rollback(const char *fsname, char *snapnamebuf, int snapnamelen)
}
return (err);
}
/*
* Creates bookmarks.
*
* The bookmarks nvlist maps from name of the bookmark (e.g. "pool/fs#bmark") to
* the name of the snapshot (e.g. "pool/fs@snap"). All the bookmarks and
* snapshots must be in the same pool.
*
* The returned results nvlist will have an entry for each bookmark that failed.
* The value will be the (int32) error code.
*
* The return value will be 0 if all bookmarks were created, otherwise it will
* be the errno of a (undetermined) bookmarks that failed.
*/
int
lzc_bookmark(nvlist_t *bookmarks, nvlist_t **errlist)
{
nvpair_t *elem;
int error;
char pool[MAXNAMELEN];
/* determine the pool name */
elem = nvlist_next_nvpair(bookmarks, NULL);
if (elem == NULL)
return (0);
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
pool[strcspn(pool, "/#")] = '\0';
error = lzc_ioctl(ZFS_IOC_BOOKMARK, pool, bookmarks, errlist);
return (error);
}
/*
* Retrieve bookmarks.
*
* Retrieve the list of bookmarks for the given file system. The props
* parameter is an nvlist of property names (with no values) that will be
* returned for each bookmark.
*
* The following are valid properties on bookmarks, all of which are numbers
* (represented as uint64 in the nvlist)
*
* "guid" - globally unique identifier of the snapshot it refers to
* "createtxg" - txg when the snapshot it refers to was created
* "creation" - timestamp when the snapshot it refers to was created
*
* The format of the returned nvlist as follows:
* <short name of bookmark> -> {
* <name of property> -> {
* "value" -> uint64
* }
* }
*/
int
lzc_get_bookmarks(const char *fsname, nvlist_t *props, nvlist_t **bmarks)
{
return (lzc_ioctl(ZFS_IOC_GET_BOOKMARKS, fsname, props, bmarks));
}
/*
* Destroys bookmarks.
*
* The keys in the bmarks nvlist are the bookmarks to be destroyed.
* They must all be in the same pool. Bookmarks are specified as
* <fs>#<bmark>.
*
* Bookmarks that do not exist will be silently ignored.
*
* The return value will be 0 if all bookmarks that existed were destroyed.
*
* Otherwise the return value will be the errno of a (undetermined) bookmark
* that failed, no bookmarks will be destroyed, and the errlist will have an
* entry for each bookmarks that failed. The value in the errlist will be
* the (int32) error code.
*/
int
lzc_destroy_bookmarks(nvlist_t *bmarks, nvlist_t **errlist)
{
nvpair_t *elem;
int error;
char pool[MAXNAMELEN];
/* determine the pool name */
elem = nvlist_next_nvpair(bmarks, NULL);
if (elem == NULL)
return (0);
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
pool[strcspn(pool, "/#")] = '\0';
error = lzc_ioctl(ZFS_IOC_DESTROY_BOOKMARKS, pool, bmarks, errlist);
return (error);
}

View File

@ -39,27 +39,27 @@ extern "C" {
int libzfs_core_init(void);
void libzfs_core_fini(void);
int lzc_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t **errlist);
int lzc_create(const char *fsname, dmu_objset_type_t type, nvlist_t *props);
int lzc_clone(const char *fsname, const char *origin, nvlist_t *props);
int lzc_destroy_snaps(nvlist_t *snaps, boolean_t defer, nvlist_t **errlist);
int lzc_snapshot(nvlist_t *, nvlist_t *, nvlist_t **);
int lzc_create(const char *, dmu_objset_type_t, nvlist_t *);
int lzc_clone(const char *, const char *, nvlist_t *);
int lzc_destroy_snaps(nvlist_t *, boolean_t, nvlist_t **);
int lzc_bookmark(nvlist_t *, nvlist_t **);
int lzc_get_bookmarks(const char *, nvlist_t *, nvlist_t **);
int lzc_destroy_bookmarks(nvlist_t *, nvlist_t **);
int lzc_snaprange_space(const char *firstsnap, const char *lastsnap,
uint64_t *usedp);
int lzc_snaprange_space(const char *, const char *, uint64_t *);
int lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist);
int lzc_release(nvlist_t *holds, nvlist_t **errlist);
int lzc_get_holds(const char *snapname, nvlist_t **holdsp);
int lzc_hold(nvlist_t *, int, nvlist_t **);
int lzc_release(nvlist_t *, nvlist_t **);
int lzc_get_holds(const char *, nvlist_t **);
int lzc_send(const char *snapname, const char *fromsnap, int fd);
int lzc_receive(const char *snapname, nvlist_t *props, const char *origin,
boolean_t force, int fd);
int lzc_send_space(const char *snapname, const char *fromsnap,
uint64_t *result);
int lzc_send(const char *, const char *, int);
int lzc_receive(const char *, nvlist_t *, const char *, boolean_t, int);
int lzc_send_space(const char *, const char *, uint64_t *);
boolean_t lzc_exists(const char *dataset);
boolean_t lzc_exists(const char *);
int lzc_rollback(const char *fsname, char *snapnamebuf, int snapnamelen);
int lzc_rollback(const char *, char *, int);
#ifdef __cplusplus
}

View File

@ -661,7 +661,7 @@ __dprintf(const char *file, const char *func, int line, const char *fmt, ...)
if (dprintf_find_string("pid"))
(void) printf("%d ", getpid());
if (dprintf_find_string("tid"))
(void) printf("%u ", thr_self());
(void) printf("%ul ", thr_self());
#if 0
if (dprintf_find_string("cpu"))
(void) printf("%u ", getcpuid());
@ -1125,3 +1125,50 @@ zvol_create_minors(const char *name)
return (0);
}
#endif
#ifdef illumos
void
bioinit(buf_t *bp)
{
bzero(bp, sizeof (buf_t));
}
void
biodone(buf_t *bp)
{
if (bp->b_iodone != NULL) {
(*(bp->b_iodone))(bp);
return;
}
ASSERT((bp->b_flags & B_DONE) == 0);
bp->b_flags |= B_DONE;
}
void
bioerror(buf_t *bp, int error)
{
ASSERT(bp != NULL);
ASSERT(error >= 0);
if (error != 0) {
bp->b_flags |= B_ERROR;
} else {
bp->b_flags &= ~B_ERROR;
}
bp->b_error = error;
}
int
geterror(struct buf *bp)
{
int error = 0;
if (bp->b_flags & B_ERROR) {
error = bp->b_error;
if (!error)
error = EIO;
}
return (error);
}
#endif

View File

@ -778,6 +778,38 @@ extern void cyclic_remove(cyclic_id_t);
extern int cyclic_reprogram(cyclic_id_t, hrtime_t);
#endif /* illumos */
#ifdef illumos
/*
* Buf structure
*/
#define B_BUSY 0x0001
#define B_DONE 0x0002
#define B_ERROR 0x0004
#define B_READ 0x0040 /* read when I/O occurs */
#define B_WRITE 0x0100 /* non-read pseudo-flag */
typedef struct buf {
int b_flags;
size_t b_bcount;
union {
caddr_t b_addr;
} b_un;
lldaddr_t _b_blkno;
#define b_lblkno _b_blkno._f
size_t b_resid;
size_t b_bufsize;
int (*b_iodone)(struct buf *);
int b_error;
void *b_private;
} buf_t;
extern void bioinit(buf_t *);
extern void biodone(buf_t *);
extern void bioerror(buf_t *, int);
extern int geterror(buf_t *);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -20,6 +20,7 @@
# CDDL HEADER END
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013 by Delphix. All rights reserved.
#
"""This module implements the "zfs allow" and "zfs unallow" subcommands.
@ -219,6 +220,7 @@ def decodeid(w, toidfunc, fmt):
hold=_("Allows adding a user hold to a snapshot"),
release=_("Allows releasing a user hold which\n\t\t\t\tmight destroy the snapshot"),
diff=_("Allows lookup of paths within a dataset,\n\t\t\t\tgiven an object number. Ordinary users need this\n\t\t\t\tin order to use zfs diff"),
bookmark="",
)
perms_other = dict(

View File

@ -11567,7 +11567,7 @@ fix_insn (fix, odesc, value)
err = (*odesc->insert) (odesc, value, insn + slot);
if (err)
as_bad_where (fix->fx_file, fix->fx_line, err);
as_bad_where (fix->fx_file, fix->fx_line, "%s", err);
t0 = control_bits | (insn[0] << 5) | (insn[1] << 46);
t1 = ((insn[1] >> 18) & 0x7fffff) | (insn[2] << 23);

View File

@ -82,7 +82,7 @@ dependencies[] = {
{ "CPUID#", 7, 0, 5, -1, NULL, },
{ "CR[CMCV]", 27, 0, 3, 74, NULL, },
{ "CR[DCR]", 27, 0, 3, 0, NULL, },
{ "CR[EOI]", 27, 0, 7, 67, "SC Section 5.8.3.4, \"End of External Interrupt Register (EOI Ð CR67)\" on page 2:119", },
{ "CR[EOI]", 27, 0, 7, 67, "SC Section 5.8.3.4, \"End of External Interrupt Register (EOI - CR67)\" on page 2:119", },
{ "CR[GPTA]", 27, 0, 3, 9, NULL, },
{ "CR[IFA]", 27, 0, 1, 20, NULL, },
{ "CR[IFA]", 27, 0, 3, 20, NULL, },
@ -103,13 +103,13 @@ dependencies[] = {
{ "CR[ITM]", 27, 0, 3, 1, NULL, },
{ "CR[ITV]", 27, 0, 3, 72, NULL, },
{ "CR[IVA]", 27, 0, 4, 2, NULL, },
{ "CR[IVR]", 27, 0, 7, 65, "SC Section 5.8.3.2, \"External Interrupt Vector Register (IVR Ð CR65)\" on page 2:118", },
{ "CR[LID]", 27, 0, 7, 64, "SC Section 5.8.3.1, \"Local ID (LID Ð CR64)\" on page 2:117", },
{ "CR[IVR]", 27, 0, 7, 65, "SC Section 5.8.3.2, \"External Interrupt Vector Register (IVR - CR65)\" on page 2:118", },
{ "CR[LID]", 27, 0, 7, 64, "SC Section 5.8.3.1, \"Local ID (LID - CR64)\" on page 2:117", },
{ "CR[LRR%], % in 0 - 1", 9, 0, 3, -1, NULL, },
{ "CR[PMV]", 27, 0, 3, 73, NULL, },
{ "CR[PTA]", 27, 0, 3, 8, NULL, },
{ "CR[TPR]", 27, 0, 3, 66, NULL, },
{ "CR[TPR]", 27, 0, 7, 66, "SC Section 5.8.3.3, \"Task Priority Register (TPR Ð CR66)\" on page 2:119", },
{ "CR[TPR]", 27, 0, 7, 66, "SC Section 5.8.3.3, \"Task Priority Register (TPR - CR66)\" on page 2:119", },
{ "CR[TPR]", 27, 0, 1, 66, NULL, },
{ "CR%, % in 3-7, 10-15, 18, 26-63, 75-79, 82-127", 10, 0, 0, -1, NULL, },
{ "DBR#", 11, 0, 2, -1, NULL, },
@ -282,7 +282,7 @@ dependencies[] = {
{ "CPUID#", 7, 1, 0, -1, NULL, },
{ "CR[CMCV]", 27, 1, 2, 74, NULL, },
{ "CR[DCR]", 27, 1, 2, 0, NULL, },
{ "CR[EOI]", 27, 1, 7, 67, "SC Section 5.8.3.4, \"End of External Interrupt Register (EOI Ð CR67)\" on page 2:119", },
{ "CR[EOI]", 27, 1, 7, 67, "SC Section 5.8.3.4, \"End of External Interrupt Register (EOI - CR67)\" on page 2:119", },
{ "CR[GPTA]", 27, 1, 2, 9, NULL, },
{ "CR[IFA]", 27, 1, 2, 20, NULL, },
{ "CR[IFS]", 27, 1, 2, 23, NULL, },

View File

@ -1,3 +1,48 @@
2014-01-01 Thomas E. Dickey <tom@invisible-island.net>
* yacc.1: document %token-table, improve presentation of double-quotes
* VERSION, package/byacc.spec, package/debian/changelog: bump
* test/calc.tab.c, test/calc1.tab.c, test/calc2.tab.c, test/calc3.tab.c, test/code_calc.code.c, test/code_calc.tab.c, test/code_error.code.c, test/code_error.tab.c, test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/quote_calc-s.tab.c, test/quote_calc.tab.c, test/quote_calc2-s.tab.c, test/quote_calc2.tab.c, test/quote_calc3-s.tab.c, test/quote_calc3.tab.c, test/quote_calc4-s.tab.c, test/quote_calc4.tab.c:
regen
* output.c, skeleton.c:
amend the last change so that yytname is #define'd as needed rather than
permanent - to avoid breaking cproto for instance.
2014-01-01 Christos.Zoulas
* output.c, defs.h, main.c, reader.c, skeleton.c:
changes to build ntpd using byacc:
- rename yyname[] to yytname[]
- add YYTRANSLATE() macro
- recognize bison's %token-table declaration
2014-01-01 Thomas E. Dickey <tom@invisible-island.net>
* configure: regen
* yacc.1: s/EE/XE/ to work around groff bug on Debian 6
* makefile.in: use CF_MAKE_DOCS
* aclocal.m4: add CF_MAKE_DOCS
* configure.in: use CF_MAKE_DOCS
2013-12-26 Thomas E. Dickey <tom@invisible-island.net>
* config.guess: 2013-11-29
2013-11-19 Thomas E. Dickey <tom@invisible-island.net>
* aclocal.m4: resync with my-autoconf (fixes for clang and mingw)
2013-10-25 Thomas E. Dickey <tom@invisible-island.net>
* config.sub: 2013-10-01
2013-09-25 Thomas E. Dickey <tom@invisible-island.net>
* reader.c: fix two loop-limits found by clang 3.3 --analyze

View File

@ -1 +1 @@
20130925
20140101

View File

@ -1,7 +1,7 @@
dnl $Id: aclocal.m4,v 1.31 2013/09/25 23:15:41 tom Exp $
dnl $Id: aclocal.m4,v 1.33 2014/01/01 14:08:07 tom Exp $
dnl Macros for byacc configure script (Thomas E. Dickey)
dnl ---------------------------------------------------------------------------
dnl Copyright 2004-2012,2013 Thomas E. Dickey
dnl Copyright 2004-2013,2014 Thomas E. Dickey
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the
@ -232,7 +232,7 @@ if test ".$system_name" != ".$cf_cv_system_name" ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CLANG_COMPILER version: 1 updated: 2012/06/16 14:55:39
dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35
dnl -----------------
dnl Check if the given compiler is really clang. clang's C driver defines
dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
@ -243,7 +243,7 @@ dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
dnl the wrappers for gcc and g++ warnings.
dnl
dnl $1 = GCC (default) or GXX
dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
dnl $2 = CLANG_COMPILER (default)
dnl $3 = CFLAGS (default) or CXXFLAGS
AC_DEFUN([CF_CLANG_COMPILER],[
ifelse([$2],,CLANG_COMPILER,[$2])=no
@ -449,7 +449,7 @@ if test "$GCC" = yes ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39
dnl CF_GCC_WARNINGS version: 31 updated: 2013/11/19 19:23:35
dnl ---------------
dnl Check if the compiler supports useful warning options. There's a few that
dnl we don't use, simply because they're too noisy:
@ -521,10 +521,14 @@ then
EXTRA_CFLAGS=
cf_warn_CONST=""
test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
for cf_opt in W Wall \
Wbad-function-cast \
Wcast-align \
Wcast-qual \
Wdeclaration-after-statement \
Wextra \
Winline \
Wmissing-declarations \
Wmissing-prototypes \
@ -532,7 +536,7 @@ then
Wpointer-arith \
Wshadow \
Wstrict-prototypes \
Wundef $cf_warn_CONST $1
Wundef $cf_gcc_warnings $cf_warn_CONST $1
do
CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
if AC_TRY_EVAL(ac_compile); then
@ -634,6 +638,60 @@ cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MAKE_DOCS version: 2 updated: 2013/01/02 20:04:08
dnl ------------
dnl $1 = name(s) to generate rules for
dnl $2 = suffix of corresponding manpages used as input.
define([CF_MAKE_DOCS],[
test -z "$cf_make_docs" && cf_make_docs=0
cf_output=makefile
test -f "$cf_output" || cf_output=Makefile
if test "$cf_make_docs" = 0
then
cat >>$cf_output <<"CF_EOF"
################################################################################
.SUFFIXES : .html .$2 .man .ps .pdf .txt
.$2.html :
GROFF_NO_SGR=stupid [$](SHELL) -c "tbl [$]*.$2 | groff -P -o0 -I$*_ -Thtml -man" >[$]@
.$2.ps :
[$](SHELL) -c "tbl [$]*.$2 | groff -man" >[$]@
.$2.txt :
GROFF_NO_SGR=stupid [$](SHELL) -c "tbl [$]*.$2 | nroff -Tascii -man | col -bx" >[$]@
.ps.pdf :
ps2pdf [$]*.ps
CF_EOF
cf_make_docs=1
fi
for cf_name in $1
do
cat >>$cf_output <<CF_EOF
################################################################################
docs-$cf_name \\
docs :: $cf_name.html \\
$cf_name.pdf \\
$cf_name.ps \\
$cf_name.txt
clean \\
docs-clean ::
rm -f $cf_name.html $cf_name.pdf $cf_name.ps $cf_name.txt
$cf_name.html : $cf_name.$2
$cf_name.pdf : $cf_name.ps
$cf_name.ps : $cf_name.$2
$cf_name.txt : $cf_name.$2
CF_EOF
done
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
dnl ------------
dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
@ -671,7 +729,7 @@ AC_SUBST(MAKE_UPPER_TAGS)
AC_SUBST(MAKE_LOWER_TAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MIXEDCASE_FILENAMES version: 5 updated: 2013/09/07 13:54:05
dnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05
dnl ----------------------
dnl Check if the file-system supports mixed-case filenames. If we're able to
dnl create a lowercase name and see it as uppercase, it doesn't support that.
@ -680,7 +738,7 @@ AC_DEFUN([CF_MIXEDCASE_FILENAMES],
AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
if test "$cross_compiling" = yes ; then
case $target_alias in #(vi
*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw32*|*-uwin*) #(vi
*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi
cf_cv_mixedcase=no
;;
*)

View File

@ -2,7 +2,7 @@
# Attempt to guess a canonical system name.
# Copyright 1992-2013 Free Software Foundation, Inc.
timestamp='2013-06-10'
timestamp='2013-11-29'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -1260,16 +1260,26 @@ EOF
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
# that puts up a graphical alert prompting to install
# developer tools. Any system running Mac OS X 10.7 or
# later (Darwin 11 and later) is required to have a 64-bit
# processor. This is not true of the ARM version of Darwin
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;

View File

@ -2,7 +2,7 @@
# Configuration validation subroutine script.
# Copyright 1992-2013 Free Software Foundation, Inc.
timestamp='2013-09-05'
timestamp='2013-10-01'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -265,6 +265,7 @@ case $basic_machine in
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
@ -381,6 +382,7 @@ case $basic_machine in
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \

View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Revision: 1.14 .
# From configure.in Revision: 1.15 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by Autoconf 2.52.20121002.
#
@ -2112,7 +2112,7 @@ else
if test "$cross_compiling" = yes ; then
case $target_alias in #(vi
*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw32*|*-uwin*) #(vi
*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi
cf_cv_mixedcase=no
;;
*)
@ -4191,10 +4191,14 @@ echo "$as_me: checking for $CC warning options..." >&6;}
EXTRA_CFLAGS=
cf_warn_CONST=""
test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
for cf_opt in W Wall \
Wbad-function-cast \
Wcast-align \
Wcast-qual \
Wdeclaration-after-statement \
Wextra \
Winline \
Wmissing-declarations \
Wmissing-prototypes \
@ -4202,15 +4206,15 @@ echo "$as_me: checking for $CC warning options..." >&6;}
Wpointer-arith \
Wshadow \
Wstrict-prototypes \
Wundef $cf_warn_CONST Wwrite-strings
Wundef $cf_gcc_warnings $cf_warn_CONST Wwrite-strings
do
CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
if { (eval echo "$as_me:4208: \"$ac_compile\"") >&5
if { (eval echo "$as_me:4212: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:4211: \$? = $ac_status" >&5
echo "$as_me:4215: \$? = $ac_status" >&5
(exit $ac_status); }; then
test -n "$verbose" && echo "$as_me:4213: result: ... -$cf_opt" >&5
test -n "$verbose" && echo "$as_me:4217: result: ... -$cf_opt" >&5
echo "${ECHO_T}... -$cf_opt" >&6
case $cf_opt in #(vi
Wcast-qual) #(vi
@ -4221,7 +4225,7 @@ echo "${ECHO_T}... -$cf_opt" >&6
[34].*)
test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6
echo "${as_me:-configure}:4224: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
echo "${as_me:-configure}:4228: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
continue;;
esac
@ -4231,7 +4235,7 @@ echo "${as_me:-configure}:4224: testing feature is broken in gcc $GCC_VERSION ..
[12].*)
test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6
echo "${as_me:-configure}:4234: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
echo "${as_me:-configure}:4238: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
continue;;
esac
@ -4247,7 +4251,7 @@ rm -rf conftest*
fi
fi
echo "$as_me:4250: checking if you want to see long compiling messages" >&5
echo "$as_me:4254: checking if you want to see long compiling messages" >&5
echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6
# Check whether --enable-echo or --disable-echo was given.
@ -4281,10 +4285,10 @@ else
ECHO_CC=''
fi;
echo "$as_me:4284: result: $enableval" >&5
echo "$as_me:4288: result: $enableval" >&5
echo "${ECHO_T}$enableval" >&6
echo "$as_me:4287: checking if you want to use dmalloc for testing" >&5
echo "$as_me:4291: checking if you want to use dmalloc for testing" >&5
echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6
# Check whether --with-dmalloc or --without-dmalloc was given.
@ -4301,7 +4305,7 @@ EOF
else
with_dmalloc=
fi;
echo "$as_me:4304: result: ${with_dmalloc:-no}" >&5
echo "$as_me:4308: result: ${with_dmalloc:-no}" >&5
echo "${ECHO_T}${with_dmalloc:-no}" >&6
case .$with_cflags in #(vi
@ -4395,23 +4399,23 @@ fi
esac
if test "$with_dmalloc" = yes ; then
echo "$as_me:4398: checking for dmalloc.h" >&5
echo "$as_me:4402: checking for dmalloc.h" >&5
echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6
if test "${ac_cv_header_dmalloc_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line 4404 "configure"
#line 4408 "configure"
#include "confdefs.h"
#include <dmalloc.h>
_ACEOF
if { (eval echo "$as_me:4408: \"$ac_cpp conftest.$ac_ext\"") >&5
if { (eval echo "$as_me:4412: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
egrep -v '^ *\+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:4414: \$? = $ac_status" >&5
echo "$as_me:4418: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
@ -4430,11 +4434,11 @@ else
fi
rm -f conftest.err conftest.$ac_ext
fi
echo "$as_me:4433: result: $ac_cv_header_dmalloc_h" >&5
echo "$as_me:4437: result: $ac_cv_header_dmalloc_h" >&5
echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6
if test $ac_cv_header_dmalloc_h = yes; then
echo "$as_me:4437: checking for dmalloc_debug in -ldmalloc" >&5
echo "$as_me:4441: checking for dmalloc_debug in -ldmalloc" >&5
echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6
if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@ -4442,7 +4446,7 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldmalloc $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line 4445 "configure"
#line 4449 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
@ -4461,16 +4465,16 @@ dmalloc_debug ();
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:4464: \"$ac_link\"") >&5
if { (eval echo "$as_me:4468: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:4467: \$? = $ac_status" >&5
echo "$as_me:4471: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:4470: \"$ac_try\"") >&5
{ (eval echo "$as_me:4474: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:4473: \$? = $ac_status" >&5
echo "$as_me:4477: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_dmalloc_dmalloc_debug=yes
else
@ -4481,7 +4485,7 @@ fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:4484: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5
echo "$as_me:4488: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5
echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6
if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then
cat >>confdefs.h <<EOF
@ -4496,7 +4500,7 @@ fi
fi
echo "$as_me:4499: checking if you want to use dbmalloc for testing" >&5
echo "$as_me:4503: checking if you want to use dbmalloc for testing" >&5
echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6
# Check whether --with-dbmalloc or --without-dbmalloc was given.
@ -4513,7 +4517,7 @@ EOF
else
with_dbmalloc=
fi;
echo "$as_me:4516: result: ${with_dbmalloc:-no}" >&5
echo "$as_me:4520: result: ${with_dbmalloc:-no}" >&5
echo "${ECHO_T}${with_dbmalloc:-no}" >&6
case .$with_cflags in #(vi
@ -4607,23 +4611,23 @@ fi
esac
if test "$with_dbmalloc" = yes ; then
echo "$as_me:4610: checking for dbmalloc.h" >&5
echo "$as_me:4614: checking for dbmalloc.h" >&5
echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6
if test "${ac_cv_header_dbmalloc_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line 4616 "configure"
#line 4620 "configure"
#include "confdefs.h"
#include <dbmalloc.h>
_ACEOF
if { (eval echo "$as_me:4620: \"$ac_cpp conftest.$ac_ext\"") >&5
if { (eval echo "$as_me:4624: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
egrep -v '^ *\+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:4626: \$? = $ac_status" >&5
echo "$as_me:4630: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
@ -4642,11 +4646,11 @@ else
fi
rm -f conftest.err conftest.$ac_ext
fi
echo "$as_me:4645: result: $ac_cv_header_dbmalloc_h" >&5
echo "$as_me:4649: result: $ac_cv_header_dbmalloc_h" >&5
echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6
if test $ac_cv_header_dbmalloc_h = yes; then
echo "$as_me:4649: checking for debug_malloc in -ldbmalloc" >&5
echo "$as_me:4653: checking for debug_malloc in -ldbmalloc" >&5
echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6
if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@ -4654,7 +4658,7 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldbmalloc $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line 4657 "configure"
#line 4661 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
@ -4673,16 +4677,16 @@ debug_malloc ();
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:4676: \"$ac_link\"") >&5
if { (eval echo "$as_me:4680: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:4679: \$? = $ac_status" >&5
echo "$as_me:4683: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:4682: \"$ac_try\"") >&5
{ (eval echo "$as_me:4686: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:4685: \$? = $ac_status" >&5
echo "$as_me:4689: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_dbmalloc_debug_malloc=yes
else
@ -4693,7 +4697,7 @@ fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:4696: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5
echo "$as_me:4700: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5
echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6
if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then
cat >>confdefs.h <<EOF
@ -4708,7 +4712,7 @@ fi
fi
echo "$as_me:4711: checking if you want to use valgrind for testing" >&5
echo "$as_me:4715: checking if you want to use valgrind for testing" >&5
echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6
# Check whether --with-valgrind or --without-valgrind was given.
@ -4725,7 +4729,7 @@ EOF
else
with_valgrind=
fi;
echo "$as_me:4728: result: ${with_valgrind:-no}" >&5
echo "$as_me:4732: result: ${with_valgrind:-no}" >&5
echo "${ECHO_T}${with_valgrind:-no}" >&6
case .$with_cflags in #(vi
@ -4818,7 +4822,7 @@ fi
;;
esac
echo "$as_me:4821: checking if you want to perform memory-leak testing" >&5
echo "$as_me:4825: checking if you want to perform memory-leak testing" >&5
echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6
# Check whether --enable-leaks or --disable-leaks was given.
@ -4828,7 +4832,7 @@ if test "${enable_leaks+set}" = set; then
else
: ${with_no_leaks:=no}
fi;
echo "$as_me:4831: result: $with_no_leaks" >&5
echo "$as_me:4835: result: $with_no_leaks" >&5
echo "${ECHO_T}$with_no_leaks" >&6
if test "$with_no_leaks" = yes ; then
@ -4924,7 +4928,7 @@ DEFS=-DHAVE_CONFIG_H
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ echo "$as_me:4927: creating $CONFIG_STATUS" >&5
{ echo "$as_me:4931: creating $CONFIG_STATUS" >&5
echo "$as_me: creating $CONFIG_STATUS" >&6;}
cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL
@ -5097,7 +5101,7 @@ cat >>$CONFIG_STATUS <<\EOF
echo "$ac_cs_version"; exit 0 ;;
--he | --h)
# Conflict between --help and --header
{ { echo "$as_me:5100: error: ambiguous option: $1
{ { echo "$as_me:5104: error: ambiguous option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: ambiguous option: $1
Try \`$0 --help' for more information." >&2;}
@ -5116,7 +5120,7 @@ Try \`$0 --help' for more information." >&2;}
ac_need_defaults=false;;
# This is an error.
-*) { { echo "$as_me:5119: error: unrecognized option: $1
-*) { { echo "$as_me:5123: error: unrecognized option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: unrecognized option: $1
Try \`$0 --help' for more information." >&2;}
@ -5153,7 +5157,7 @@ do
# Handling of arguments.
"makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;;
"config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config_h.in" ;;
*) { { echo "$as_me:5156: error: invalid argument: $ac_config_target" >&5
*) { { echo "$as_me:5160: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
@ -5386,7 +5390,7 @@ done; }
esac
if test x"$ac_file" != x-; then
{ echo "$as_me:5389: creating $ac_file" >&5
{ echo "$as_me:5393: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
rm -f "$ac_file"
fi
@ -5404,7 +5408,7 @@ echo "$as_me: creating $ac_file" >&6;}
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:5407: error: cannot find input file: $f" >&5
test -f "$f" || { { echo "$as_me:5411: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
@ -5417,7 +5421,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
echo $srcdir/$f
else
# /dev/null tree
{ { echo "$as_me:5420: error: cannot find input file: $f" >&5
{ { echo "$as_me:5424: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
@ -5433,7 +5437,7 @@ cat >>$CONFIG_STATUS <<\EOF
if test -n "$ac_seen"; then
ac_used=`grep '@datarootdir@' $ac_item`
if test -z "$ac_used"; then
{ echo "$as_me:5436: WARNING: datarootdir was used implicitly but not set:
{ echo "$as_me:5440: WARNING: datarootdir was used implicitly but not set:
$ac_seen" >&5
echo "$as_me: WARNING: datarootdir was used implicitly but not set:
$ac_seen" >&2;}
@ -5442,7 +5446,7 @@ $ac_seen" >&2;}
fi
ac_seen=`grep '${datarootdir}' $ac_item`
if test -n "$ac_seen"; then
{ echo "$as_me:5445: WARNING: datarootdir was used explicitly but not set:
{ echo "$as_me:5449: WARNING: datarootdir was used explicitly but not set:
$ac_seen" >&5
echo "$as_me: WARNING: datarootdir was used explicitly but not set:
$ac_seen" >&2;}
@ -5479,7 +5483,7 @@ s,@INSTALL@,$ac_INSTALL,;t t
ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file`
if test -z "$ac_init"; then
ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'`
{ echo "$as_me:5482: WARNING: Variable $ac_name is used but was not set:
{ echo "$as_me:5486: WARNING: Variable $ac_name is used but was not set:
$ac_seen" >&5
echo "$as_me: WARNING: Variable $ac_name is used but was not set:
$ac_seen" >&2;}
@ -5490,7 +5494,7 @@ $ac_seen" >&2;}
egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out
if test -s $tmp/out; then
ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out`
{ echo "$as_me:5493: WARNING: Some variables may not be substituted:
{ echo "$as_me:5497: WARNING: Some variables may not be substituted:
$ac_seen" >&5
echo "$as_me: WARNING: Some variables may not be substituted:
$ac_seen" >&2;}
@ -5539,7 +5543,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
* ) ac_file_in=$ac_file.in ;;
esac
test x"$ac_file" != x- && { echo "$as_me:5542: creating $ac_file" >&5
test x"$ac_file" != x- && { echo "$as_me:5546: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
# First look for the input files in the build tree, otherwise in the
@ -5550,7 +5554,7 @@ echo "$as_me: creating $ac_file" >&6;}
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:5553: error: cannot find input file: $f" >&5
test -f "$f" || { { echo "$as_me:5557: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
@ -5563,7 +5567,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
echo $srcdir/$f
else
# /dev/null tree
{ { echo "$as_me:5566: error: cannot find input file: $f" >&5
{ { echo "$as_me:5570: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
@ -5681,7 +5685,7 @@ cat >>$CONFIG_STATUS <<\EOF
rm -f $tmp/in
if test x"$ac_file" != x-; then
if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
{ echo "$as_me:5684: $ac_file is unchanged" >&5
{ echo "$as_me:5688: $ac_file is unchanged" >&5
echo "$as_me: $ac_file is unchanged" >&6;}
else
ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
@ -5748,3 +5752,51 @@ if test "$no_create" != yes; then
$ac_cs_success || { (exit 1); exit 1; }
fi
test -z "$cf_make_docs" && cf_make_docs=0
cf_output=makefile
test -f "$cf_output" || cf_output=Makefile
if test "$cf_make_docs" = 0
then
cat >>$cf_output <<"CF_EOF"
################################################################################
.SUFFIXES : .html .1 .man .ps .pdf .txt
.1.html :
GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.1 | groff -P -o0 -Iyacc,1_ -Thtml -man" >$@
.1.ps :
$(SHELL) -c "tbl $*.1 | groff -man" >$@
.1.txt :
GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.1 | nroff -Tascii -man | col -bx" >$@
.ps.pdf :
ps2pdf $*.ps
CF_EOF
cf_make_docs=1
fi
for cf_name in yacc
do
cat >>$cf_output <<CF_EOF
################################################################################
docs-$cf_name \\
docs :: $cf_name.html \\
$cf_name.pdf \\
$cf_name.ps \\
$cf_name.txt
clean \\
docs-clean ::
rm -f $cf_name.html $cf_name.pdf $cf_name.ps $cf_name.txt
$cf_name.html : $cf_name.1
$cf_name.pdf : $cf_name.ps
$cf_name.ps : $cf_name.1
$cf_name.txt : $cf_name.1
CF_EOF
done

View File

@ -1,7 +1,7 @@
dnl Process this file with 'autoconf' to produce a 'configure' script
dnl $Id: configure.in,v 1.14 2012/10/03 23:41:36 tom Exp $
dnl $Id: configure.in,v 1.15 2014/01/01 14:07:34 tom Exp $
AC_PREREQ(2.52.20011201)
AC_REVISION($Revision: 1.14 $)
AC_REVISION($Revision: 1.15 $)
AC_INIT(main.c)
AC_CONFIG_HEADER(config.h:config_h.in)
@ -24,3 +24,4 @@ CF_DISABLE_LEAKS
### output makefile
AC_OUTPUT(makefile)
CF_MAKE_DOCS(yacc,1)

View File

@ -1,4 +1,4 @@
/* $Id: defs.h,v 1.37 2012/05/26 15:23:00 tom Exp $ */
/* $Id: defs.h,v 1.38 2014/01/01 14:23:27 Christos.Zoulas Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -104,6 +104,7 @@
#define PARSE_PARAM 13
#define LEX_PARAM 14
#define POSIX_YACC 15
#define TOKEN_TABLE 16
/* symbol classes */
@ -248,6 +249,7 @@ extern int lineno;
extern int outline;
extern int exit_code;
extern int pure_parser;
extern int token_table;
extern const char *const banner[];
extern const char *const xdecls[];

View File

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.40 2012/09/29 13:11:00 Adrian.Bunk Exp $ */
/* $Id: main.c,v 1.41 2014/01/01 14:23:27 Christos.Zoulas Exp $ */
#include <signal.h>
#include <unistd.h> /* for _exit() */
@ -87,6 +87,7 @@ short *symbol_prec;
char *symbol_assoc;
int pure_parser;
int token_table;
int exit_code;
Value_t *ritem;

View File

@ -1,4 +1,4 @@
# $Id: makefile.in,v 1.18 2012/09/29 13:10:15 Adrian.Bunk Exp $
# $Id: makefile.in,v 1.19 2014/01/01 14:09:43 tom Exp $
#
# UNIX template-makefile for Berkeley Yacc
@ -100,7 +100,7 @@ uninstall:
- rm -f $(mandir)/$(actual_man)
################################################################################
.SUFFIXES : $o .i .html .$(manext) .cat .ps .pdf .txt
.SUFFIXES : $o .i
.c$o:
@RULE_CC@
@ -110,21 +110,6 @@ uninstall:
@RULE_CC@
@ECHO_CC@$(CPP) -C $(CPPFLAGS) $*.c >$@
.$(manext).cat :
- nroff -man $(srcdir)/$(THIS).$(manext) >$@
.$(manext).html :
GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | groff -Thtml -man" >$@
.$(manext).ps :
$(SHELL) -c "tbl $*.$(manext) | groff -man" >$@
.$(manext).txt :
GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | nroff -Tascii -man | col -bx" >$@
.ps.pdf :
ps2pdf $*.ps
################################################################################
$(THIS)$x : $(OBJS)
@ -133,26 +118,16 @@ $(THIS)$x : $(OBJS)
mostlyclean :
- rm -f core .nfs* *$o *.bak *.BAK *.out
clean : mostlyclean
clean :: mostlyclean
- rm -f $(THIS)$x
distclean : clean
distclean :: clean
- rm -f config.log config.cache config.status config.h makefile
- rm -f *.html *.cat *.pdf *.ps *.txt
- cd test && rm -f test-*
realclean: distclean
realclean :: distclean
- rm -f tags TAGS
################################################################################
docs :: $(THIS).html \
$(THIS).pdf \
$(THIS).ps \
$(THIS).txt
$(THIS).html : $(THIS).$(manext)
$(THIS).pdf : $(THIS).ps
$(THIS).ps : $(THIS).$(manext)
$(THIS).txt : $(THIS).$(manext)
################################################################################
check: $(THIS)$x
$(SHELL) $(testdir)/run_test.sh $(testdir)

View File

@ -1,4 +1,4 @@
/* $Id: output.c,v 1.45 2013/03/05 00:29:17 tom Exp $ */
/* $Id: output.c,v 1.47 2014/01/01 17:22:38 tom Exp $ */
#include "defs.h"
@ -921,23 +921,42 @@ output_debug(void)
++outline;
fprintf(code_file, "#define YYMAXTOKEN %d\n", max);
fprintf(code_file, "#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? "
"(YYMAXTOKEN + 1) : (a))\n");
symnam = TMALLOC(const char *, max + 1);
symnam = TMALLOC(const char *, max + 2);
NO_SPACE(symnam);
/* Note that it is not necessary to initialize the element */
/* symnam[max]. */
for (i = 0; i < max; ++i)
for (i = 0; i <= max; ++i)
symnam[i] = 0;
for (i = ntokens - 1; i >= 2; --i)
symnam[symbol_value[i]] = symbol_name[i];
symnam[0] = "end-of-file";
symnam[max + 1] = "illegal-symbol";
output_line("#if YYDEBUG");
/*
* bison's yytname[] array is roughly the same as byacc's yyname[] array.
* The difference is that byacc does not predefine "$end", "$error" or
* "$undefined".
*
* If the grammar declares "%token-table", define symbol "yytname" so
* an application such as ntpd can build.
*/
if (token_table)
{
output_line("#undef yytname");
output_line("#define yytname yyname");
}
else
{
output_line("#if YYDEBUG");
}
start_str_table("name");
j = 80;
for (i = 0; i <= max; ++i)
for (i = 0; i <= max + 1; ++i)
{
if ((s = symnam[i]) != 0)
{
@ -1058,6 +1077,8 @@ output_debug(void)
end_table();
FREE(symnam);
if (token_table)
output_line("#if YYDEBUG");
start_str_table("rule");
for (i = 2; i < nrules; ++i)
{

View File

@ -1,8 +1,8 @@
Summary: byacc - public domain Berkeley LALR Yacc parser generator
%define AppProgram byacc
%define AppVersion 20130925
%define AppVersion 20140101
%define UseProgram yacc
# $XTermId: byacc.spec,v 1.17 2013/09/25 22:41:54 tom Exp $
# $XTermId: byacc.spec,v 1.18 2014/01/01 17:26:25 tom Exp $
Name: %{AppProgram}
Version: %{AppVersion}
Release: 1

View File

@ -1,3 +1,9 @@
byacc (20140101) unstable; urgency=low
* yytname[] changes
-- Thomas E. Dickey <dickey@invisible-island.net> Wed, 01 Jan 2014 10:02:12 -0500
byacc (20130925) unstable; urgency=low
* increase default stack-size

View File

@ -1,4 +1,4 @@
/* $Id: reader.c,v 1.37 2013/09/25 23:46:18 tom Exp $ */
/* $Id: reader.c,v 1.38 2014/01/01 14:23:27 Christos.Zoulas Exp $ */
#include "defs.h"
@ -317,6 +317,8 @@ keyword(void)
return (PARSE_PARAM);
if (matchec("lex-param"))
return (LEX_PARAM);
if (matchec("token-table"))
return (TOKEN_TABLE);
if (matchec("yacc"))
return (POSIX_YACC);
}
@ -1302,6 +1304,10 @@ read_declarations(void)
copy_param(k);
break;
case TOKEN_TABLE:
token_table = 1;
break;
case POSIX_YACC:
/* noop for bison compatibility. byacc is already designed to be posix
* yacc compatible. */

View File

@ -1,4 +1,4 @@
/* $Id: skeleton.c,v 1.33 2013/09/25 22:44:22 tom Exp $ */
/* $Id: skeleton.c,v 1.35 2014/01/01 16:52:33 tom Exp $ */
#include "defs.h"
@ -231,9 +231,7 @@ const char *const body_2[] =
"#if YYDEBUG",
" if (yydebug)",
" {",
" yys = 0;",
" if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
" if (!yys) yys = \"illegal-symbol\";",
" yys = yyname[YYTRANSLATE(yychar)];",
" printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
" YYPREFIX, yystate, yychar, yys);",
" }",
@ -320,9 +318,7 @@ const char *const body_3[] =
"#if YYDEBUG",
" if (yydebug)",
" {",
" yys = 0;",
" if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
" if (!yys) yys = \"illegal-symbol\";",
" yys = yyname[YYTRANSLATE(yychar)];",
" printf(\"%sdebug: state %d, error recovery discards token %d\
(%s)\\n\",",
" YYPREFIX, yystate, yychar, yys);",
@ -371,9 +367,7 @@ const char *const trailer[] =
"#if YYDEBUG",
" if (yydebug)",
" {",
" yys = 0;",
" if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
" if (!yys) yys = \"illegal-symbol\";",
" yys = yyname[YYTRANSLATE(yychar)];",
" printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
" YYPREFIX, YYFINAL, yychar, yys);",
" }",

View File

@ -232,6 +232,7 @@ static const short calc_check[] = { 40,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 259
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -242,7 +243,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",
0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -441,9 +442,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -525,9 +524,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -609,7 +606,7 @@ case 18:
#line 63 "calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 613 "calc.tab.c"
#line 609 "calc.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -631,9 +628,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -272,6 +272,7 @@ static const short calc1_check[] = { 40,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 260
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -282,7 +283,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,"DREG","VREG","CONST","UMINUS",
0,0,"DREG","VREG","CONST","UMINUS","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : line",
@ -580,9 +581,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -664,9 +663,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -851,7 +848,7 @@ case 28:
yyval.vval = yystack.l_mark[-1].vval;
}
break;
#line 855 "calc1.tab.c"
#line 851 "calc1.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -873,9 +870,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -234,6 +234,7 @@ static const short calc2_check[] = { 40,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 259
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -244,7 +245,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",
0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -450,9 +451,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -534,9 +533,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -618,7 +615,7 @@ case 18:
#line 70 "calc2.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 622 "calc2.tab.c"
#line 618 "calc2.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -640,9 +637,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -239,6 +239,7 @@ static const short calc3_check[] = { 40,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 259
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -249,7 +250,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",
0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -455,9 +456,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -539,9 +538,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -623,7 +620,7 @@ case 18:
#line 73 "calc3.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 627 "calc3.tab.c"
#line 623 "calc3.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -645,9 +642,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -73,6 +73,7 @@ extern int YYPARSE_DECL();
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 259
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#ifndef yyparse
#define yyparse calc_parse
@ -348,9 +349,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -432,9 +431,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -516,7 +513,7 @@ case 18:
#line 65 "code_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 520 "code_calc.code.c"
#line 516 "code_calc.code.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -538,9 +535,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -172,7 +172,7 @@ const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",
0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol",
};
const char *yyrule[] = {
"$accept : list",

View File

@ -65,6 +65,7 @@ extern int YYPARSE_DECL();
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 0
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#ifndef yyparse
#define yyparse error_parse
@ -320,9 +321,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -404,9 +403,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -449,9 +446,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -108,7 +108,7 @@ const short error_check[] = { 256,
#if YYDEBUG
const char *yyname[] = {
"end-of-file",
"end-of-file","illegal-symbol",
};
const char *yyrule[] = {
"$accept : S",

View File

@ -165,10 +165,11 @@ static const short error_check[] = { 256,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 0
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
"end-of-file",
"end-of-file","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : S",
@ -330,9 +331,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -414,9 +413,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -459,9 +456,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -448,6 +448,7 @@ static const short ftp_check[] = { 89,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 319
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -462,7 +463,7 @@ static const char *yyname[] = {
"QUIT","PORT","PASV","TYPE","STRU","MODE","RETR","STOR","APPE","MLFL","MAIL",
"MSND","MSOM","MSAM","MRSQ","MRCP","ALLO","REST","RNFR","RNTO","ABOR","DELE",
"CWD","LIST","NLST","SITE","STAT","HELP","NOOP","MKD","RMD","PWD","CDUP","STOU",
"SMNT","SYST","SIZE","MDTM","UMASK","IDLE","CHMOD","LEXERR",
"SMNT","SYST","SIZE","MDTM","UMASK","IDLE","CHMOD","LEXERR","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : cmd_list",
@ -1197,9 +1198,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -1281,9 +1280,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -1946,7 +1943,7 @@ case 73:
}
}
break;
#line 1950 "ftp.tab.c"
#line 1946 "ftp.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -1968,9 +1965,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -740,6 +740,7 @@ static const short grammar_check[] = { 38,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 291
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -756,6 +757,7 @@ static const char *yyname[] = {
"T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary",
"T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS",
"T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL",
"illegal-symbol",
};
static const char *yyrule[] = {
"$accept : program",
@ -1081,7 +1083,7 @@ free_parser(void)
#endif
}
#endif
#line 1085 "grammar.tab.c"
#line 1086 "grammar.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
@ -1179,9 +1181,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -1263,9 +1263,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -1961,7 +1959,7 @@ case 114:
yyval.declarator->func_def = FUNC_ANSI;
}
break;
#line 1965 "grammar.tab.c"
#line 1962 "grammar.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -1983,9 +1981,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -242,6 +242,7 @@ static const short calc_check[] = { 40,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 259
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -252,7 +253,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",
0,0,0,0,0,0,"DIGIT","LETTER","UMINUS","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -455,9 +456,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -539,9 +538,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -623,7 +620,7 @@ case 18:
#line 69 "pure_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 627 "pure_calc.tab.c"
#line 623 "pure_calc.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -645,9 +642,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -177,10 +177,11 @@ static const short error_check[] = { 256,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 0
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
"end-of-file",
"end-of-file","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : S",
@ -346,9 +347,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -430,9 +429,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -475,9 +472,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -246,6 +246,7 @@ static const short quote_calc_check[] = { 10,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 271
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -258,6 +259,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
"illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -357,7 +359,7 @@ yylex(void) {
}
return( c );
}
#line 361 "quote_calc-s.tab.c"
#line 362 "quote_calc-s.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
@ -455,9 +457,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -539,9 +539,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -623,7 +621,7 @@ case 18:
#line 70 "quote_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 627 "quote_calc-s.tab.c"
#line 624 "quote_calc-s.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -645,9 +643,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -252,6 +252,7 @@ static const short quote_calc_check[] = { 10,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 271
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -264,6 +265,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
"illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -363,7 +365,7 @@ yylex(void) {
}
return( c );
}
#line 367 "quote_calc.tab.c"
#line 368 "quote_calc.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
@ -461,9 +463,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -545,9 +545,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -629,7 +627,7 @@ case 18:
#line 70 "quote_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 633 "quote_calc.tab.c"
#line 630 "quote_calc.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -651,9 +649,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -246,6 +246,7 @@ static const short quote_calc2_check[] = { 10,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 271
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -258,6 +259,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
"illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -357,7 +359,7 @@ yylex(void) {
}
return( c );
}
#line 361 "quote_calc2-s.tab.c"
#line 362 "quote_calc2-s.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
@ -455,9 +457,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -539,9 +539,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -623,7 +621,7 @@ case 18:
#line 70 "quote_calc2.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 627 "quote_calc2-s.tab.c"
#line 624 "quote_calc2-s.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -645,9 +643,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -252,6 +252,7 @@ static const short quote_calc2_check[] = { 10,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 271
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -264,6 +265,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
"illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -363,7 +365,7 @@ yylex(void) {
}
return( c );
}
#line 367 "quote_calc2.tab.c"
#line 368 "quote_calc2.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
@ -461,9 +463,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -545,9 +545,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -629,7 +627,7 @@ case 18:
#line 70 "quote_calc2.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 633 "quote_calc2.tab.c"
#line 630 "quote_calc2.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -651,9 +649,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -246,6 +246,7 @@ static const short quote_calc3_check[] = { 10,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 271
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -258,7 +259,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -456,9 +457,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -540,9 +539,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -624,7 +621,7 @@ case 18:
#line 70 "quote_calc3.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 628 "quote_calc3-s.tab.c"
#line 624 "quote_calc3-s.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -646,9 +643,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -246,6 +246,7 @@ static const short quote_calc3_check[] = { 10,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 271
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -258,7 +259,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -456,9 +457,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -540,9 +539,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -624,7 +621,7 @@ case 18:
#line 70 "quote_calc3.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 628 "quote_calc3.tab.c"
#line 624 "quote_calc3.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -646,9 +643,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -246,6 +246,7 @@ static const short quote_calc4_check[] = { 10,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 271
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -258,7 +259,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -456,9 +457,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -540,9 +539,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -624,7 +621,7 @@ case 18:
#line 70 "quote_calc4.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 628 "quote_calc4-s.tab.c"
#line 624 "quote_calc4-s.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -646,9 +643,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -246,6 +246,7 @@ static const short quote_calc4_check[] = { 10,
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 271
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
#if YYDEBUG
static const char *yyname[] = {
@ -258,7 +259,7 @@ static const char *yyname[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","illegal-symbol",
};
static const char *yyrule[] = {
"$accept : list",
@ -456,9 +457,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -540,9 +539,7 @@ YYPARSE_DECL()
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
@ -624,7 +621,7 @@ case 18:
#line 70 "quote_calc4.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
#line 628 "quote_calc4.tab.c"
#line 624 "quote_calc4.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
@ -646,9 +643,7 @@ break;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
yys = yyname[YYTRANSLATE(yychar)];
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}

View File

@ -1,4 +1,4 @@
.\" $Id: yacc.1,v 1.18 2012/01/15 18:12:28 tom Exp $
.\" $Id: yacc.1,v 1.20 2014/01/01 17:40:13 tom Exp $
.\"
.\" .TH YACC 1 "July\ 15,\ 1990"
.\" .UC 6
@ -8,15 +8,22 @@
.sp
.in +4
..
.de EE
.de XE
.in -4
.fi
..
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds AQ \(aq
.el .ds AQ '
.ie \n(.g .ds `` \(lq
.el .ds `` ``
.ie \n(.g .ds '' \(rq
.el .ds '' ''
.\" Bulleted paragraph
.de bP
.IP \(bu 4
..
.TH YACC 1 "September 7, 2011" "Berkeley Yacc" "User Commands"
.TH YACC 1 "January 1, 2014" "Berkeley Yacc" "User Commands"
.SH NAME
Yacc \- an LALR(1) parser generator
.SH SYNOPSIS
@ -105,30 +112,31 @@ The default prefix is the string
.BR yy.
.TP
.B \-P
create a reentrant parser, e.g., "%pure-parser".
create a reentrant parser, e.g., \*(``%pure-parser\*(''.
.TP
.B \-r
The
.B \-r
option causes
.B yacc
to produce separate files for code and tables. The code file
is named
to produce separate files for code and tables.
The code file is named
.IR y.code.c,
and the tables file is named
.IR y.tab.c.
The prefix "\fIy.\fP" can be overridden using the \fB\-b\fP option.
The prefix \*(``\fIy.\fP\*('' can be overridden using the \fB\-b\fP option.
.TP
.B \-s
suppress "\fB#define\fP" statements generated for string literals in
a "\fB%token\fP" statement, to more closely match original \fByacc\fP behavior.
suppress \*(``\fB#define\fP\*('' statements generated for string literals in
a \*(``\fB%token\fP\*('' statement,
to more closely match original \fByacc\fP behavior.
.IP
Normally when \fByacc\fP sees a line such as
.ES
%token OP_ADD "ADD"
.EE
.XE
.IP
it notices that the quoted "ADD" is a valid C identifier,
it notices that the quoted \*(``ADD\*('' is a valid C identifier,
and generates a #define not only for OP_ADD,
but for ADD as well,
e.g.,
@ -136,12 +144,13 @@ e.g.,
#define OP_ADD 257
.br
#define ADD 258
.EE
.XE
.IP
The original \fByacc\fP does not generate the second "\fB#define\fP".
The \fB\-s\fP option suppresses this "\fB#define\fP".
The original \fByacc\fP does not generate the second \*(``\fB#define\fP\*(''.
The \fB\-s\fP option suppresses this \*(``\fB#define\fP\*(''.
.IP
POSIX (IEEE 1003.1 2004) documents only names and numbers for "\fB%token\fP",
POSIX (IEEE 1003.1 2004) documents only names and numbers
for \*(``\fB%token\fP\*('',
though original \fByacc\fP and bison also accept string literals.
.TP
.B \-t
@ -166,8 +175,8 @@ print the version number to the standard output.
which bison supports for ostensible POSIX compatibility.
.SH EXTENSIONS
.B yacc
provides some extensions for compatibility with bison and other implementations
of yacc:
provides some extensions for
compatibility with bison and other implementations of yacc:
.TP
\fB %expect\fP \fInumber\fP
tell \fByacc\fP the expected number of shift/reduce conflicts.
@ -190,6 +199,13 @@ Use this directive to add parameter declarations for your customized parser.
Most variables (other than \fByydebug\fP and \fByynerrs\fP) are
allocated on the stack within \fByyparse\fP, making the parser reasonably
reentrant.
.TP
\fB %token-table\fP
Make the parser's names for tokens available in the \fByytname\fP array.
However,
.B yacc
does not predefine \*(``$end\*('', \*(``$error\*(''
or \*(``$undefined\*('' in this array.
.SH PORTABILITY
According to Robert Corbett,
.ES
@ -198,12 +214,12 @@ as compatible as possible with AT&T Yacc. Berkeley Yacc can accept any input
specification that conforms to the AT&T Yacc documentation. Specifications
that take advantage of undocumented features of AT&T Yacc will probably be
rejected.
.EE
.XE
.PP
The rationale in
.ES
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/yacc.html
.EE
.XE
.PP
documents some features of AT&T yacc which are no longer required for POSIX
compliance.
@ -220,19 +236,19 @@ of an action (as in the original grammar file \fBftp.y\fP):
= {
statcmd();
}
.EE
.XE
.bP
\fBYacc\fP and bison emit code in different order, and in particular bison
makes forward reference to common functions such as yylex, yyparse and
yyerror without providing prototypes.
.bP
Bison's support for "%expect" is broken in more than one release.
Bison's support for \*(``%expect\*('' is broken in more than one release.
For best results using bison, delete that directive.
.bP
Bison has no equivalent for some of \fByacc\fP's commmand-line options,
relying on directives embedded in the grammar file.
.bP
Bison's "\fB\-y\fP" option does not affect bison's lack of support for
Bison's \*(``\fB\-y\fP\*('' option does not affect bison's lack of support for
features of AT&T yacc which were deemed obsolescent.
.
.SH DIAGNOSTICS

View File

@ -73,6 +73,6 @@ and
.B diff3
programs are properly installed at your site, the command
.IP
.B info diff
.B info diff3
.PP
should give you access to the complete manual.

View File

@ -1,8 +1,908 @@
006-02-15 Fariborz Jahanian <fjahanian@apple.com>
2010-03-16 Fariborz Jahanian <fjahanian@apple.com>
Radar 7760213
* c-common.h (HasByrefArray): New decl.
* c-common.c (HasByrefArray): New definition.
* c-typeck.c (build_external_ref): Diagnose access of
__block array.
2010-03-12 Jim Grosbach <grosbach@apple.com>
Radar 7744816
* expmed.c (synth_mult): Remove incorrect special case handling for
0xffffffff.
2010-03-12 Fariborz Jahanian <fjahanian@apple.com>
Radar 7735196
* c-parser.c (build_block_struct_initlist):
Set BLOCK_USE_STRET flag in block descriptor for
blocks which return their aggregate value in memory.
* c-common.h (BLOCK_USE_STRET): New flag.
2010-03-05 Fariborz Jahanian <fjahanian@apple.com>
Radar 7721728
* c-typeck.c (build_external_ref): Diagnose
importation of copied-in variables.
2009-03-12 Caroline Tice <ctice@apple.com>
Radar 6144634
* c-parser.c (c_parser_statement_after_labels): When
re-setting the expression location at the end, use the input
location for Block pointer assignments.
2009-02-11 Fariborz Jahanian <fjahanian@apple.com>
Radar 6573923
* c-decl.c (synth_block_byref_id_object_copy_func,
synth_block_byref_id_object_dispose_func): Set BLOCK_BYREF_CALLER
flag in call to copy/dispose helper functions.
* c-common.h (BLOCK_BYREF_CALLER): New flag.
2008-12-21 Caroline Tice <ctice@apple.com>
Radar 6455678
* cp/typeck.c (original_type): Stop if the type
and its DECL_ORIGINAL_TYPE are the same.
2008-12-18 Bill Wendling <wendling@apple.com>
Radar 6457359
* c-parser.c (build_block_struct_initlist): Changed type.
* cp/parser.c (build_block_struct_initlist): Ditto.
2008-12-02 Caroline Tice <ctice@apple.com>
Radar 6386976
* objcp/objcp-decl.h (TYPE_HAS_OBJCXX_INFO): New macro.
* objcp/objcp-lang.c (objcp-decl.h): New include statement, with
required define.
(LANG_HOOKS_IS_RUNTIME_SPECIFIC_TYPE): Redefine for
obj-c++.
(objcxx_is_runtime_type): New function.
2008-12-02 Fariborz Jahanian <fjahanian@apple.com>
Radar 6411649
* funciton.h: Added new field.
* c-common.c (build_block_helper_name): Produce a unique
block number per each enclosing function when building
the block helper function name.
2008-11-18 Stuart Hastings <stuart@apple.com>
Radar 6353006
* tree.c (generic_block_literal_struct_type): Fix APPLE LOCAL.
* langhooks-def.h (lhd_build_generic_block_struct_type): Fix
APPLE LOCAL.
2008-11-07 Fariborz Jahanian <fjahanian@apple.com>
Radar 5847976
* c-decl.c (synth_block_byref_id_object_copy_func): Takes a new
'flag' argument and generates the much simplified API.
(synth_block_byref_id_object_dispose_func): Ditto.
(new_block_byref_decl): Hack to prevent issuing bogus warning
on a field declared as __weak.
(init_byref_decl): Takes an additional 'flag' argument
and passes it down to synth_block_byref_id_object_copy_func and
synth_block_byref_id_object_dispose_func.
(finish_decl): Computes the flag for the block variable declaration.
* c-common.c (build_block_byref_release_decl,
build_block_byref_assign_copy_decl): Removed.
(build_block_byref_release_exp): Use the new API.
(build_block_object_assign_decl, build_block_object_assign_call_exp,
build_block_object_dispose_decl, build_block_object_dispose_call_exp): New.
(build_indirect_object_id_exp): Fixed a code gen bug which was exposed in
c/c++ mode, but not in ObjC/ObjC++ mode.
* c-common.h (build_block_object_assign_call_exp,
build_block_object_dispose_call_exp,
objc_is_gcable_type): New decls.
Declaration of several new flags.
(cast_to_pointer_to_id): Removed.
* stub-objc.c (objc_is_gcable_type): New
(copy_in_object, retain_block_component, release_block_component): Removed.
(cast_to_pointer_to_id): Removed.
* c-parser.c (build_block_struct_initlist): Remove call to copy_in_object.
(synth_copy_helper_block_func): Generates much simplified API.
(synth_destroy_helper_block_func): Ditto.
(block_object_dispose): Removed.
* config/darwin-c.c (darwin_cpp_builtins): Define __weak even when
-fobjc-gc is off.
2008-10-31 Fariborz Jahanian <fjahanian@apple.com>
Radar 6175959
* stub-objc.c (block_requires_copying): Object pointers with
NSObject attribute also require copy/release API.
* c-parser.c (synth_copy_helper_block_func): Use the new API
_Block_object_assign for ObjC object copying.
(block_object_dispose): New
(synth_destroy_helper_block_func): Call block_object_dispose
to use new _Block_object_dispose API for ObjC object release.
2008-10-27 Fariborz Jahanian <fjahanian@apple.com>
Radar 6231433
* c-typeck.c (objc_compare_types, objc_have_common_type):
Take an extra argument for better diagnostics.
* c-common.c (objc_compare_types, objc_have_common_type):
Take extra argument.
* stub-objc.c: Ditto
2008-10-24 Fariborz Jahanian <fjahanian@apple.com>
Radar 6305545
* cgraph.h (lower_if_nested_functions): New decl.
* tree-gimple.h (lower_nested_functions): Takes one more arg.
* cgraphunit.c (lower_if_nested_functions): New
* tree-nested.c (lower_nested_functions): Skip structors.
2008-10-24 Fariborz Jahanian <fjahanian@apple.com>
Radar 5847213 (minor tweak)
* c-decl.c (build_block_descriptor_type):
Make descriptor_ptr_type and descriptor_ptr_type_with_copydispose
visible to pch.
2008-10-23 Caroline Tice <ctice@apple.com>
Radar 6300081
* tree.c(build_block_pointer_type): Add call to
build_generic_block_struct_type to initialize
generic_block_literal_struct_type if necessary.
* cp/parser.c (build_generic_block_struct_type): Update comments.
(build_block_struct_type): Remove call to
build_generic_block_struct_type.
(make_block_pointer_declarator): Likewise.
* c-decl.c (make_block_pointer_declarator): Likewise.
* c-parser.c (build_block_struct_type): Likewise.
(build_generic_block_struct_type): Update comments.
2008-10-22 Caroline Tice <ctice@apple.com>
Radar 6300081 & Radar 6163705
* tree.h (generic_block_literal_struct_type): Extern global variable
decl.
(build_generic_block_struct_type): New extern function decl.
* cp/parser (build_generic_block_struct_type): New function.
(build_block_struct_type): Call build_generic_block_struct_type
to initialize generic_block_literal_struct_type.
(make_block_pointer_declarator): Likewise.
(declare_block_prologue_local_vars): Temporarily set input_location
to 1 before the start of the block function; re-set input_location at
the end of this function.
* dwarf2out.c (add_type_attribute): If the type is a
BLOCK_POINTER_TYPE, assign it to be a pointer to a
generic_block_literal_struct_type.
* c-decl.c (make_block_pointer_declarator): Call
build_generic_block_struct_type to initialize
generic_block_literal_struct_type.
* c-common.c (generic_block_literal_struct_type): New global variable.
* c-parser.c (build_generic_block_struct_type): New function.
(build_block_struct_type): Call build_generic_block_struct_type
to initialize generic_block_literal_struct_type.
* testsuite/gcc.apple/block-debug-1.c: Fix test to work with new
compiler modifications.
* testsuite/gcc.apple/block-debug-2.c: Likewise.
* testsuite/g++.apple/block-debug-1.C: Likewise.
* testsuite/g++.apple/block-debug-2.C: Likewise.
2008-10-10 Fariborz Jahanian <fjahanian@apple.com>
Radar 5847213 - New Block ABI
* dwarf2out.c (add_type_attribute): Unusuable code
for radar 5811943 is removed.
* c-decl.c (build_block_byref_decl): Removed unneeded
build of block_original_byref_decl_list.
(build_block_internal_types): Removed.
(build_block_descriptor_type): New routine to build the descriptor type.
(make_block_pointer_declarator): Unused code is removed.
* c-typeck.c (build_block_call): New code gen for block calls.
* c-common.c (invoke_impl_ptr_type): Removed.
* c-common.h (block_original_byref_decl_list, build_block_internal_types): Removed
(build_block_descriptor_type, BLOCK_HAS_DESCRIPTOR): Decls added.
* c-parser.c (build_block_struct_type): Block literal expression internal type
is redeclared into its new layout.
(build_block_struct_initlist): Initializer list for above type is redone.
(build_descriptor_block_decl): New routine to declare the descriptor variable
(build_block_literal_tmp): Modified for the new type and initiazation.
2008-10-06 Fariborz Jahanian <fjahanian@apple.com>
Radar 6268817
* c-decl.c (check_for_loop_decls): Block helper function
is OK if declared in a for-loop main statement block.
2008-10-02 Fariborz Jahanian <fjahanian@apple.com>
Radar 6246527
* attribs.c (decl_attributes): Added support for adding attributes
on block pointer variable declarations.
* c-common.c (block_delta_format_args): Add
(any_recognized_block_attribute): Add
* c-common.h (any_recognized_block_attribute): New decl.
* c-parser.c (c_parser_block_literal_expr): Call to do the delta
on printf attribute.
2008-09-30 Fariborz Jahanian <fjahanian@apple.com>
Radar 6225809
* c-decl.c (build_block_byref_decl): Add __block vaiables
to intervening blocks.
2008-09-25 Fariborz Jahanian <fjahanian@apple.com>
Radar 6237713
* c-common.c (handle_noreturn_attribute): Add 'noreturn'
attribute to block pointer decls.
* c-parser.c (c_parser_block_literal_expr): Parse and set
attributes on block literals.
2008-09-25 Fariborz Jahanian <fjahanian@apple.com>
Radar 6244520 - minor addition
* c-common.c (build_indirect_object_id_exp): offset needs
be updated to accomodate addition of the new field.
2008-09-16 Fariborz Jahanian <fjahanian@apple.com>
Radar 6214617
* c-common: New flag BLOCK_HAS_CXX_OBJ replaces BLOCK_NO_COPY.
(BlockImportsCxxObjects): New field replaces BlockHasByrefVar.
* c-parser.c (build_block_struct_type): Remove setting of
BLOCK_NO_COPY flag.
2008-09-16 Fariborz Jahanian <fjahanian@apple.com>
Radar 6217257
* c-common.c (handle_blocks_attribute): Diagnose
vla __block declarations.
2008-09-12 Fariborz Jahanian <fjahanian@apple.com>
Radar 6212722 (tweak)
* c-decl.c (build_block_ref_decl): Use array_to_pointer_conversion
and function_to_pointer_conversion.
* c-typeck.c (array_to_pointer_conversion, function_to_pointer_conversion):
Made them global.
* c-common.h (array_to_pointer_conversion, function_to_pointer_conversion):
Declare.
2008-09-09 Fariborz Jahanian <fjahanian@apple.com>
Radar 6169580
* c-commmon.c (build_block_helper_name): Fix bug in
block helper function name mangling.
2008-09-03 Fariborz Jahanian <fjahanian@apple.com>
Radar 6185344
* c-typeck.c (c_finish_return): Don't do block specific
stuff when block has a return type.
* c-common.h (block_sema_info): block_has_return_type is
a new field.
* c-parser.c (c_parser_direct_declarator): Terminate type
parsing for block return types.
(c_parser_block_literal_expr): Added support to parse and
handle explicit return type for blocks.
2008-08-28 Fariborz Jahanian <fjahanian@apple.com>
Radar 6160536
* c-commmon.c (build_block_helper_name): New
* c-common.h (build_block_helper_name): New decl.
* c-parser.c (c_parser_block_literal_expr): Call
build_block_helper_name to build pretty helper function
name.
2008-08-28 Fariborz Jahanian <fjahanian@apple.com>
Radar 6180456
* c-decl.c (synth_block_byref_id_object_copy_func): Different
API for copying __block declared objects in c.
(synth_block_byref_id_object_dispose_func): Different API
for releasing __block declared objects in c.
* c-common.c (block_byref_assign_copy_decl): New
(build_indirect_object_id_exp): Cast to 'id *' in objective-c
mode only.
* c-common.h (build_block_byref_assign_copy_decl): New decl.
* c-parser.c (synth_copy_helper_block_func): Refactored code
to call build_block_byref_assign_copy_decl().
2008-08-24 Caroline Tice <ctice@apple.com>
Radars 6144664, 6145471, 6144634
c-decl.c (build_block_byref_decl): Assign the source
location for each byref decl to the source location of
the helper function decl.
(build_block_ref_decl): Ditto for ref decls.
2008-08-14 Fariborz Jahanian <fjahanian@apple.com>
Radar 5822844
* c-typeck.c (digest_init): Handler block as initializer.
(c_finish_return): check for completed block before
analyzing block's return expression.
* varasm.c (output_constant): Allow outputting block data.
* c-common.h (BLOCK_IS_GLOBAL): New flag.
(block_is_complete): New field in block data structure.
* c-parser.c (build_block_struct_initlist): New initializer and
flag for global block data.
(build_block_literal_tmp): Temporary data for global block is
declared as global static.
(c_parser_block_literal_expr): Removed diagnostics for global blocks.
Moved fixing helper function type earlier before its tree is built.
2008-08-06 Fariborz Jahanian <fjahanian@apple.com>
Radar 6014138
* c-decl.c (build_block_byref_decl): In the presence of nested "{"
move up the scope chain until reaching the main function body's scope.
2008-08-04 Fariborz Jahanian <fjahanian@apple.com>
Radar 6040305 - work in progress.
* c-decl.c (build_indirect_object_id_exp): Removed.
* c-common.c (build_indirect_object_id_exp): Added
* c-common.h (build_indirect_object_id_exp): New decl.
* config/darwin-c.c (darwin_cpp_builtins): Define __byref
in c++ mode as well.
2008-07-18 Fariborz Jahanian <fjahanian@apple.com>
Radar 6083129 - twiked
* c-decl.c (release_all_local_byrefs_at_return): Do not release
imported __byref variables in the block.
* c-parser.c (gen_block_byref_release_exp): Do not release __byref
variables outside of the block when returning from the block.
2008-07-15 Fariborz Jahanian <fjahanian@apple.com>
Radar 5988451
* c-decl.c (build_block_ref_decl): Insert copied in variable
in each enclosing block which does not use it.
(begin_block): Remove setting of "the_scope" field of the block.
(in_imm_block): Fix effect of changing the "the_scope" field.
(lookup_name_in_block): Do not skip over copied-in variables when
looking up a variable in the block.
* c-parser.c (c_parser_block_literal_expr): Set block's "the_scope" field
to the helper function's outer-most body scope.
2008-07-08 Fariborz Jahanian <fjahanian@apple.com>
Radar 6048570
* c-typeck.c (c_finish_return): Error on returning a block on the stack.
2008-06-05 Fariborz Jahanian <fjahanian@apple.com>
Radar 5988995
* c-typeck.c (types_are_closure_compatible): Nested block pointer
types must be considered when matching block types.
2008-06-05 Fariborz Jahanian <fjahanian@apple.com>
Radar 5982990
* c-parser.c (c_parser_objc_synch_compound_statement): New
(c_parser_objc_synchronized_statement): Call
c_parser_objc_synch_compound_statement.
2008-06-04 Fariborz Jahanian <fjahanian@apple.com>
Radar 5985368
* c-parser.c (c_parser_declaration_or_fndef): Better diagnostics for
a bad block definition.
2008-05-23 Fariborz Jahanian <fjahanian@apple.com>
Radar 5925781
* c-common.c (handle_nonnull_attribute): Support block pointer
just like a pointer for nonnull attribute.
(check_nonnull_arg): Ditto.
2008-05-20 Fariborz Jahanian <fjahanian@apple.com>
Radar 5932809 - minor change for runtime delight.
* c-parser.c (build_closure_struct_type): Add strcutor fields
for __byref 'id' object blocks as well.
(build_closure_struct_initlist): And their initializers.
2008-04-30 Caroline Tice <ctice@apple.com>
Radar 5811961
* c-decl.c: (declare_closure_prologue_local_vars): Set the source
location for the new decl expr statement to be the source location of
the decl tree.
2008-04-25 Fariborz Jahanian <fjahanian@apple.com>
Radar 5803005 (tweaked)
* c-typeck.c (build_external_ref): Refactored global decl checks.
2008-04-24 Caroline Tice <ctice@apple.com>
Radar 5811943
* tree.h (TYPE_CLOSURE_IMPL_STRUCT): New macro.
(lang_flag_2): Use previously unused field in tree_type to indicate
closure structs.
* dwarf2out.c (c-common.h): New include statement.
(dwarf_attr_name): Add case for DW_AT_APPLE_closure.
(gen_variable_die): Give pointers to closures the
invoke_impl_ptr_type.
(gen_struct_or_union_type_die): Add DW_AT_APPLE_closure
to structs that define closures.
* dwarf2.h (DW_AT_APPLE_closure): New Dwarf attribute.
* c-typeck.c (invoke_impl_ptr_type): Move declaration from here to
c-common.c
(build_closure_internal_types): Set TYPE_CLOSURE_IMPL_STRUCT
flag for closure structs.
* c-common.c (invoke_impl_ptr_type): Move declaration to here from
c-typeck.c.
2008-04-23 Fariborz Jahanian <fjahanian@apple.com>
Radar 5882266
* c-typeck.c (types_are_closure_compatible): Check for underlying
pointer types as well.
2008-04-15 Stuart Hastings <stuart@apple.com>
Radar 5862465
* tree.h (PTR_OR_REF_CHECK, POINTER_TYPE_P): Add
CLOSURE_POINTER_TYPE.
* fold-const.c (fold_convert): Add CLOSURE_POINTER_TYPE.
* testsuite/gcc.apple/closure-5862465.c: New.
2008-03-31 Fariborz Jahanian <fjahanian@apple.com>
Radar 5831855
* c-typeck.c (convert_for_assignment): Block and 'id' types
are interchangeable.
2008-03-28 Fariborz Jahanian <fjahanian@apple.com>
Radar 5809099
* convert.c (convert_to_pointer): Allow typecast of closure
pointer to 'id'.
(convert_to_closure_pointer): Allow typecast of 'id'
of a closure pointer expression.
2008-03-25 Fariborz Jahanian <fjahanian@apple.com>
Radar 5811887 (minor change)
* c-opts.c (c_common_post_options): Remove conditional check
of pedantic when setting flag_blocks.
2008-03-24 Fariborz Jahanian <fjahanian@apple.com>
Radar 5811887
* c-cppbuiltin.c: flag_closures renamed to flag_blocks
* c-parser.c: Ditto.
* c.opt: flag_closures renamed to flag_blocks. flag_blocks
defaulted to -1.
* c-opts.c (c_common_post_options): All flavors of c99, blocks are off by
default unless requested via -fblocks.
2008-03-24 Fariborz Jahanian <fjahanian@apple.com>
Radar 5814025
* c-tree.h (make_closure_pointer_declarator): Takes
additional argument.
* c-decl.c (grokdeclarator): Get 'const'-ness of closure
pointer.
(make_closure_pointer_declarator): Takes additional argument for
const/volatile.
* c-parser.c (c_parser_declarator): Pass down attribute info.
to make_closure_pointer_declarator.
2008-03-20 Fariborz Jahanian <fjahanian@apple.com>
Radar 5802025
* c-common.h (objc_build_property_getter_func_call): New decl.
* stub-objc.c (objc_build_property_getter_func_call): New stub.
2008-03-18 Fariborz Jahanian <fjahanian@apple.com>
Radar 5803600
* c-decl.c (add_closure_global_byref_list,
in_closure_global_byref_list): New defs.
* c-common.h (add_closure_global_byref_list,
in_closure_global_byref_list): New decls.
* c-typeck.c (build_external_ref): global variables
declared as 'byref' are enterred in their own list
of such declarations per each closure.
* c-parser.c (c_parser_postfix_expression): Remove previous fix.
(c_parser_closure_byref_declaration): Check for global
'byref' by calling in_closure_global_byref_list.
2008-03-13 Fariborz Jahanian <fjahanian@apple.com>
Radar 5795493
* c-typeck.c: Renamed typesAreClosureCompatible to
types_are_closure_compatible.
2008-03-11 Fariborz Jahanian <fjahanian@apple.com>
Radar 5732232 (Related to change of command option/macro)
* c-cppbuiltin.c: __CLOSURES__ macro rename __BLOCKS__
* c.opt: -fclosures change to -fblocks.
2008-03-10 Fariborz Jahanian <fjahanian@apple.com>
Radar 5782740 - part 2 (bug fix).
* c-parser.c (synth_copy_helper_closure,
synth_destroy_helper_closure): set DECL_ARG_TYPE field of input
arguments for the two synthesized helper functions.
2008-02-21 Caroline Tice <ctice@apple.com>
Radar 5741070
* objc/objc-act.c (objc_finish_message_expr): Find
the record-type tree from the class interface, and mark the record
type as used, for emitting debug info.
* cp/cp-objcp-common.c (c_return_interface_record_type): New function.
* cp/cp-tree.h (c_return_interface_record_type): New extern function
declaration.
* c-tree.h (c_return_interface_record_type): Likewise
* c-decl.c (c_return_interface_record_type): New function.
2007-08-22 Fariborz Jahanian <fjahanian@apple.com>
Radar 4947311
* c-common.h (objc_declare_protocols, objc_start_protocol): Decl changed.
* stub-objc.c (objc_declare_protocols, objc_start_protocol): Changed.
* c-parser.c (c_parser_external_declaration): Call to
c_parser_objc_protocol_definition takes additional argument.
(c_parser_declaration_or_fndef): Protocols with attributes are processed
here by passing it to c_parser_objc_protocol_definition.
(c_parser_objc_protocol_definition): Takes additional argument and passes
it to objc_declare_protocols or objc_start_protocol.
2007-07-13 Fariborz Jahanian <fjahanian@apple.com>
Radar 5277239
* c-parser.c (c_parser_next_token_starts_declspecs): Exclude
objc2's property dot-syntax as a declarator.
(c_parser_postfix_expression): Convert property dot-syntax on
class objects into a property reference expression.
2007-07-10 Fariborz Jahanian <fjahanian@apple.com>
Radar 5285911
* tree.h (CALL_EXPR_OBJC_PROPERTY_GETTER): Macro removed.
* c-typeck.c (build_component_ref): Call
objc_build_property_reference_expr instead of objc_build_getter_call.
(build_modify_expr): Call objc_property_reference_expr instead of
objc_property_call.
* c-common.h (objc_build_getter_call, objc_property_call): Decl removed.
(objc_build_property_reference_expr, objc_property_reference_expr): Decl.
added.
* stub-objc.c (objc_build_getter_call, objc_property_call): Stub removed.
(objc_build_property_reference_expr, objc_property_reference_expr):
Stub added.
2007-06-29 Fariborz Jahanian <fjahanian@apple.com>
Radar 5276085
* c-parser.c (c_parser_binary_expression) : objc_generate_weak_read
replaced with call to objc_build_weak_reference_tree
* c-typeck.c (build_modify_expr, c_objc_common_truthvalue_conversion):
objc_remove_weak_read replaced with call to objc_weak_reference_expr.
* c-common.h (objc_weak_reference_expr,
objc_build_weak_reference_tree) : New decl.
(objc_generate_weak_read, objc_remove_weak_read): remove.
* stub-objc.c (objc_weak_reference_expr,
objc_build_weak_reference_tree): New stub.
(objc_generate_weak_read, objc_remove_weak_read): remove.
2007-05-23 Fariborz Jahanian <fjahanian@apple.com>
Radar 5195402
* c-format.c (handle_format_arg_attribute): Check for NSString *
and CFStringRef as valid formatting types.
(check_format_string): Ditto.
* c-common.h (objc_check_format_nsstring,
objc_check_cfstringref_type): New decls.
* stub-objc.c (objc_check_nsstring_pointer_type): New stub.
* config/darwin-c.c (objc_check_cfstringref_type): New
(objc_check_format_cfstring): Call objc_check_cfstringref_type
for valid CFStringRef argument type.
* config/darwin-protos.h (objc_check_cfstringref_type): New decl.
* config/darwin.h (CFSTRING_TYPE_CHECK): New macro.
2007-05-18 Fariborz Jahanian <fjahanian@apple.com>
Radar 5202926
* c-common.h (objc_anonymous_local_objc_name): New decl.
* config/darwin-protos.h (objc_anonymous_local_objc_name): Decl.
* stub-objc.c (objc_anonymous_local_objc_name): New stub.
* config/darwin.h (ASM_OUTPUT_LABELREF) Call
objc_anonymous_local_objc_name.
2007-05-07 Fariborz Jahanian <fjahanian@apple.com>
Radar 4157812
* c-common.h (objc_build_keyword_decl): Takes a new argument.
* stub-objc.c (objc_build_keyword_decl): Ditto.
* c-parser.c (c_parser_objc_method_decl): Recognize optional
method's argument attribute.
(c_parser_objc_method_decl): Handle errornous selector.
2007-05-02 Fariborz Jahanian <fjahanian@apple.com>
Radar 4502186
* c-typeck.c (convert_for_assignment): Remove synthesized 'volatile'
type before doing type comparison.
2007-03-29 Fariborz Jahanian <fjahanian@apple.com>
Radar 4564694
* c-parse.c (c_parser_objc_class_instance_variables): Add @package
support to syntax.
* c-common.h (RID_AT_PACKAGE): Add
2007-03-29 Fariborz Jahanian <fjahanian@apple.com>
Radar 4947014 - objc atomic property
* c-common.h (RID_NONATOMIC): Add
* c-parse.c (c_parser_objc_property_attribute) : Recognize 'nonatomic'
as new property.
2007-03-23 Fariborz Jahanian <fjahanian@apple.com>
Radar 4985544
* c-format.c (enum format_type): New entry for NSString format.
(format_typ): Has a new entry for NSString format.
(decode_format_attr): Error on use of NSString format on a
non-objective-c program.
(objc_check_nsformat_arg): New.
(check_format_info): Call back for NSString is objc_check_nsformat_arg
(handle_format_attribute): Use objc_check_format_nsstring for
NSString format.
* c-common.h (objc_NSString_format): New decl.
(objc_check_format_nsstring): New decl.
* stub-objc.c (objc_NSString_format, objc_check_format_nsstring): New
stubs.
* config/darwin-protos.h (darwin_cfstring_type_node): New decl.
* config/darwin.c (darwin_cfstring_type_node): New
* config/darwin.h (TARGET_CFSTRING_P): New macro
2007-03-23 Fariborz Jahanian <fjahanian@apple.com>
Radar 4985544
* c-format.c (enum format_type): New entry for NSString format.
(format_typ): Has a new entry for NSString format.
(decode_format_attr): Error on use of NSString format on a
non-objective-c program.
(objc_check_nsformat_arg): New.
(check_format_info): Call back for NSString is objc_check_nsformat_arg
(handle_format_attribute): Use objc_check_format_nsstring for
NSString format.
* c-common.h (objc_NSString_format): New decl.
(objc_check_format_nsstring): New decl.
* stub-objc.c (objc_NSString_format, objc_check_format_nsstring): New
stubs.
* config/darwin-protos.h (darwin_cfstring_type_node): New decl.
* config/darwin.c (darwin_cfstring_type_node): New
* config/darwin.h (TARGET_CFSTRING_P): New macro
2007-03-22 Fariborz Jahanian <fjahanian@apple.com>
Radar 4965989
* c-parser.c (c_parser_objc_class_definition): Add supprt for anonymous
category syntax.
2007-03-21 Fariborz Jahanian <fjahanian@apple.com>
Radar 2848255
* c-parser.c (c_parser_objc_try_catch_statement): Parse @catch(...).
* c.opt: Add -fobjc-zerocost-exceptions option.
* c-opts.c (c_common_post_options): Set the flags for
-fobjc-zerocost-exceptions.
* c-common.h: Add some declarations.
* stub-objc.c (objc2_valid_objc_catch_type, objc2_build_throw_call):
New stubs.
* config/darwin.h (OBJC_FLAG_OBJC_ABI): Check for proper
use of -fobjc-zerocost-exceptions option.
2006-11-06 Fariborz Jahanian <fjahania@apple.com>
Radar 4781080 (part 2)
* targhooks.c (default_objc_fpreturn_msgcall): Takes 2nd argument.
* targhooks.h (default_objc_fpreturn_msgcall): Changed Decl.
* target.h (objc_fpreturn_msgcall): Changed Decl.
* config/i386/i386.h (OBJC_FPRETURN_MSGCALL): Changed Decl.
* config/i386/i386-protos.h (ix86_objc_fpreturn_msgcall): Changed Decl.
* config/i386/i386.c (ix86_objc_fpreturn_msgcall): Changed definition.
2006-09-15 Fariborz Jahanian <fjahania@apple.com>
Radar 4727659
* c-common.c (handle_noreturn_attribute): Handle method_decl
nodes as well.
2006-09-01 Fariborz Jahanian <fjahania@apple.com>
Radar 4712269
* c-common.h (objc_build_incr_decr_setter_call): New decl.
* stub-objc.c (objc_build_incr_decr_setter_call): New stub.
* c-typeck.c (build_unary_op): Call objc_build_incr_decr_setter_call
for potential ince/decr pre/post expressions involving properties.
2006-08-31 Fariborz Jahanian <fjahanian@apple.com>
Radar 4697411
* c-common.h (objc_volatilize_component_ref): New decl.
* c-typeck.c (build_component_ref): Call objc_volatilize_component_ref.
* stub-objc.c (objc_volatilize_component_ref): New stub.
2006-07-18 Fariborz Jahanian <fjahanian@apple.com>
Radar 4592503
* c-decl.c (finish_struct): Check on illegal use of __weak
on struct fields.
* decl.c (start_decl): Check on illegal use of __weak on
variable declarations.
* stub-objc.c (objc_checkon_weak_attribute): New stub.
* c-common.h (objc_checkon_weak_attribute): New decl.
2006-06-26 Fariborz Jahanian <fjahanian@apple.com>
Radar 4591909
* c-parse.in: New/modified grammar for new attributes in
properties.
(yylexname): Change to recognize new attribute terminals.
* c-common.h (RID_DYNAMIC): New enum declaration.
2006-07-14 Fariborz Jahanian <fjahanian@apple.com>
Radar 4621020
* c-parse.in: Added 'weak' attribute keyword for @property.
* c-common.h: 'weak' related declarations.
2006-05-18 Fariborz Jahanian <fjahanian@apple.com>
Radar 4548636 (objc attributes on class)
* c-parse.in: Add attribute non-terminal before
AT_INTERFACE.
* c-common.h (objc_start_class_interface): New argument added.
* stub-objc.c (objc_start_class_interface): Ditto.
2006-05-16 Fariborz Jahanian <fjahanian@apple.com>
Radar 4547045
* c-gimplify.c (obj_reuse_bc_block): Removed.
(objc_pop_label, objc_push_label): New.
(gimplify_c_loop): Fix up foreach's innerloop break label.
2006-04-26 Fariborz Jahanian <fjahanian@apple.com>
Radar 3803157 (method attributes)
* c-parse.in: Add grammar support for declaring
attribute for objc methods.
* c-common.c (handle_deprecated_attribute): Recognize
objc methods as valid declarations.
(handle_unavailable_attribute): Ditto.
* c-common.h: Bunch of new extern declarations.
* stub-objc.c (objc_add_method_declaration, objc_start_method_definition):
Added new argument.
(objc_method_decl): New stub.
2006-04-12 Fariborz Jahanian <fjahanian@apple.com>
Radar 4507230
* c-common.h (objc_type_valid_for_messaging): Declare.
* stub-objc.c (objc_type_valid_for_messaging): New stub.
2006-04-06 Fariborz Jahanian <fjahanian@apple.com>
Radar 4436866
(Missing copies attribute)
* c-parse.in: Add grammer for 'copies' attribute.
* c-common.h (RID_COPIES): New enumerator.
2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
Radar 4133425
* c-common.h (objc_diagnose_private_ivar): New decl.
* stub-objc.c (objc_diagnose_private_ivar): New stub.
* c-decl.c (undeclared_variable): Issue disnostic on
private 'ivar' access.
2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
Radar 4491608
* c-typeck.c (convert_arguments): function name must come from 'selector'
when diagnosing 'too many arguments'.
2006-03-23 Fariborz Jahanian <fjahanian@apple.com>
Radar 4193359
* c-typeck.c (convert_for_assignment): Remove Objective-C EH machinery
'volatile' qualifier before doing type comparison.
2006-02-28 Fariborz Jahanian <fjahanian@apple.com>
Radar 4441049
* c-common.h (objc_v2_bitfield_ivar_bitpos): New decl.
* expr.h (objc_v2_bitfield_ivar_bitpos): New decl.
* stub-objc.c (objc_v2_bitfield_ivar_bitpos): New stub.
* expr.c (get_inner_reference): Compute ivar's bitfield bit offset.
2006-02-15 Fariborz Jahanian <fjahanian@apple.com>
Radar 4445586
* c-common.def (DO_STMT): Takes an extra argument.
2006-02-02 Fariborz Jahanian <fjahanian@apple.com>
Radar 4426814
* c-parse.in (cast_expr): generate objc_read_weak call on
each __weak object in the expession.
* c-typeck.c (build_modify_expr): Undo the call to objc_read_weak
on LHS expression.
* c-objc-common.c (c_objc_common_truthvalue_conversion): Generate
objc_read_weak call before generating tree for !exp, etc.
* c-common.h (objc_generate_weak_read, objc_remove_weak_read): New decl.
* stub-objc.c (objc_generate_weak_read, objc_remove_weak_read): New stubs.
2005-12-15 Fariborz Jahanian <fjahanian@apple.com>
Radar 4229905
* c-typeck.c (build_conditional_expr): Call objc_have_common_type when
looking for objective-c common pointer types.
* c-common.h objc_have_common_type): New declaration.
* stub-objc.c (objc_have_common_type): New stub.
2005-12-05 Mike Stump <mrs@apple.com>
Radar 4357979
* doc/invoke.texi (C Dialect Options): Improve -fnested-functions wording.
* doc/extend.texi (Nested Functions): Note that on darwin nested
functions are off by default.
2005-11-08 Fariborz Jahanian <fjahanian@apple.com>
Radar 4330422
* c-common.h (objc_non_volatilized_type): New declaration
* stub-objc.c (objc_non_volatilized_type): New stub.
2005-10-12 Fariborz Jahanian <fjahanian@apple.com>
Radar 4291785
* c-common.h (objc_get_interface_ivars): New declaration
(objc_detect_field_duplicates): Ditto.
* c-decl.c (finish_struct): Check for duplicate among
flattened fields if objective-c.
* stub-objc.c (objc_get_interface_ivars): New stub.
(objc_detect_field_duplicates): Ditto.
2005-09-28 Devang Patel <dpatel@apple.com>
Radar 4258406
* c-parse.in (nested_function): Report an error, instead of a warning.
(nontype_nested_function): Same.
* c.opt (Wnested-funcs): Remove.
* doc/invoke.texi: Remove Wnested-funcs documentations.
2005-08-03 Fariborz Jahanian <fjahanian@apple.com>
Radar 4188876
* c-typeck.c (pop_init_level): Issue diagnostic on non-constant
vector initializers.
2005-06-22 Ziemowit Laski <zlaski@apple.com>
Radar 4154928
* c-common.h (objc_common_type): New prototype.
* c-typeck.c (build_conditional_expr): For two ObjC pointer types,
use their ObjC common type.
* stub-objc.c (objc_common_type): New stub.
/* APPLE LOCAL merge marger */
/* Stuff under is in fsf mainline, but not in the 4.2 branch */

View File

@ -216,7 +216,8 @@ decl_attributes (tree *node, tree attributes, int flags)
if (spec->function_type_required && TREE_CODE (*anode) != FUNCTION_TYPE
&& TREE_CODE (*anode) != METHOD_TYPE)
{
if (TREE_CODE (*anode) == POINTER_TYPE
/* APPLE LOCAL radar 6246527 */
if ((TREE_CODE (*anode) == POINTER_TYPE || TREE_CODE (*anode) == BLOCK_POINTER_TYPE)
&& (TREE_CODE (TREE_TYPE (*anode)) == FUNCTION_TYPE
|| TREE_CODE (TREE_TYPE (*anode)) == METHOD_TYPE))
{
@ -323,6 +324,14 @@ decl_attributes (tree *node, tree attributes, int flags)
if (fn_ptr_tmp)
{
/* APPLE LOCAL begin radar 6246527 */
if (DECL_P (*node) && TREE_TYPE (*node) &&
TREE_CODE (TREE_TYPE (*node)) == BLOCK_POINTER_TYPE)
/* Rebuild the block pointer type and put it in the
appropriate place. */
fn_ptr_tmp = build_block_pointer_type (fn_ptr_tmp);
else
/* APPLE LOCAL end radar 6246527 */
/* Rebuild the function pointer type and put it in the
appropriate place. */
fn_ptr_tmp = build_pointer_type (fn_ptr_tmp);

View File

@ -552,6 +552,8 @@ static tree handle_cleanup_attribute (tree *, tree, tree, int, bool *);
static tree handle_warn_unused_result_attribute (tree *, tree, tree, int,
bool *);
static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
/* APPLE LOCAL radar 5932809 - copyable byref blocks */
static tree handle_blocks_attribute (tree *, tree, tree, int, bool *);
static void check_function_nonnull (tree, tree);
static void check_nonnull_arg (void *, tree, unsigned HOST_WIDE_INT);
@ -607,7 +609,8 @@ const struct attribute_spec c_common_attribute_table[] =
handle_section_attribute },
{ "aligned", 0, 1, false, false, false,
handle_aligned_attribute },
{ "weak", 0, 0, true, false, false,
/* APPLE LOCAL weak types 5954418 */
{ "weak", 0, 0, false, false, false,
handle_weak_attribute },
{ "alias", 1, 1, true, false, false,
handle_alias_attribute },
@ -650,6 +653,8 @@ const struct attribute_spec c_common_attribute_table[] =
handle_warn_unused_result_attribute },
{ "sentinel", 0, 1, false, true, true,
handle_sentinel_attribute },
/* APPLE LOCAL radar 5932809 - copyable byref blocks */
{ "blocks", 1, 1, true, false, false, handle_blocks_attribute },
{ NULL, 0, 0, false, false, false, NULL }
};
@ -4259,7 +4264,10 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args),
tree type = TREE_TYPE (*node);
/* See FIXME comment in c_common_attribute_table. */
if (TREE_CODE (*node) == FUNCTION_DECL)
/* APPLE LOCAL begin radar 4727659 */
if (TREE_CODE (*node) == FUNCTION_DECL
|| objc_method_decl (TREE_CODE (*node)))
/* APPLE LOCAL end radar 4727659 */
TREE_THIS_VOLATILE (*node) = 1;
else if (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
@ -4267,6 +4275,14 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args),
= build_pointer_type
(build_type_variant (TREE_TYPE (type),
TYPE_READONLY (TREE_TYPE (type)), 1));
/* APPLE LOCAL begin radar 6237713 */
else if (TREE_CODE (type) == BLOCK_POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
TREE_TYPE (*node)
= build_block_pointer_type
(build_type_variant (TREE_TYPE (type),
TYPE_READONLY (TREE_TYPE (type)), 1));
/* APPLE LOCAL end radar 6237713 */
else
{
warning (OPT_Wattributes, "%qE attribute ignored", name);
@ -4893,6 +4909,23 @@ handle_weak_attribute (tree *node, tree name,
if (TREE_CODE (*node) == FUNCTION_DECL
|| TREE_CODE (*node) == VAR_DECL)
declare_weak (*node);
/* APPLE LOCAL begin weak types 5954418 */
else if (!DECL_P (*node)
/* If the weak flag can be associated with something else,
prefer that. */
&& (flags & (ATTR_FLAG_FUNCTION_NEXT
|ATTR_FLAG_DECL_NEXT
|ATTR_FLAG_ARRAY_NEXT)))
{
*no_add_attrs = true;
return tree_cons (name, args, NULL_TREE);
}
else if (! targetm.cxx.class_data_always_comdat ()
&& TREE_CODE (*node) == RECORD_TYPE)
{
/* Leave on the type for the C++ front end */
}
/* APPLE LOCAL end weak types 5954418 */
else
warning (OPT_Wattributes, "%qE attribute ignored", name);
@ -5380,7 +5413,11 @@ handle_unavailable_attribute (tree *node, tree name,
if (TREE_CODE (decl) == TYPE_DECL
|| TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == FUNCTION_DECL)
|| TREE_CODE (decl) == FUNCTION_DECL
/* APPLE LOCAL begin radar 3803157 - objc attribute */
|| TREE_CODE (decl) == FIELD_DECL
|| objc_method_decl (TREE_CODE (decl)))
/* APPLE LOCAL end radar 3803157 - objc attribute */
{
TREE_UNAVAILABLE (decl) = 1;
}
@ -5556,7 +5593,10 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
return NULL_TREE;
}
if (TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE)
/* APPLE LOCAL begin blocks 5925781 */
if (TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE &&
TREE_CODE (TREE_VALUE (argument)) != BLOCK_POINTER_TYPE)
/* APPLE LOCAL end blocks 5925781 */
{
error ("nonnull argument references non-pointer operand (argument %lu, operand %lu)",
(unsigned long) attr_arg_num, (unsigned long) arg_num);
@ -5703,8 +5743,11 @@ check_nonnull_arg (void * ARG_UNUSED (ctx), tree param,
happen if the "nonnull" attribute was given without an operand
list (which means to check every pointer argument). */
if (TREE_CODE (TREE_TYPE (param)) != POINTER_TYPE)
return;
/* APPLE LOCAL begin blocks 5925781 */
if (TREE_CODE (TREE_TYPE (param)) != POINTER_TYPE &&
TREE_CODE (TREE_TYPE (param)) != BLOCK_POINTER_TYPE)
/* APPLE LOCAL end blocks 5925781 */
return;
if (integer_zerop (param))
warning (OPT_Wnonnull, "null argument where non-null required "
@ -5807,6 +5850,168 @@ handle_warn_unused_result_attribute (tree *node, tree name,
return NULL_TREE;
}
/* APPLE LOCAL begin radar 5932809 - copyable byref blocks */
/* Handle "blocks" attribute. */
static tree
handle_blocks_attribute (tree *node, tree name,
tree args,
int ARG_UNUSED (flags), bool *no_add_attrs)
{
tree arg_ident;
/* APPLE LOCAL radar 6217257 */
tree type;
*no_add_attrs = true;
if (!(*node) || TREE_CODE (*node) != VAR_DECL)
{
error ("__block attribute can be specified on variables only");
return NULL_TREE;
}
arg_ident = TREE_VALUE (args);
gcc_assert (TREE_CODE (arg_ident) == IDENTIFIER_NODE);
/* APPLE LOCAL radar 6096219 */
if (strcmp (IDENTIFIER_POINTER (arg_ident), "byref"))
{
/* APPLE LOCAL radar 6096219 */
warning (OPT_Wattributes, "Only \"byref\" is allowed - %qE attribute ignored",
name);
return NULL_TREE;
}
/* APPLE LOCAL begin radar 6217257 */
type = TREE_TYPE (*node);
if (TREE_CODE (type) == ERROR_MARK)
return NULL_TREE;
if (TREE_CODE (type) == ARRAY_TYPE)
{
if (!TYPE_SIZE (type) || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
{
error ("__block not allowed on a variable length array declaration");
return NULL_TREE;
}
}
/* APPLE LOCAL end radar 6217257 */
COPYABLE_BYREF_LOCAL_VAR (*node) = 1;
COPYABLE_BYREF_LOCAL_NONPOD (*node) = block_requires_copying (*node);
return NULL_TREE;
}
/* APPLE LOCAL end radar 5932809 - copyable byref blocks */
/* APPLE LOCAL begin blocks 6040305 */
/* This routine builds:
*(void **)(EXP+20) expression which references the object pointer.
*/
tree
build_indirect_object_id_exp (tree exp)
{
tree dst_obj;
int int_size = int_cst_value (TYPE_SIZE_UNIT (unsigned_type_node));
int offset;
/* dst->object In thid case 'object' is the field
of the object passed offset by: void * + void* + int + int + void* + void *
This must match definition of Block_byref structs. */
/* APPLE LOCAL radar 6244520 */
offset = GET_MODE_SIZE (Pmode) + GET_MODE_SIZE (Pmode)
+ int_size + int_size + GET_MODE_SIZE (Pmode) +
GET_MODE_SIZE (Pmode);
dst_obj = build2 (PLUS_EXPR, ptr_type_node, exp,
build_int_cst (NULL_TREE, offset));
/* APPLE LOCAL begin radar 6180456 */
/* Type case to: 'void **' */
dst_obj = build_c_cast (build_pointer_type (ptr_type_node), dst_obj);
dst_obj = build_indirect_ref (dst_obj, "unary *");
/* APPLE LOCAL end radar 6180456 */
return dst_obj;
}
/* This routine builds call to:
_Block_object_dispose(VAR_DECL.__forwarding, BLOCK_FIELD_IS_BYREF);
and adds it to the statement list.
*/
tree
build_block_byref_release_exp (tree var_decl)
{
tree exp = var_decl, call_exp;
tree type = TREE_TYPE (var_decl);
/* __block variables imported into Blocks are not _Block_object_dispose()
from within the Block statement itself; otherwise, each envokation of
the block causes a release. Make sure to release __block variables declared
and used locally in the block though. */
if (cur_block
&& (BLOCK_DECL_COPIED (var_decl) || BLOCK_DECL_BYREF (var_decl)))
return NULL_TREE;
if (BLOCK_DECL_BYREF (var_decl)) {
/* This is a "struct Block_byref_X *" type. Get its pointee. */
gcc_assert (POINTER_TYPE_P (type));
type = TREE_TYPE (type);
exp = build_indirect_ref (exp, "unary *");
}
TREE_USED (var_decl) = 1;
/* Declare: _Block_object_dispose(void*, BLOCK_FIELD_IS_BYREF) if not done already. */
exp = build_component_ref (exp, get_identifier ("__forwarding"));
call_exp = build_block_object_dispose_call_exp (exp, BLOCK_FIELD_IS_BYREF);
return call_exp;
}
/* APPLE LOCAL end blocks 6040305 */
/* APPLE LOCAL begin radar 5803600 */
/** add_block_global_byref_list - Adds global variable decl to the list of
byref global declarations in the current block.
*/
void add_block_global_byref_list (tree decl)
{
cur_block->block_byref_global_decl_list =
tree_cons (NULL_TREE, decl, cur_block->block_byref_global_decl_list);
}
/** in_block_global_byref_list - returns TRUE if global variable is
in the list of 'byref' declarations.
*/
bool in_block_global_byref_list (tree decl)
{
tree chain;
if (TREE_STATIC (decl)) {
for (chain = cur_block->block_byref_global_decl_list; chain;
chain = TREE_CHAIN (chain))
if (TREE_VALUE (chain) == decl)
return true;
}
return false;
}
/* APPLE LOCAL end radar 5803600 */
/* APPLE LOCAL begin radar 6160536 */
tree
build_block_helper_name (int unique_count)
{
char *buf;
if (!current_function_decl)
{
/* APPLE LOCAL begin radar 6411649 */
static int global_count;
buf = (char *)alloca (32);
sprintf (buf, "__block_global_%d", ++global_count);
/* APPLE LOCAL end radar 6411649 */
}
else
{
tree outer_decl = current_function_decl;
/* APPLE LOCAL begin radar 6169580 */
while (outer_decl &&
DECL_CONTEXT (outer_decl) && TREE_CODE (DECL_CONTEXT (outer_decl)) == FUNCTION_DECL)
/* APPLE LOCAL end radar 6169580 */
outer_decl = DECL_CONTEXT (outer_decl);
/* APPLE LOCAL begin radar 6411649 */
if (!unique_count)
unique_count = ++DECL_STRUCT_FUNCTION(outer_decl)->unqiue_block_number;
/* APPLE LOCAL end radar 6411649 */
buf = (char *)alloca (IDENTIFIER_LENGTH (DECL_NAME (outer_decl)) + 32);
sprintf (buf, "__%s_block_invoke_%d",
IDENTIFIER_POINTER (DECL_NAME (outer_decl)), unique_count);
}
return get_identifier (buf);
}
/* APPLE LOCAL end radar 6160536 */
/* Handle a "sentinel" attribute. */
static tree
@ -6723,5 +6928,147 @@ warn_about_parentheses (enum tree_code code, enum tree_code code_left,
"have their mathematical meaning");
}
/* APPLE LOCAL begin radar 6246527 */
/* This routine is called for a "format" attribute. It adds the number of
hidden argument ('1') to the format's 2nd and 3rd argument to compensate
for these two arguments. This is to make rest of the "format" attribute
processing done in the middle-end to work seemlessly. */
static void
block_delta_format_args (tree format)
{
tree format_num_expr, first_arg_num_expr;
int val;
tree args = TREE_VALUE (format);
gcc_assert (TREE_CHAIN (args) && TREE_CHAIN (TREE_CHAIN (args)));
format_num_expr = TREE_VALUE (TREE_CHAIN (args));
first_arg_num_expr = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (args)));
if (format_num_expr && TREE_CODE (format_num_expr) == INTEGER_CST)
{
val = TREE_INT_CST_LOW (format_num_expr);
TREE_VALUE (TREE_CHAIN (args)) = build_int_cst (NULL_TREE, val+1);
}
if (first_arg_num_expr && TREE_CODE (first_arg_num_expr) == INTEGER_CST)
{
val = TREE_INT_CST_LOW (first_arg_num_expr);
if (val != 0)
TREE_VALUE (TREE_CHAIN (TREE_CHAIN (args))) =
build_int_cst (NULL_TREE, val+1);
}
}
/* This routine recognizes legal block attributes. In case of block's "format"
attribute, it calls block_delta_format_args to compensate for hidden
argument _self getting passed to block's helper function. */
bool
any_recognized_block_attribute (tree attributes)
{
tree chain;
bool res = false;
for (chain = attributes; chain; chain = TREE_CHAIN (chain))
{
if (is_attribute_p ("format", TREE_PURPOSE (chain)))
{
block_delta_format_args (chain);
res = true;
}
else if (is_attribute_p ("sentinel", TREE_PURPOSE (chain)))
res = true;
}
return res;
}
/* APPLE LOCAL end radar 6246527 */
/* APPLE LOCAL begin radar 5847976 */
static GTY(()) tree block_object_assign_decl;
static GTY(()) tree block_object_dispose_func_decl;
/* This routine declares:
void _Block_object_assign (void *, void *, int) or uses an
existing one.
*/
static tree
build_block_object_assign_decl (void)
{
tree func_type;
if (block_object_assign_decl)
return block_object_assign_decl;
block_object_assign_decl = lookup_name (get_identifier ("_Block_object_assign"));
if (block_object_assign_decl)
return block_object_assign_decl;
func_type =
build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, integer_type_node, void_list_node))));
block_object_assign_decl = builtin_function ("_Block_object_assign", func_type,
0, NOT_BUILT_IN, 0, NULL_TREE);
TREE_NOTHROW (block_object_assign_decl) = 0;
return block_object_assign_decl;
}
/* This routine builds:
_Block_object_assign(dest, src, flag)
*/
tree build_block_object_assign_call_exp (tree dst, tree src, int flag)
{
tree func_params = tree_cons (NULL_TREE, dst,
tree_cons (NULL_TREE, src,
tree_cons (NULL_TREE,
build_int_cst (integer_type_node, flag),
NULL_TREE)));
return build_function_call (build_block_object_assign_decl (), func_params);
}
/* This routine declares:
void _Block_object_dispose (void *, int) or uses an
existing one.
*/
static tree
build_block_object_dispose_decl (void)
{
tree func_type;
if (block_object_dispose_func_decl)
return block_object_dispose_func_decl;
block_object_dispose_func_decl = lookup_name (get_identifier ("_Block_object_dispose"));
if (block_object_dispose_func_decl)
return block_object_dispose_func_decl;
func_type =
build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, integer_type_node, void_list_node)));
block_object_dispose_func_decl = builtin_function ("_Block_object_dispose", func_type,
0, NOT_BUILT_IN, 0, NULL_TREE);
TREE_NOTHROW (block_object_dispose_func_decl) = 0;
return block_object_dispose_func_decl;
}
/* This routine builds the call tree:
_Block_object_dispose(src, flag)
*/
tree build_block_object_dispose_call_exp (tree src, int flag)
{
tree func_params = tree_cons (NULL_TREE, src,
tree_cons (NULL_TREE,
build_int_cst (integer_type_node, flag),
NULL_TREE));
return build_function_call (build_block_object_dispose_decl (), func_params);
}
/* APPLE LOCAL end radar 5847976 */
/* APPLE LOCAL begin radar 7760213 */
int HasByrefArray(tree byrefType)
{
tree s1;
/* Check for possibility of an error condition. */
if (TREE_CODE(byrefType) != RECORD_TYPE)
return 0;
for (s1 = TYPE_FIELDS (byrefType); s1; s1 = TREE_CHAIN (s1))
{
if (TREE_CODE(TREE_TYPE(s1)) == ARRAY_TYPE)
return 1;
}
return 0;
}
/* APPLE LOCAL end radar 7760213 */
#include "gt-c-common.h"

View File

@ -93,12 +93,20 @@ enum rid
/* Objective-C */
RID_AT_ENCODE, RID_AT_END,
RID_AT_CLASS, RID_AT_ALIAS, RID_AT_DEFS,
RID_AT_PRIVATE, RID_AT_PROTECTED, RID_AT_PUBLIC,
/* APPLE LOCAL radar 4564694 */
RID_AT_PACKAGE, RID_AT_PRIVATE, RID_AT_PROTECTED, RID_AT_PUBLIC,
RID_AT_PROTOCOL, RID_AT_SELECTOR,
RID_AT_THROW, RID_AT_TRY, RID_AT_CATCH,
RID_AT_FINALLY, RID_AT_SYNCHRONIZED,
RID_AT_INTERFACE,
/* APPLE LOCAL C* language */
RID_AT_OPTIONAL, RID_AT_REQUIRED,
/* APPLE LOCAL C* property (Radar 4436866) */
RID_AT_PROPERTY,
RID_AT_IMPLEMENTATION,
/* APPLE LOCAL C* property (Radar 4436866, 4591909, 4621020) */
RID_READONLY, RID_GETTER, RID_SETTER,
RID_NONATOMIC,
RID_MAX,
@ -888,8 +896,23 @@ extern void c_parse_error (const char *, enum cpp_ttype, tree);
extern tree objc_is_class_name (tree);
extern tree objc_is_object_ptr (tree);
extern void objc_check_decl (tree);
/* APPLE LOCAL radar 4281748 */
extern void objc_check_global_decl (tree);
extern int objc_is_reserved_word (tree);
extern bool objc_compare_types (tree, tree, int, tree);
/* APPLE LOCAL 4154928 */
extern tree objc_common_type (tree, tree);
/* APPLE LOCAL 4330422 */
extern tree objc_non_volatilized_type (tree);
/* APPLE LOCAL radar 4697411 */
extern void objc_volatilize_component_ref (tree, tree);
/* APPLE LOCAL radar 6231433 */
extern bool objc_compare_types (tree, tree, int, tree, const char *);
/* APPLE LOCAL radar 4229905 - radar 6231433 */
extern bool objc_have_common_type (tree, tree, int, tree, const char *);
/* APPLE LOCAL radar 4133425 */
extern bool objc_diagnose_private_ivar (tree);
/* APPLE LOCAL radar 4507230 */
bool objc_type_valid_for_messaging (tree);
extern void objc_volatilize_decl (tree);
extern bool objc_type_quals_match (tree, tree);
extern tree objc_rewrite_function_call (tree, tree);
@ -900,7 +923,8 @@ extern int objc_is_public (tree, tree);
extern tree objc_is_id (tree);
extern void objc_declare_alias (tree, tree);
extern void objc_declare_class (tree);
extern void objc_declare_protocols (tree);
/* APPLE LOCAL radar 4947311 - protocol attributes */
extern void objc_declare_protocols (tree, tree);
extern tree objc_build_message_expr (tree);
extern tree objc_finish_message_expr (tree, tree, tree);
extern tree objc_build_selector_expr (tree);
@ -910,23 +934,40 @@ extern tree objc_build_string_object (tree);
extern tree objc_get_protocol_qualified_type (tree, tree);
extern tree objc_get_class_reference (tree);
extern tree objc_get_class_ivars (tree);
extern void objc_start_class_interface (tree, tree, tree);
/* APPLE LOCAL begin radar 4291785 */
extern tree objc_get_interface_ivars (tree);
extern void objc_detect_field_duplicates (tree);
/* APPLE LOCAL end radar 4291785 */
/* APPLE LOCAL radar 4548636 */
extern void objc_start_class_interface (tree, tree, tree, tree);
extern void objc_start_category_interface (tree, tree, tree);
extern void objc_start_protocol (tree, tree);
/* APPLE LOCAL radar 4947311 - protocol attributes */
extern void objc_start_protocol (tree, tree, tree);
extern void objc_continue_interface (void);
extern void objc_finish_interface (void);
extern void objc_start_class_implementation (tree, tree);
extern void objc_start_category_implementation (tree, tree);
/* APPLE LOCAL radar 4592503 */
extern void objc_checkon_weak_attribute (tree);
/* APPLE LOCAL begin radar 5847976 */
extern tree build_block_object_assign_call_exp (tree, tree, int);
extern tree build_block_object_dispose_call_exp (tree, int);
extern int objc_is_gcable_type (tree);
/* APPLE LOCAL end radar 5847976 */
extern void objc_continue_implementation (void);
extern void objc_finish_implementation (void);
extern void objc_set_visibility (int);
extern void objc_set_method_type (enum tree_code);
extern tree objc_build_method_signature (tree, tree, tree, bool);
extern void objc_add_method_declaration (tree);
extern void objc_start_method_definition (tree);
/* APPLE LOCAL begin radar 3803157 - objc attribute */
extern bool objc_method_decl (enum tree_code);
extern void objc_add_method_declaration (tree, tree);
extern void objc_start_method_definition (tree, tree);
/* APPLE LOCAL end radar 3803157 - objc attribute */
extern void objc_finish_method_definition (tree);
extern void objc_add_instance_variable (tree);
extern tree objc_build_keyword_decl (tree, tree, tree);
/* APPLE LOCAL radar 4157812 */
extern tree objc_build_keyword_decl (tree, tree, tree, tree);
extern tree objc_build_throw_stmt (tree);
extern void objc_begin_try_stmt (location_t, tree);
extern tree objc_finish_try_stmt (void);
@ -937,6 +978,52 @@ extern tree objc_build_synchronized (location_t, tree, tree);
extern int objc_static_init_needed_p (void);
extern tree objc_generate_static_init_call (tree);
extern tree objc_generate_write_barrier (tree, enum tree_code, tree);
/* APPLE LOCAL radar 5276085 */
extern void objc_weak_reference_expr (tree*);
/* APPLE LOCAL begin 5276085 */
extern tree objc_build_weak_reference_tree (tree);
/* APPLE LOCAL end 5276085 */
/* APPLE LOCAL begin C* language */
extern void objc_set_method_opt (int);
void objc_finish_foreach_loop (location_t, tree, tree, tree, tree);
tree objc_build_component_ref (tree, tree);
tree objc_build_foreach_components (tree, tree*, tree*, tree*,
tree*, tree*, tree*);
/* APPLE LOCAL end C* language */
/* APPLE LOCAL begin C* property (Radar 4436866) */
void objc_set_property_attr (int, tree);
void objc_add_property_variable (tree);
/* APPLE LOCAL begin radar 5285911 */
tree objc_build_property_reference_expr (tree, tree);
bool objc_property_reference_expr (tree);
/* APPLE LOCAL end radar 5285911 */
/* APPLE LOCAL radar 5802025 */
tree objc_build_property_getter_func_call (tree);
tree objc_build_setter_call (tree, tree);
/* APPLE LOCAL end C* property (Radar 4436866) */
/* APPLE LOCAL radar 4712269 */
tree objc_build_incr_decr_setter_call (enum tree_code, tree, tree);
/* APPLE LOCAL begin C* warnings to easy porting to new abi */
void diagnose_selector_cast (tree cast_type, tree sel_exp);
/* APPLE LOCAL end C* warnings to easy porting to new abi */
/* APPLE LOCAL begin radar 4441049 */
tree objc_v2_component_ref_field_offset (tree);
tree objc_v2_bitfield_ivar_bitpos (tree);
/* APPLE LOCAL end radar 4441049 */
/* APPLE LOCAL begin 4985544 */
bool objc_check_format_nsstring (tree, unsigned HOST_WIDE_INT, bool *);
/* APPLE LOCAL end 4985544 */
/* APPLE LOCAL radar 5202926 */
bool objc_anonymous_local_objc_name (const char *);
/* APPLE LOCAL begin radar 5195402 */
bool objc_check_nsstring_pointer_type (tree);
bool objc_check_cfstringref_type (tree);
/* APPLE LOCAL end radar 5195402 */
/* The following are provided by the C and C++ front-ends, and called by
ObjC/ObjC++. */
@ -950,6 +1037,116 @@ extern void pp_file_change (const struct line_map *);
extern void pp_dir_change (cpp_reader *, const char *);
extern bool check_missing_format_attribute (tree, tree);
/* APPLE LOCAL begin radar 5847976 */
/* Runtime support functions used by compiler when generating copy/dispose helpers */
enum {
BLOCK_FIELD_IS_OBJECT = 3, /* id, NSObject, __attribute__((NSObject)), block, ... */
BLOCK_FIELD_IS_BLOCK = 7, /* a block variable */
BLOCK_FIELD_IS_BYREF = 8, /* the on stack structure holding the __block variable */
BLOCK_FIELD_IS_WEAK = 16, /* declared __weak, only used in byref copy helpers */
BLOCK_BYREF_CALLER = 128, /* called from __block (byref) copy/dispose support routines */
BLOCK_BYREF_CURRENT_MAX = 256
};
/* APPLE LOCAL end radar 5847976 */
/* APPLE LOCAL begin radar 5732232 - blocks */
enum {
BLOCK_NEEDS_FREE = (1 << 24),
BLOCK_HAS_COPY_DISPOSE = (1 << 25),
/* APPLE LOCAL radar 6214617 */
BLOCK_HAS_CXX_OBJ = (1 << 26),
BLOCK_IS_GC = (1 << 27),
/* APPLE LOCAL radar 5822844 */
BLOCK_IS_GLOBAL = (1 << 28),
/* APPLE LOCAL radar 7735196 */
BLOCK_USE_STRET = (1 << 29)
};
struct block_sema_info {
tree helper_func_decl;
tree copy_helper_func_decl;
tree destroy_helper_func_decl;
tree block_arg_ptr_type;
/* This is for C. */
struct c_arg_info * arg_info;
tree block_ref_decl_list;
tree block_byref_decl_list;
/* APPLE LOCAL radar 5803600 */
tree block_byref_global_decl_list;
tree block_original_ref_decl_list;
/* APPLE LOCAL radar 5847213 - tree block_original_byref_decl_list is removed. */
tree block_body;
bool BlockHasCopyDispose;
/* APPLE LOCAL radar 6214617 */
bool BlockImportsCxxObjects;
/* APPLE LOCAL radar 6185344 */
bool block_has_return_type; /* When true, block has a declared return type. */
/* the_scope - This is the scope for the block itself, which
contains arguments etc. Use only for C. */
struct c_scope *the_scope;
/* Same as the above, only for C++. */
struct cp_binding_level *cp_the_scope;
/* return_type - This will get set to block result type, by looking
at return types, if any, in the block body. */
tree return_type;
/* prev_block_info - If this is nested inside another block, this points
to the outer block. */
struct block_sema_info *prev_block_info;
};
extern struct block_sema_info *cur_block;
extern tree build_helper_func_decl (tree, tree);
extern tree build_block_byref_decl (tree, tree, tree);
extern tree build_block_ref_decl (tree, tree);
extern tree begin_block (void);
extern struct block_sema_info *finish_block (tree);
extern bool in_imm_block (void);
extern bool lookup_name_in_block (tree, tree*);
extern void push_to_top_level (void);
extern void pop_from_top_level (void);
extern void start_block_helper_function (tree func_decl);
extern void block_build_prologue (struct block_sema_info *block_impl);
extern tree c_finish_return (tree);
extern bool block_requires_copying (tree);
/* APPLE LOCAL begin radar 5803600 */
extern void add_block_global_byref_list (tree);
extern bool in_block_global_byref_list (tree);
/* APPLE LOCAL end radar 5803600 */
/* APPLE LOCAL end radar 5732232 - blocks */
/* APPLE LOCAL begin radar 5932809 - copyable byref blocks */
extern tree build_byref_local_var_access (tree, tree);
extern tree do_digest_init (tree, tree);
/* APPLE LOCAL end radar 5932809 - copyable byref blocks */
/* APPLE LOCAL begin radar 6237713 */
extern bool any_recognized_block_attribute (tree);
/* APPLE LOCAL end radar 6237713 */
/* APPLE LOCAL begin radar 5847213 */
extern tree build_block_descriptor_type (bool);
/* APPLE LOCAL end radar 5847213 */
/* APPLE LOCAL begin radar 6083129 - byref escapes */
extern tree build_block_byref_release_exp (tree);
/* APPLE LOCAL end radar 6083129 - byref escapes */
/* APPLE LOCAL radar 6040305 - blocks */
extern tree build_indirect_object_id_exp (tree);
/* APPLE LOCAL begin radar 6212722 */
extern tree array_to_pointer_conversion (tree);
extern tree function_to_pointer_conversion (tree);
/* APPLE LOCAL end radar 6212722 */
/* APPLE LOCAL radar 6160536 */
extern tree build_block_helper_name (int);
/* APPLE LOCAL radar 6353006 */
extern tree c_build_generic_block_struct_type (void);
/* APPLE LOCAL radar 7760213 */
extern int HasByrefArray(tree);
/* In c-omp.c */
extern tree c_finish_omp_master (tree);
extern tree c_finish_omp_critical (tree, tree);

View File

@ -104,6 +104,10 @@ convert (tree type, tree expr)
return fold_convert (type, c_objc_common_truthvalue_conversion (expr));
if (code == POINTER_TYPE || code == REFERENCE_TYPE)
return fold (convert_to_pointer (type, e));
/* APPLE LOCAL begin blocks (C++ ck) */
if (code == BLOCK_POINTER_TYPE)
return fold (convert_to_block_pointer (type, e));
/* APPLE LOCAL end blocks (C++ ck) */
if (code == REAL_TYPE)
return fold (convert_to_real (type, e));
if (code == COMPLEX_TYPE)

View File

@ -501,6 +501,11 @@ c_cpp_builtins (cpp_reader *pfile)
/* Other target-independent built-ins determined by command-line
options. */
/* APPLE LOCAL begin blocks */
/* APPLE LOCAL radar 5868913 */
if (flag_blocks)
cpp_define (pfile, "__BLOCKS__=1");
/* APPLE LOCAL end blocks */
if (optimize_size)
cpp_define (pfile, "__OPTIMIZE_SIZE__");
if (optimize)

File diff suppressed because it is too large Load Diff

View File

@ -140,4 +140,10 @@ extern void c_initialize_diagnostics (diagnostic_context *);
#undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P
#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P c_vla_unspec_p
/* APPLE LOCAL begin radar 6353006 */
#undef LANG_HOOKS_BUILD_GENERIC_BLOCK_STRUCT_TYPE
#define LANG_HOOKS_BUILD_GENERIC_BLOCK_STRUCT_TYPE \
c_build_generic_block_struct_type
/* APPLE LOCAL end radar 6353006 */
#endif /* GCC_C_OBJC_COMMON */

View File

@ -1040,6 +1040,13 @@ c_common_post_options (const char **pfilename)
if (flag_inline_functions)
flag_inline_trees = 2;
/* APPLE LOCAL begin radar 5811887 - radar 6084601 */
/* In all flavors of c99, except for ObjC/ObjC++, blocks are off by default
unless requested via -fblocks. */
if (flag_blocks == -1 && flag_iso && !c_dialect_objc())
flag_blocks = 0;
/* APPLE LOCAL end radar 5811887 - radar 6084601 */
/* By default we use C99 inline semantics in GNU99 or C99 mode. C99
inline semantics are not supported in GNU89 or C89 mode. */
if (flag_gnu89_inline == -1)

File diff suppressed because it is too large Load Diff

View File

@ -137,6 +137,15 @@ pp_c_star (c_pretty_printer *pp)
pp_base (pp)->padding = pp_none;
}
/* APPLE LOCAL begin blocks */
void
pp_c_caret (c_pretty_printer *pp)
{
pp_carret (pp);
pp_base (pp)->padding = pp_none;
}
/* APPLE LOCAL end blocks */
void
pp_c_arrow (c_pretty_printer *pp)
{
@ -260,6 +269,12 @@ pp_c_pointer (c_pretty_printer *pp, tree t)
pp_c_ampersand (pp);
pp_c_type_qualifier_list (pp, t);
break;
/* APPLE LOCAL begin blocks */
case BLOCK_POINTER_TYPE:
pp_c_caret (pp);
pp_c_type_qualifier_list (pp, t);
break;
/* APPLE LOCAL end blocks */
/* ??? This node is now in GENERIC and so shouldn't be here. But
we'll fix that later. */
@ -405,6 +420,8 @@ pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t)
{
case REFERENCE_TYPE:
case POINTER_TYPE:
/* APPLE LOCAL blocks */
case BLOCK_POINTER_TYPE:
{
/* Get the types-specifier of this type. */
tree pointee = strip_pointer_operator (TREE_TYPE (t));
@ -487,7 +504,10 @@ pp_c_parameter_type_list (c_pretty_printer *pp, tree t)
static void
pp_c_abstract_declarator (c_pretty_printer *pp, tree t)
{
if (TREE_CODE (t) == POINTER_TYPE)
/* APPLE LOCAL begin blocks */
if (TREE_CODE (t) == POINTER_TYPE ||
TREE_CODE (t) == BLOCK_POINTER_TYPE)
/* APPLE LOCAL end blocks */
{
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
@ -510,6 +530,8 @@ pp_c_direct_abstract_declarator (c_pretty_printer *pp, tree t)
switch (TREE_CODE (t))
{
case POINTER_TYPE:
/* APPLE LOCAL blocks */
case BLOCK_POINTER_TYPE:
pp_abstract_declarator (pp, t);
break;
@ -635,6 +657,8 @@ pp_c_direct_declarator (c_pretty_printer *pp, tree t)
case ARRAY_TYPE:
case POINTER_TYPE:
/* APPLE LOCAL blocks */
case BLOCK_POINTER_TYPE:
pp_abstract_declarator (pp, TREE_TYPE (t));
break;

View File

@ -167,6 +167,8 @@ void pp_c_right_bracket (c_pretty_printer *);
void pp_c_dot (c_pretty_printer *);
void pp_c_ampersand (c_pretty_printer *);
void pp_c_star (c_pretty_printer *);
/* APPLE LOCAL blocks */
void pp_c_caret (c_pretty_printer *);
void pp_c_arrow (c_pretty_printer *);
void pp_c_semicolon (c_pretty_printer *);
void pp_c_complement (c_pretty_printer *);

View File

@ -298,6 +298,8 @@ enum c_declarator_kind {
cdk_array,
/* A pointer. */
cdk_pointer,
/* APPLE LOCAL blocks (C++ ch) */
cdk_block_pointer,
/* Parenthesized declarator with nested attributes. */
cdk_attrs
};
@ -468,6 +470,8 @@ extern tree finish_struct (tree, tree, tree);
extern struct c_arg_info *get_parm_info (bool);
extern tree grokfield (struct c_declarator *, struct c_declspecs *, tree);
extern tree groktypename (struct c_type_name *);
/* APPLE LOCAL blocks 6339747 */
extern tree grokblockdecl (struct c_declspecs *, struct c_declarator *);
extern tree grokparm (const struct c_parm *);
extern tree implicitly_declare (tree);
extern void keep_next_level (void);
@ -501,6 +505,10 @@ extern struct c_declarator *build_function_declarator (struct c_arg_info *,
extern struct c_declarator *build_id_declarator (tree);
extern struct c_declarator *make_pointer_declarator (struct c_declspecs *,
struct c_declarator *);
/* APPLE LOCAL begin radar 5814025 - blocks (C++ cg) */
extern struct c_declarator *make_block_pointer_declarator (struct c_declspecs *,
struct c_declarator *);
/* APPLE LOCAL end radar 5814025 - blocks (C++ cg) */
extern struct c_declspecs *build_null_declspecs (void);
extern struct c_declspecs *declspecs_add_qual (struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_type (struct c_declspecs *,
@ -627,6 +635,8 @@ extern bool c_eh_initialized_p;
extern void c_finish_incomplete_decl (tree);
extern void c_write_global_declarations (void);
/* APPLE LOCAL radar 5741070 */
extern tree c_return_interface_record_type (tree);
/* In order for the format checking to accept the C frontend
diagnostic framework extensions, you must include this file before
toplev.h, not after. */

View File

@ -75,6 +75,10 @@ static int missing_braces_mentioned;
static int require_constant_value;
static int require_constant_elements;
/* APPLE LOCAL begin radar 5732232 - blocks (C++ cm) */
static bool types_are_block_compatible (tree lhptee, tree rhptee);
static tree build_block_call (tree, tree, tree);
/* APPLE LOCAL end radar 5732232 - blocks (C++ cm) */
static bool null_pointer_constant_p (tree);
static tree qualify_type (tree, tree);
static int tagged_types_tu_compatible_p (tree, tree);
@ -542,8 +546,12 @@ common_pointer_type (tree t1, tree t2)
if (t2 == error_mark_node)
return t1;
gcc_assert (TREE_CODE (t1) == POINTER_TYPE
&& TREE_CODE (t2) == POINTER_TYPE);
/* APPLE LOCAL begin blocks 6065211 */
gcc_assert ((TREE_CODE (t1) == POINTER_TYPE
&& TREE_CODE (t2) == POINTER_TYPE)
|| (TREE_CODE (t1) == BLOCK_POINTER_TYPE
&& TREE_CODE (t2) == BLOCK_POINTER_TYPE));
/* APPLE LOCAL end blocks 6065211 */
/* Merge the attributes. */
attributes = targetm.merge_type_attributes (t1, t2);
@ -558,10 +566,15 @@ common_pointer_type (tree t1, tree t2)
if (TREE_CODE (mv2) != ARRAY_TYPE)
mv2 = TYPE_MAIN_VARIANT (pointed_to_2);
target = composite_type (mv1, mv2);
t1 = build_pointer_type (c_build_qualified_type
(target,
TYPE_QUALS (pointed_to_1) |
TYPE_QUALS (pointed_to_2)));
/* APPLE LOCAL begin blocks 6065211 */
t1 = c_build_qualified_type (target,
TYPE_QUALS (pointed_to_1) |
TYPE_QUALS (pointed_to_2));
if (TREE_CODE (t2) == BLOCK_POINTER_TYPE)
t1 = build_block_pointer_type (t1);
else
t1 = build_pointer_type (t1);
/* APPLE LOCAL end blocks 6065211 */
return build_type_attribute_variant (t1, attributes);
}
@ -845,6 +858,13 @@ comptypes_internal (tree type1, tree type2)
switch (TREE_CODE (t1))
{
/* APPLE LOCAL begin radar 5795493 */
case BLOCK_POINTER_TYPE:
val = (TREE_CODE (t2) == BLOCK_POINTER_TYPE) &&
types_are_block_compatible (TREE_TYPE (t1), TREE_TYPE (t2));
break;
/* APPLE LOCAL end radar 5795493 */
case POINTER_TYPE:
/* Do not remove mode or aliasing information. */
if (TYPE_MODE (t1) != TYPE_MODE (t2)
@ -937,6 +957,15 @@ comp_target_types (tree ttl, tree ttr)
int val;
tree mvl, mvr;
/* APPLE LOCAL begin blocks 6065211 */
if (TREE_CODE (ttl) == BLOCK_POINTER_TYPE
&& TREE_CODE (ttr) == BLOCK_POINTER_TYPE)
return types_are_block_compatible (TREE_TYPE (ttl),
TREE_TYPE (ttr));
if (TREE_CODE (ttl) != TREE_CODE (ttr))
return 0;
/* APPLE LOCAL end blocks 6065211 */
/* Do not lose qualifiers on element types of array types that are
pointer targets by taking their TYPE_MAIN_VARIANT. */
mvl = TREE_TYPE (ttl);
@ -1485,7 +1514,8 @@ decl_constant_value_for_broken_optimization (tree decl)
}
/* Convert the array expression EXP to a pointer. */
static tree
/* APPLE LOCAL radar 6212722 */
tree
array_to_pointer_conversion (tree exp)
{
tree orig_exp = exp;
@ -1526,7 +1556,8 @@ array_to_pointer_conversion (tree exp)
}
/* Convert the function expression EXP to a pointer. */
static tree
/* APPLE LOCAL radar 6212722 */
tree
function_to_pointer_conversion (tree exp)
{
tree orig_exp = exp;
@ -1803,6 +1834,12 @@ build_component_ref (tree datum, tree component)
if (!objc_is_public (datum, component))
return error_mark_node;
/* APPLE LOCAL begin C* property (Radar 4436866) */
/* APPLE LOCAL radar 5285911 */
if ((ref = objc_build_property_reference_expr (datum, component)))
return ref;
/* APPLE LOCAL end C* property (Radar 4436866) */
/* See if there is a field or component with name COMPONENT. */
if (code == RECORD_TYPE || code == UNION_TYPE)
@ -1841,6 +1878,8 @@ build_component_ref (tree datum, tree component)
ref = build3 (COMPONENT_REF, subtype, datum, subdatum,
NULL_TREE);
/* APPLE LOCAL radar 4697411 */
objc_volatilize_component_ref (ref, TREE_TYPE (subdatum));
if (TREE_READONLY (datum) || TREE_READONLY (subdatum))
TREE_READONLY (ref) = 1;
if (TREE_THIS_VOLATILE (datum) || TREE_THIS_VOLATILE (subdatum))
@ -2073,9 +2112,62 @@ build_external_ref (tree id, int fun, location_t loc)
/* In Objective-C, an instance variable (ivar) may be preferred to
whatever lookup_name() found. */
decl = objc_lookup_ivar (decl, id);
/* APPLE LOCAL begin radar 5732232 - blocks (C++ ci) */
if (decl && decl != error_mark_node)
ref = decl;
{
if (cur_block
&& (TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == PARM_DECL)
&& !lookup_name_in_block (id, &decl))
{
/* APPLE LOCAL begin radar 5803005 (C++ ci) */
bool gdecl;
/* We are referencing a variable inside a block whose declaration
is outside. */
gcc_assert (decl &&
(TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == PARM_DECL));
gdecl = (TREE_CODE (decl) == VAR_DECL &&
/* APPLE LOCAL radar 6177162 */
(DECL_EXTERNAL (decl) || TREE_STATIC (decl)));
/* Treat all 'global' variables as 'byref' by default. */
/* APPLE LOCAL begin radar 6014138 (C++ ci) */
if (gdecl || (TREE_CODE (decl) == VAR_DECL && COPYABLE_BYREF_LOCAL_VAR (decl)))
/* APPLE LOCAL end radar 6014138 (C++ ci) */
{
/* APPLE LOCAL begin radar 5803600 (C++ ci) */
/* byref globals are directly accessed. */
/* APPLE LOCAL begin radar 7760213 */
if (!gdecl) {
if (HasByrefArray(TREE_TYPE (decl)))
error ("cannot access __block variable of array type inside block");
/* build a decl for the byref variable. */
decl = build_block_byref_decl (id, decl, decl);
}
/* APPLE LOCAL end radar 7760213 */
else
add_block_global_byref_list (decl);
}
else
{
/* 'byref' globals are never copied-in. So, do not add
them to the copied-in list. */
if (!in_block_global_byref_list (decl)) {
/* APPLE LOCAL begin radar 7721728 */
if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
error ("cannot access copied-in variable of array type inside block");
/* APPLE LOCAL end radar 7721728 */
/* build a new decl node. set its type to 'const' type
of the old decl. */
decl = build_block_ref_decl (id, decl);
}
/* APPLE LOCAL end radar 5803600 (C++ ci) */
/* APPLE LOCAL end radar 5803005 (C++ ci) */
}
}
ref = decl;
}
/* APPLE LOCAL end radar 5732232 - blocks (C++ ci) */
else if (fun)
/* Implicit function declaration. */
ref = implicitly_declare (id);
@ -2285,8 +2377,10 @@ build_function_call (tree function, tree params)
if (TREE_CODE (fntype) == ERROR_MARK)
return error_mark_node;
if (!(TREE_CODE (fntype) == POINTER_TYPE
/* APPLE LOCAL begin radar 5732232 - blocks */
if (!((TREE_CODE (fntype) == POINTER_TYPE
|| TREE_CODE (fntype) == BLOCK_POINTER_TYPE)
/* APPLE LOCAL end radar 5732232 - blocks */
&& TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE))
{
error ("called object %qE is not a function", function);
@ -2353,6 +2447,11 @@ build_function_call (tree function, tree params)
check_function_arguments (TYPE_ATTRIBUTES (fntype), coerced_params,
TYPE_ARG_TYPES (fntype));
/* APPLE LOCAL begin radar 5732232 - blocks */
if (TREE_CODE (TREE_TYPE (function)) == BLOCK_POINTER_TYPE)
result = build_block_call (fntype, function, coerced_params);
else
/* APPLE LOCAL end radar 5732232 - blocks */
if (require_constant_value)
{
result = fold_build3_initializer (CALL_EXPR, TREE_TYPE (fntype),
@ -2424,7 +2523,17 @@ convert_arguments (tree typelist, tree values, tree function, tree fundecl)
if (type == void_type_node)
{
error ("too many arguments to function %qE", function);
/* APPLE LOCAL begin radar 5732232 - blocks */
if (TREE_CODE (TREE_TYPE (function)) == BLOCK_POINTER_TYPE)
{
error ("too many arguments to block call");
break;
}
/* APPLE LOCAL end radar 5732232 - blocks */
/* APPLE LOCAL begin radar 4491608 */
error ("too many arguments to function %qE", selector ? selector
: function);
/* APPLE LOCAL end radar 4491608 */
break;
}
@ -2607,7 +2716,12 @@ convert_arguments (tree typelist, tree values, tree function, tree fundecl)
if (typetail != 0 && TREE_VALUE (typetail) != void_type_node)
{
error ("too few arguments to function %qE", function);
/* APPLE LOCAL begin radar 5732232 - blocks */
if (TREE_CODE (TREE_TYPE (function)) == BLOCK_POINTER_TYPE)
error ("too few arguments to block %qE", function);
else
error ("too few arguments to function %qE", function);
/* APPLE LOCAL end radar 5732232 - blocks */
return error_mark_node;
}
@ -2870,6 +2984,8 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
case TRUTH_NOT_EXPR:
if (typecode != INTEGER_TYPE
/* APPLE LOCAL radar 5732232 - blocks */
&& typecode != BLOCK_POINTER_TYPE
&& typecode != REAL_TYPE && typecode != POINTER_TYPE
&& typecode != COMPLEX_TYPE)
{
@ -3321,7 +3437,12 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
pedwarn ("ISO C forbids conditional expr with only one void side");
result_type = void_type_node;
}
else if (code1 == POINTER_TYPE && code2 == POINTER_TYPE)
/* APPLE LOCAL begin blocks 6065211 */
else if ((code1 == POINTER_TYPE
|| code1 == BLOCK_POINTER_TYPE)
&& (code2 == POINTER_TYPE
|| code2 == BLOCK_POINTER_TYPE))
/* APPLE LOCAL end blocks 6065211 */
{
if (comp_target_types (type1, type2))
result_type = common_pointer_type (type1, type2);
@ -3329,6 +3450,14 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
result_type = qualify_type (type2, type1);
else if (null_pointer_constant_p (orig_op2))
result_type = qualify_type (type1, type2);
/* APPLE LOCAL begin blocks 6065211 */
else if (code2 == BLOCK_POINTER_TYPE
&& VOID_TYPE_P (TREE_TYPE (type1)))
result_type = type2;
else if (code1 == BLOCK_POINTER_TYPE
&& VOID_TYPE_P (TREE_TYPE (type2)))
result_type = type1;
/* APPLE LOCAL end blocks 6065211 */
else if (VOID_TYPE_P (TREE_TYPE (type1)))
{
if (pedantic && TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE)
@ -3371,7 +3500,31 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
}
result_type = type2;
}
/* APPLE LOCAL begin radar 5732232 - blocks (C++ co) */
/* APPLE LOCAL radar 5957801 */
else if (code1 == BLOCK_POINTER_TYPE && code2 == INTEGER_TYPE)
{
if (!null_pointer_constant_p (orig_op2))
error ("block pointer/integer type mismatch in conditional expression");
else
{
op2 = convert (type1, null_pointer_node);
}
result_type = type1;
}
/* APPLE LOCAL radar 5957801 */
else if (code2 == BLOCK_POINTER_TYPE && code1 == INTEGER_TYPE)
{
if (!null_pointer_constant_p (orig_op1))
error ("block pointer/integer type mismatch in conditional expression");
else
{
op1 = convert (type2, null_pointer_node);
}
result_type = type2;
}
/* APPLE LOCAL end radar 5732232 - blocks (C++ co) */
if (!result_type)
{
if (flag_cond_mismatch)
@ -3510,6 +3663,12 @@ build_c_cast (tree type, tree expr)
otype = TREE_TYPE (value);
/* APPLE LOCAL begin radar 5732232 - blocks */
if (TREE_CODE (otype) == BLOCK_POINTER_TYPE &&
TREE_CODE (type) == POINTER_TYPE && VOID_TYPE_P (TREE_TYPE (type)))
return build1 (NOP_EXPR, type, value);
/* APPLE LOCAL end radar 5732232 - blocks */
/* Optionally warn about potentially worrisome casts. */
if (warn_cast_qual
@ -3613,6 +3772,13 @@ build_c_cast (tree type, tree expr)
pedwarn ("ISO C forbids conversion of object pointer to function pointer type");
ovalue = value;
/* APPLE LOCAL begin don't sign-extend pointers cast to integers */
if (TREE_CODE (type) == INTEGER_TYPE
&& TREE_CODE (otype) == POINTER_TYPE
&& TYPE_PRECISION (type) > TYPE_PRECISION (otype)
&& TYPE_UNSIGNED (type))
value = convert (c_common_type_for_size (POINTER_SIZE, 1), value);
/* APPLE LOCAL end don't sign-extend pointers cast to integers */
value = convert (type, value);
/* Ignore any integer overflow caused by the cast. */
@ -3641,6 +3807,78 @@ build_c_cast (tree type, tree expr)
return value;
}
/* APPLE LOCAL begin radar 5732232 - blocks (C++ cm) */
static bool
functiontypes_are_block_compatible (tree f1, tree f2)
{
tree arg1, arg2;
if (!types_are_block_compatible (TREE_TYPE (f1), TREE_TYPE (f2)))
return false;
arg1 = TYPE_ARG_TYPES (f1);
arg2 = TYPE_ARG_TYPES (f2);
/* APPLE LOCAL radar 6246965, 6196572 */
return (!arg1) || (type_lists_compatible_p (arg1, arg2) == 1);
}
static bool
types_are_block_compatible (tree lhptee, tree rhptee)
{
if (TYPE_MAIN_VARIANT (lhptee) == TYPE_MAIN_VARIANT (rhptee))
return true;
if (TREE_CODE (lhptee) == FUNCTION_TYPE && TREE_CODE (rhptee) == FUNCTION_TYPE)
return functiontypes_are_block_compatible (lhptee, rhptee);
/* APPLE LOCAL begin radar 5882266 (C++ cm) */
if (TREE_CODE (lhptee) == POINTER_TYPE && TREE_CODE (rhptee) == POINTER_TYPE)
return types_are_block_compatible (TREE_TYPE (lhptee), TREE_TYPE (rhptee));
/* APPLE LOCAL end radar 5882266 (C++ cm) */
/* APPLE LOCAL begin radar 5988995 (C++ cm) */
if (TREE_CODE (lhptee) == BLOCK_POINTER_TYPE
&& TREE_CODE (rhptee) == BLOCK_POINTER_TYPE)
return types_are_block_compatible (TREE_TYPE (lhptee), TREE_TYPE (rhptee));
/* APPLE LOCAL end radar 5988995 (C++ cm) */
return false;
}
/* APPLE LOCAL begin radar 5847213 - radar 6329245 */
/**
build_block_call - Routine to build a block call; as in:
((double(*)(void *, int))(BLOCK_PTR_EXP->__FuncPtr))(I, 42);
FNTYPE is the original function type derived from the syntax.
BLOCK_PTR_EXP is the block pointer variable.
PARAMS is the parameter list.
*/
static tree
build_block_call (tree fntype, tree block_ptr_exp, tree params)
{
tree function_ptr_exp;
tree typelist;
bool block_ptr_exp_side_effect = TREE_SIDE_EFFECTS (block_ptr_exp);
/* First convert BLOCK_PTR_EXP to 'void *'. */
block_ptr_exp = convert (ptr_type_node, block_ptr_exp);
gcc_assert (generic_block_literal_struct_type);
block_ptr_exp = convert (build_pointer_type (generic_block_literal_struct_type),
block_ptr_exp);
if (block_ptr_exp_side_effect)
block_ptr_exp = save_expr (block_ptr_exp);
/* BLOCK_PTR_VAR->__FuncPtr */
function_ptr_exp = build_component_ref (build_indirect_ref (block_ptr_exp, "->"),
get_identifier ("__FuncPtr"));
gcc_assert (function_ptr_exp);
/* Build: result_type(*)(void *, function-arg-type-list) */
typelist = TYPE_ARG_TYPES (fntype);
typelist = tree_cons (NULL_TREE, ptr_type_node, typelist);
fntype = build_function_type (TREE_TYPE (fntype), typelist);
function_ptr_exp = convert (build_pointer_type (fntype), function_ptr_exp);
params = tree_cons (NULL_TREE, block_ptr_exp, params);
return fold_build3 (CALL_EXPR, TREE_TYPE (fntype),
function_ptr_exp, params, NULL_TREE);
}
/* APPLE LOCAL end radar 5847213 - radar 6329245 */
/* APPLE LOCAL end radar 5732232 - blocks (C++ cm) */
/* Interpret a cast of expression EXPR to type TYPE. */
tree
c_cast_expr (struct c_type_name *type_name, tree expr)
@ -3670,6 +3908,18 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
tree newrhs;
tree lhstype = TREE_TYPE (lhs);
tree olhstype = lhstype;
/* APPLE LOCAL __block assign sequence point 6639533 */
bool insert_sequence_point = false;
/* APPLE LOCAL begin radar 4426814 */
if (c_dialect_objc () && flag_objc_gc)
{
/* APPLE LOCAL radar 5276085 */
objc_weak_reference_expr (&lhs);
lhstype = TREE_TYPE (lhs);
olhstype = lhstype;
}
/* APPLE LOCAL end radar 4426814 */
/* Types that aren't fully specified cannot be used in assignments. */
lhs = require_complete_type (lhs);
@ -3678,11 +3928,46 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
if (TREE_CODE (lhs) == ERROR_MARK || TREE_CODE (rhs) == ERROR_MARK)
return error_mark_node;
/* APPLE LOCAL radar 5285911 */
if (!lvalue_or_else (lhs, lv_assign))
return error_mark_node;
STRIP_TYPE_NOPS (rhs);
/* APPLE LOCAL begin __block assign sequence point 6639533 */
/* For byref = x;, we have to transform this into {( typeof(x) x' =
x; byref = x`; )} to ensure there is a sequence point before the
evaluation of the byref, inorder to ensure that the access
expression for byref doesn't start running before x is evaluated,
as it will access the __forwarding pointer and that must be done
after x is evaluated. */
/* First we check to see if lhs is a byref... byrefs look like:
__Block_byref_X.__forwarding->x */
if (TREE_CODE (lhs) == COMPONENT_REF)
{
tree inner = TREE_OPERAND (lhs, 0);
/* now check for -> */
if (TREE_CODE (inner) == INDIRECT_REF)
{
inner = TREE_OPERAND (inner, 0);
if (TREE_CODE (inner) == COMPONENT_REF)
{
inner = TREE_OPERAND (inner, 0);
if (TREE_CODE (inner) == VAR_DECL
&& COPYABLE_BYREF_LOCAL_VAR (inner))
{
tree old_rhs = rhs;
/* then we save the rhs. */
rhs = save_expr (rhs);
if (rhs != old_rhs)
/* And arrange for the sequence point to be inserted. */
insert_sequence_point = true;
}
}
}
}
/* APPLE LOCAL end __block assign sequence point 6639533 */
newrhs = rhs;
/* If a binary op has been requested, combine the old LHS value with the RHS
@ -3694,6 +3979,21 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
newrhs = build_binary_op (modifycode, lhs, rhs, 1);
}
/* APPLE LOCAL begin C* property (Radar 4436866) */
if (c_dialect_objc ())
{
result = objc_build_setter_call (lhs, newrhs);
if (result)
/* APPLE LOCAL begin __block assign sequence point 6639533 */
{
if (insert_sequence_point)
result = build2 (COMPOUND_EXPR, TREE_TYPE (result), build1 (NOP_EXPR, void_type_node, rhs), result);
return result;
}
/* APPLE LOCAL end __block assign sequence point 6639533 */
}
/* APPLE LOCAL end C* property (Radar 4436866) */
/* Give an error for storing in something that is 'const'. */
if (TREE_READONLY (lhs) || TYPE_READONLY (lhstype)
@ -3738,7 +4038,13 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
{
result = objc_generate_write_barrier (lhs, modifycode, newrhs);
if (result)
return result;
/* APPLE LOCAL begin __block assign sequence point 6639533 */
{
if (insert_sequence_point)
result = build2 (COMPOUND_EXPR, TREE_TYPE (result), build1 (NOP_EXPR, void_type_node, rhs), result);
return result;
}
/* APPLE LOCAL end __block assign sequence point 6639533 */
}
/* Scan operands. */
@ -3746,6 +4052,11 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
result = build2 (MODIFY_EXPR, lhstype, lhs, newrhs);
TREE_SIDE_EFFECTS (result) = 1;
/* APPLE LOCAL begin __block assign sequence point 6639533 */
if (insert_sequence_point)
result = build2 (COMPOUND_EXPR, TREE_TYPE (result), build1 (NOP_EXPR, void_type_node, rhs), result);
/* APPLE LOCAL end __block assign sequence point 6639533 */
/* If we got the LHS in a different type for storing in,
convert the result back to the nominal type of LHS
so that the value we return always has the same type
@ -3859,7 +4170,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
break;
}
objc_ok = objc_compare_types (type, rhstype, parmno, rname);
/* APPLE LOCAL radar 6231433 */
objc_ok = objc_compare_types (type, rhstype, parmno, rname, "comparison");
}
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype))
@ -3879,7 +4191,10 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
This code doesn't fully support references, it's just for the
special case of va_start and va_copy. */
if (codel == REFERENCE_TYPE
&& comptypes (TREE_TYPE (type), TREE_TYPE (rhs)) == 1)
/* APPLE LOCAL begin radar 4502186 */
&& comptypes (objc_non_volatilized_type (TREE_TYPE (type)),
objc_non_volatilized_type (TREE_TYPE (rhs))) == 1)
/* APPLE LOCAL end radar 4502186 */
{
if (!lvalue_p (rhs))
{
@ -4030,8 +4345,13 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
else if ((codel == POINTER_TYPE || codel == REFERENCE_TYPE)
&& (coder == codel))
{
tree ttl = TREE_TYPE (type);
tree ttr = TREE_TYPE (rhstype);
/* APPLE LOCAL begin radar 4193359 */
/* Types differing only by the presence of the 'volatile'
qualifier are acceptable if the 'volatile' has been added
in by the Objective-C EH machinery. */
tree ttl = objc_non_volatilized_type (TREE_TYPE (type));
tree ttr = objc_non_volatilized_type (TREE_TYPE (rhstype));
/* APPLE LOCAL end radar 4193359 */
tree mvl = ttl;
tree mvr = ttr;
bool is_opaque_pointer;
@ -4123,10 +4443,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
{
if (TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl))
{
/* Types differing only by the presence of the 'volatile'
qualifier are acceptable if the 'volatile' has been added
in by the Objective-C EH machinery. */
if (!objc_type_quals_match (ttl, ttr))
/* APPLE LOCAL begin radar 4193359 */
WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE discards "
"qualifiers from pointer target type"),
G_("assignment discards qualifiers "
@ -4207,6 +4524,43 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
return convert (type, rhs);
}
/* APPLE LOCAL begin radar 5732232 - blocks */
else if (codel == BLOCK_POINTER_TYPE && coder == INTEGER_TYPE)
{
if (!null_pointer_constant_p (rhs))
{
error("invalid conversion %s integer 'int', expected block pointer",
errtype == ic_assign ? "assigning" : "initializing");
return error_mark_node;
}
return build_int_cst (type, 0);
}
else if (codel == BLOCK_POINTER_TYPE && coder == codel)
{
tree lhptee = TREE_TYPE (type);
tree rhptee = TREE_TYPE(rhstype);
if (lhptee == rhptee)
return rhs;
if (!types_are_block_compatible (lhptee, rhptee))
{
error ("incompatible block pointer types %s %qT, expected %qT",
errtype == ic_assign ? "assigning" : "initializing",
rhstype, type);
return error_mark_node;
}
return rhs;
}
/* APPLE LOCAL begin radar 5831855 */
/* APPLE LOCAL radar 5878380 */
else if (codel == BLOCK_POINTER_TYPE && POINTER_TYPE_P (rhstype) &&
(VOID_TYPE_P (TREE_TYPE (rhstype)) || objc_is_id (rhstype)))
return convert (type, rhs);
/* APPLE LOCAL radar 5878380 */
else if (coder == BLOCK_POINTER_TYPE && POINTER_TYPE_P (type) &&
(VOID_TYPE_P (TREE_TYPE (type)) || objc_is_id (type)))
/* APPLE LOCAL end radar 5831855 */
return convert (type, rhs);
/* APPLE LOCAL end radar 5732232 - blocks */
else if (codel == INTEGER_TYPE && coder == POINTER_TYPE)
{
WARN_FOR_ASSIGNMENT (G_("passing argument %d of %qE makes integer "
@ -4228,7 +4582,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
case ic_argpass_nonproto:
/* ??? This should not be an error when inlining calls to
unprototyped functions. */
error ("incompatible type for argument %d of %qE", parmnum, rname);
error ("convert_for_assignment: incompatible type for argument %d of %qE", parmnum, rname);
break;
case ic_assign:
error ("incompatible types in assignment");
@ -4541,6 +4895,13 @@ maybe_warn_string_init (tree type, struct c_expr expr)
pedwarn_init ("array initialized from parenthesized string constant");
}
/* APPLE LOCAL begin radar 5932809 - copyable byref blocks */
tree do_digest_init (tree type, tree init)
{
return digest_init (type, init, true, false);
}
/* APPLE LOCAL end radar 5932809 - copyable byref blocks */
/* Digest the parser output INIT as an initializer for type TYPE.
Return a C expression of type TYPE to represent the initial value.
@ -4750,7 +5111,10 @@ digest_init (tree type, tree init, bool strict_string, int require_constant)
}
/* Added to enable additional -Wmissing-format-attribute warnings. */
if (TREE_CODE (TREE_TYPE (inside_init)) == POINTER_TYPE)
/* APPLE LOCAL begin radar 5822844 */
if (TREE_CODE (TREE_TYPE (inside_init)) == POINTER_TYPE ||
TREE_CODE (TREE_TYPE (inside_init)) == BLOCK_POINTER_TYPE)
/* APPLE LOCAL end radar 5822844 */
inside_init = convert_for_assignment (type, inside_init, ic_init, NULL_TREE,
NULL_TREE, 0);
return inside_init;
@ -4759,6 +5123,8 @@ digest_init (tree type, tree init, bool strict_string, int require_constant)
/* Handle scalar types, including conversions. */
if (code == INTEGER_TYPE || code == REAL_TYPE || code == POINTER_TYPE
/* APPLE LOCAL radar 5732232 - blocks */
|| code == BLOCK_POINTER_TYPE
|| code == ENUMERAL_TYPE || code == BOOLEAN_TYPE || code == COMPLEX_TYPE
|| code == VECTOR_TYPE)
{
@ -5475,6 +5841,16 @@ pop_init_level (int implicit)
{
if (constructor_erroneous)
ret.value = error_mark_node;
/* APPLE LOCAL begin radar 4188876 */
else if (!constructor_constant
&& TREE_CODE (constructor_type) == VECTOR_TYPE && constructor_decl
&& (TREE_CODE (TREE_TYPE (constructor_decl)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (constructor_decl)) == UNION_TYPE))
{
error ("Initializer is a non-const vector type");
ret.value = error_mark_node;
}
/* APPLE LOCAL end radar 4188876 */
else
{
ret.value = build_constructor (constructor_type,
@ -6943,14 +7319,85 @@ c_finish_goto_ptr (tree expr)
return add_stmt (build1 (GOTO_EXPR, void_type_node, expr));
}
/* APPLE LOCAL begin radar 5732232 - blocks (C++ cm) */
/** c_finish_block_return_stmt - Utilty routine to figure out block's return
type.
*/
static tree
c_finish_block_return_stmt (tree retval)
{
tree valtype;
/* If this is the first return we've seen in the block, infer the type of
the block from it. */
if (cur_block->return_type == NULL_TREE)
{
tree restype;
if (retval)
{
restype = TYPE_MAIN_VARIANT (TREE_TYPE (retval));
TREE_TYPE (current_function_decl)
= build_function_type (restype,
TYPE_ARG_TYPES (TREE_TYPE (current_function_decl)));
TREE_TYPE (DECL_RESULT (current_function_decl)) = restype;
relayout_decl (DECL_RESULT (current_function_decl));
}
else
restype = void_type_node;
cur_block->return_type = restype;
}
/* Verify that this result type matches the previous one. We are
pickier with blocks than for normal functions because this is a
new feature and we set the rules. */
if (TREE_CODE (cur_block->return_type) == VOID_TYPE)
{
if (retval)
{
error ("void block should not return a value");
retval = NULL_TREE;
}
return retval;
}
if (!retval)
{
error ("non-void block should return a value");
return error_mark_node;
}
/* We have a non-void block with an expression, continue checking. */
valtype = TREE_TYPE (retval);
/* For now, restrict multiple return statements in a block to have
strict compatible types only. */
if (!types_are_block_compatible (cur_block->return_type, valtype))
error ("incompatible type returning %qT, expected %qT",
valtype, cur_block->return_type);
return retval;
}
/* APPLE LOCAL end radar 5732232 - blocks (C++ cm) */
/* Generate a C `return' statement. RETVAL is the expression for what
to return, or a null pointer for `return;' with no value. */
tree
c_finish_return (tree retval)
{
tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl)), ret_stmt;
/* APPLE LOCAL begin radar 5732232 - blocks */
tree valtype, ret_stmt;
bool no_warning = false;
/* APPLE LOCAL radar 5822844 - radar 6185344 */
if (cur_block && !cur_block->block_has_return_type)
{
retval = c_finish_block_return_stmt (retval);
if (retval == error_mark_node)
return NULL_TREE;
}
valtype = TREE_TYPE (TREE_TYPE (current_function_decl));
/* APPLE LOCAL end radar 5732232 - blocks */
if (TREE_THIS_VOLATILE (current_function_decl))
warning (0, "function declared %<noreturn%> has a %<return%> statement");
@ -7027,7 +7474,15 @@ c_finish_return (tree retval)
&& !DECL_EXTERNAL (inner)
&& !TREE_STATIC (inner)
&& DECL_CONTEXT (inner) == current_function_decl)
warning (0, "function returns address of local variable");
/* APPLE LOCAL begin radar 5732232 - blocks (C++ cn) */
{
if (TREE_CODE (valtype) == BLOCK_POINTER_TYPE)
/* APPLE LOCAL radar 6048570 */
error ("returning block that lives on the local stack");
else
warning (0, "function returns address of local variable");
}
/* APPLE LOCAL end radar 5732232 - blocks (C++ cn) */
break;
default:
@ -7295,6 +7750,11 @@ c_finish_loop (location_t start_locus, tree cond, tree incr, tree body,
then we just build a jump back to the top. */
exit = build_and_jump (&LABEL_EXPR_LABEL (top));
/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
/* Add the attributes to the 'top' label. */
decl_attributes (&LABEL_EXPR_LABEL (top), attrs, 0);
/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
if (cond && !integer_nonzerop (cond))
{
/* Canonicalize the loop condition to the end. This means
@ -7840,7 +8300,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
return error_mark_node;
}
objc_ok = objc_compare_types (type0, type1, -3, NULL_TREE);
objc_ok = objc_compare_types (type0, type1, -3, NULL_TREE, "comparison");
switch (code)
{
@ -7941,8 +8401,12 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
case TRUTH_OR_EXPR:
case TRUTH_XOR_EXPR:
if ((code0 == INTEGER_TYPE || code0 == POINTER_TYPE
/* APPLE LOCAL radar 5928316 */
|| code0 == BLOCK_POINTER_TYPE
|| code0 == REAL_TYPE || code0 == COMPLEX_TYPE)
&& (code1 == INTEGER_TYPE || code1 == POINTER_TYPE
/* APPLE LOCAL radar 5928316 */
|| code1 == BLOCK_POINTER_TYPE
|| code1 == REAL_TYPE || code1 == COMPLEX_TYPE))
{
/* Result of these operations is always an int,
@ -8023,7 +8487,10 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE
|| code1 == COMPLEX_TYPE))
short_compare = 1;
else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
/* APPLE LOCAL begin blocks 6065211 */
else if ((code0 == POINTER_TYPE || code0 == BLOCK_POINTER_TYPE)
&& (code1 == POINTER_TYPE || code1 == BLOCK_POINTER_TYPE))
/* APPLE LOCAL end blocks 6065211 */
{
tree tt0 = TREE_TYPE (type0);
tree tt1 = TREE_TYPE (type1);
@ -8032,6 +8499,12 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
and both must be object or both incomplete. */
if (comp_target_types (type0, type1))
result_type = common_pointer_type (type0, type1);
/* APPLE LOCAL begin blocks 6065211 */
else if (code1 == BLOCK_POINTER_TYPE && VOID_TYPE_P (tt0))
;
else if (code0 == BLOCK_POINTER_TYPE && VOID_TYPE_P (tt1))
;
/* APPLE LOCAL end blocks 6065211 */
else if (VOID_TYPE_P (tt0))
{
/* op0 != orig_op0 detects the case of something
@ -8051,7 +8524,14 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
else
/* Avoid warning about the volatile ObjC EH puts on decls. */
if (!objc_ok)
pedwarn ("comparison of distinct pointer types lacks a cast");
/* APPLE LOCAL begin blocks 6065211 */
{
if (code0 == BLOCK_POINTER_TYPE || code1 == BLOCK_POINTER_TYPE)
pedwarn ("comparison of distinct block types lacks a cast");
else
pedwarn ("comparison of distinct pointer types lacks a cast");
}
/* APPLE LOCAL end blocks 6065211 */
if (result_type == NULL_TREE)
result_type = ptr_type_node;
@ -8088,6 +8568,12 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
result_type = type1;
pedwarn ("comparison between pointer and integer");
}
/* APPLE LOCAL begin radar 5732232 - blocks (C++ cl) */
else if (code0 == BLOCK_POINTER_TYPE && null_pointer_constant_p (orig_op1))
result_type = type0;
else if (code1 == BLOCK_POINTER_TYPE && null_pointer_constant_p (orig_op0))
result_type = type1;
/* APPLE LOCAL end radar 5732232 - blocks (C++ cl) */
break;
case LE_EXPR:

View File

@ -610,6 +610,12 @@ C++ ObjC++ Joined
fnew-abi
C++ ObjC++
; APPLE LOCAL begin nested functions 4258406 4357979
fnested-functions
C ObjC Var(flag_nested_functions)
Allow nested functions.
; APPLE LOCAL end nested functions 4258406 4357979
fnext-runtime
ObjC ObjC++
Generate code for NeXT (Apple Mac OS X) runtime environment
@ -644,6 +650,12 @@ fobjc-gc
ObjC ObjC++ Var(flag_objc_gc)
Enable garbage collection (GC) in Objective-C/Objective-C++ programs
; APPLE LOCAL begin radar 5811887 - blocks
fblocks
C ObjC C++ ObjC++ Var(flag_blocks) Init(-1)
Program supports c/objc extension blocks
; APPLE LOCAL end radar 5811887 - blocks
; Nonzero means that we generate NeXT setjmp based exceptions.
fobjc-sjlj-exceptions
ObjC ObjC++ Var(flag_objc_sjlj_exceptions) Init(-1)

View File

@ -2051,7 +2051,8 @@ expand_call (tree exp, rtx target, int ignore)
/* Operand 0 is a pointer-to-function; get the type of the function. */
funtype = TREE_TYPE (addr);
gcc_assert (POINTER_TYPE_P (funtype));
/* APPLE LOCAL blocks */
gcc_assert (POINTER_TYPE_P (funtype) || TREE_CODE (funtype) == BLOCK_POINTER_TYPE);
funtype = TREE_TYPE (funtype);
/* Munge the tree to split complex arguments into their imaginary

View File

@ -302,6 +302,8 @@ struct cgraph_node *cgraph_master_clone (struct cgraph_node *);
void cgraph_add_new_function (tree);
/* In cgraphunit.c */
/* APPLE LOCAL radar 6305545 */
void lower_if_nested_functions (tree);
bool cgraph_assemble_pending_functions (void);
bool cgraph_varpool_assemble_pending_decls (void);
void cgraph_finalize_function (tree, bool);

View File

@ -458,6 +458,19 @@ cgraph_lower_function (struct cgraph_node *node)
node->lowered = true;
}
/* APPLE LOCAL begin radar 6305545 */
/** lower_if_nested_functions - This routine is called from cplus side only.
Its purpose is to lower block helper (or any other nested function)
which may have been nested in a constructor or destructor. We have to
do this because structors are cloned and are not lowered themselves (which
is the only way to lower the nested functions). */
void
lower_if_nested_functions (tree decl)
{
lower_nested_functions (decl, true);
}
/* APPLE LOCAL end radar 6305545 */
/* DECL has been parsed. Take it, queue it, compile it at the whim of the
logic in effect. If NESTED is true, then our caller cannot stand to have
the garbage collector run at the moment. We would need to either create
@ -476,7 +489,8 @@ cgraph_finalize_function (tree decl, bool nested)
node->local.finalized = true;
node->lowered = DECL_STRUCT_FUNCTION (decl)->cfg != NULL;
if (node->nested)
lower_nested_functions (decl);
/* APPLE LOCAL radar 6305545 */
lower_nested_functions (decl, false);
gcc_assert (!node->nested);
/* If not unit at a time, then we need to create the call graph

View File

@ -2370,12 +2370,17 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
if (i1 && GET_CODE (newpat) != CLOBBER)
{
/* Before we can do this substitution, we must redo the test done
above (see detailed comments there) that ensures that I1DEST
isn't mentioned in any SETs in NEWPAT that are field assignments. */
if (! combinable_i3pat (NULL_RTX, &newpat, i1dest, NULL_RTX,
0, (rtx*) 0))
/* Check that an autoincrement side-effect on I1 has not been lost.
This happens if I1DEST is mentioned in I2 and dies there, and
has disappeared from the new pattern. */
if ((FIND_REG_INC_NOTE (i1, NULL_RTX) != 0
&& !i1_feeds_i3
&& dead_or_set_p (i2, i1dest)
&& !reg_overlap_mentioned_p (i1dest, newpat))
/* Before we can do this substitution, we must redo the test done
above (see detailed comments there) that ensures that I1DEST
isn't mentioned in any SETs in NEWPAT that are field assignments. */
|| !combinable_i3pat (NULL_RTX, &newpat, i1dest, NULL_RTX, 0, 0))
{
undo_all ();
return 0;

View File

@ -873,7 +873,9 @@ enum machopic_addr_class {
#define DARWIN_REGISTER_TARGET_PRAGMAS() \
do { \
c_register_pragma (0, "mark", darwin_pragma_ignore); \
/* APPLE LOCAL begin pragma mark 5614511 */ \
/* Removed mark. */ \
/* APPLE LOCAL end pragma mark 5614511 */ \
c_register_pragma (0, "options", darwin_pragma_options); \
c_register_pragma (0, "segment", darwin_pragma_ignore); \
c_register_pragma (0, "unused", darwin_pragma_unused); \

View File

@ -64,17 +64,66 @@ convert_to_pointer (tree type, tree expr)
case BOOLEAN_TYPE:
if (TYPE_PRECISION (TREE_TYPE (expr)) != POINTER_SIZE)
expr = fold_build1 (NOP_EXPR,
lang_hooks.types.type_for_size (POINTER_SIZE, 0),
lang_hooks.types.type_for_size (POINTER_SIZE, 0),
expr);
return fold_build1 (CONVERT_EXPR, type, expr);
default:
error ("cannot convert to a pointer type");
return convert_to_pointer (type, integer_zero_node);
/* APPLE LOCAL begin blocks (C++ ck) */
case BLOCK_POINTER_TYPE:
/* APPLE LOCAL begin radar 5809099 */
if (objc_is_id (type)
|| (TREE_CODE (type) == POINTER_TYPE && VOID_TYPE_P (TREE_TYPE (type))))
/* APPLE LOCAL end radar 5809099 */
return fold_build1 (NOP_EXPR, type, expr);
/* APPLE LOCAL end blocks (C++ ck) */
default:
error ("cannot convert to a pointer type");
return convert_to_pointer (type, integer_zero_node);
}
}
/* APPLE LOCAL begin blocks (C++ ck) */
tree
convert_to_block_pointer (tree type, tree expr)
{
if (TREE_TYPE (expr) == type)
return expr;
if (integer_zerop (expr))
{
tree t = build_int_cst (type, 0);
if (TREE_OVERFLOW (expr) || TREE_CONSTANT_OVERFLOW (expr))
t = force_fit_type (t, 0, TREE_OVERFLOW (expr),
TREE_CONSTANT_OVERFLOW (expr));
return t;
}
switch (TREE_CODE (TREE_TYPE (expr)))
{
case BLOCK_POINTER_TYPE:
return fold_build1 (NOP_EXPR, type, expr);
case INTEGER_TYPE:
if (TYPE_PRECISION (TREE_TYPE (expr)) != POINTER_SIZE)
expr = fold_build1 (NOP_EXPR,
lang_hooks.types.type_for_size (POINTER_SIZE, 0),
expr);
return fold_build1 (CONVERT_EXPR, type, expr);
case POINTER_TYPE:
/* APPLE LOCAL radar 5809099 */
if (objc_is_id (TREE_TYPE (expr)) || VOID_TYPE_P (TREE_TYPE (TREE_TYPE (expr))))
return build1 (NOP_EXPR, type, expr);
/* fall thru */
default:
error ("cannot convert to a block pointer type");
return convert_to_block_pointer (type, integer_zero_node);
}
}
/* APPLE LOCAL end blocks (C++ ck) */
/* Avoid any floating point extensions from EXP. */
tree
strip_float_extensions (tree exp)
@ -459,6 +508,8 @@ convert_to_integer (tree type, tree expr)
{
case POINTER_TYPE:
case REFERENCE_TYPE:
/* APPLE LOCAL radar 6035389 */
case BLOCK_POINTER_TYPE:
if (integer_zerop (expr))
return build_int_cst (type, 0);

View File

@ -26,5 +26,7 @@ extern tree convert_to_pointer (tree, tree);
extern tree convert_to_real (tree, tree);
extern tree convert_to_complex (tree, tree);
extern tree convert_to_vector (tree, tree);
/* APPLE LOCAL blocks */
extern tree convert_to_block_pointer (tree, tree);
#endif /* GCC_CONVERT_H */

View File

@ -1,9 +1,661 @@
2008-11-07 Fariborz Jahanian <fjahanian@apple.com>
Radar 5847976
* decl.c (synth_block_byref_id_object_copy_func): Takes new 'flag' argument
and produces the new much simplified API.
(synth_block_byref_id_object_dispose_func): Ditto.
(new_block_byref_decl): Turn off -fobjc-gc so we don't get
bogus warning on field declared as __weak.
(init_byref_decl): Takes a new 'flag' argument and passes
it down to synth_block_byref_id_object_copy_func and
synth_block_byref_id_object_dispose_func.
(cp_finish_decl): Calculates the flag for the block
variable declaration and passes it down to init_byref_decl.
* parser.c (build_block_struct_initlist): Removes call to
copy_in_object (not needed).
(synth_copy_helper_block_func): Produce the new, simplified
API.
(synth_destroy_helper_block_func): Ditto.
(build_block_byref_decl): Copy over COPYABLE_WEAK_BLOCK flag.
2008-10-31 Fariborz Jahanian <fjahanian@apple.com>
Radar 6175959
* parser.c (synth_copy_helper_block_func): Use the new API
_Block_object_assign for ObjC object copying.
(block_object_dispose): New
(synth_destroy_helper_block_func): Call block_object_dispose
to use new _Block_object_dispose API for ObjC object release.
2008-10-27 Fariborz Jahanian <fjahanian@apple.com>
Radar 6231433
* typeck.c (objc_compare_types, objc_have_common_type):
Take an extra argument for better diagnostics.
* call.c: Ditto
2010-03-16 Fariborz Jahanian <fjahanian@apple.com>
Radar 7760213
* semantics.c (get_final_block_variable): Diagnose
access of __block array.
2010-03-12 Fariborz Jahanian <fjahanian@apple.com>
Radar 7735196
* cp/parser.c (build_block_struct_initlist):
Set BLOCK_USE_STRET flag in block descriptor for
blocks which return their aggregate value in memory.
2010-03-05 Fariborz Jahanian <fjahanian@apple.com>
Radar 7721728
* semantics.c (get_final_block_variable): Diagnose
importation of copied-in variables.
2009-02-11 Fariborz Jahanian <fjahanian@apple.com>
Radar 6573923
* decl.c (synth_block_byref_id_object_copy_func,
synth_block_byref_id_object_dispose_func): Set BLOCK_BYREF_CALLER
flag in call to copy/dispose helper functions.
2009-02-11 Fariborz Jahanian <fjahanian@apple.com>
Radar 6545782
* semantics.c (get_final_block_variable): New
(finish_id_expression): Call get_final_block_variable.
2008-10-27 Fariborz Jahanian <fjahanian@apple.com>
Radar 6302949
* parser.c (objc_cp_parser_at_property): Warn on missing
',' separator for property attribute list.
2008-10-24 Fariborz Jahanian <fjahanian@apple.com>
Radar 6305545
* semantics.c (expand_or_defer_fn): Lower nested function
of the structors.
2008-10-24 Fariborz Jahanian <fjahanian@apple.com>
Radar 5847213 (minor tweak)
* parser.c (build_block_descriptor_type):
Make descriptor_ptr_type and descriptor_ptr_type_with_copydispose
visible to pch.
2008-10-17 Fariborz Jahanian <fjahanian@apple.com>
Radar 6289031
* decl.c: Removed all code related to
radar 6083129 (byref escapes).
2008-10-15 Fariborz Jahanian <fjahanian@apple.com>
Radar 6271728
* parser.c (cp_parser_objc_method_definition_list): Method
definition always start with '{', or it is error.
2008-10-14 Fariborz Jahanian <fjahanian@apple.com>
Radar 6275956
* semantics.c (finish_this_expr): Reference to "this" in a block
must be looked up.
2008-10-10 Fariborz Jahanian <fjahanian@apple.com>
Radar 5847213 - New Block ABI
* typeck.c (build_block_call): New code gen for block call.
* parser.c (build_descriptor_block_decl) New
(build_block_struct_type): New block literal type.
(build_block_struct_initlist): New block literal initializers.
(build_block_literal_tmp): New block literal variable initialization.
(synth_copy_helper_block_func): Fixed a minor bug (unrelated to this radar).
(build_block_internal_types): Removed.
(build_block_descriptor_type): New routine to build build descriptor type.
(make_block_pointer_declarator): Unnecessary code is removed.
2008-10-02 Fariborz Jahanian <fjahanian@apple.com>
Radar 6246527
* parser.c (cp_parser_block_literal_expr): Call to do the delta
on printf attribute.
2008-09-30 Fariborz Jahanian <fjahanian@apple.com>
Radar 6230297
* c-parser.c (build_block_struct_initlist): 'trivial'
block temporary can be static as well.
(build_block_literal_tmp): Accomodate 'trivial' block
literal temporary variable as static.
2008-09-30 Fariborz Jahanian <fjahanian@apple.com>
Radar 6230297
* parser.c (build_block_struct_initlist): 'trivial'
block temporary can be static as well.
(build_block_literal_tmp): Accomodate 'trivial' block
literal temporary variable as static.
2008-09-30 Fariborz Jahanian <fjahanian@apple.com>
Radar 6225809
* parser.c (build_block_byref_decl): Add __block vaiables
to intervening blocks.
2008-09-29 Fariborz Jahanian <fjahanian@apple.com>
Radar 6154598
tree.c (maybe_dummy_object): Build expression for
copied in "this" in the block.
2008-09-26 Fariborz Jahanian <fjahanian@apple.com>
Radar 6243400
* parser.c (build_block_struct_type): Mostly rewritten
to use C++'s API for building block's main struct so structors
for those data members requiring them are synthesized and
used.
2008-09-25 Fariborz Jahanian <fjahanian@apple.com>
Radar 6244520
* decl.c (new_block_byref_decl): New field added to
struct __Block_byref_x.
(init_byref_decl): Above field initialized to NULL.
2008-09-25 Fariborz Jahanian <fjahanian@apple.com>
Radar 6237713
* parser.c (cp_parser_block_literal_expr): Parse
and set attribute on block literals.
2008-09-16 Fariborz Jahanian <fjahanian@apple.com>
Radar 6214617
* parser.c (cp_block_requires_copying): New
(build_block_struct_type): Set BlockImportsCxxObjects flag.
(build_block_struct_initlist): Set BLOCK_HAS_CXX_OBJ if need be.
(synth_copy_helper_block_func): Call copy ctor if copied in object has one.
(synth_destroy_helper_block_func): Call dtor on cxx object.
2008-09-12 Fariborz Jahanian <fjahanian@apple.com>
Radar 6212722 (tweak)
* parser.c (build_block_ref_decl): Use decay_conversion.
2008-09-09 Fariborz Jahanian <fjahanian@apple.com>
Radar 6169580
* decl.c (synth_block_byref_id_object_copy_func): Pass new flag
to finish_function.
(synth_block_byref_id_object_): Ditto.
(finish_function): Don't pop the nested class when synthesizing
block helpers.
* semantics.c (finish_id_expression): Added logic to attach
copied-in "this" to stand-alone field reference in a block.
* parser.c (synth_copy_helper_block_func, synth_destroy_helper_block_func):
Pass new flag to finish_function.
(cp_parser_block_literal_expr): When block is in non-static member
function, need to import "this" as a read-only copied in variable.
2008-09-05 Fariborz Jahanian <fjahanian@apple.com>
Radar 6169527
* parser.c (build_block_struct_type): Set CLASSTYPE_AS_BASE.
(build_block_internal_types): Ditto.
(build_block_struct_initlist): Rewritten.
(build_block_literal_tmp): Rewritten.
(build_block_ref_decl): Just add copied-in variable to
the scope.
(declare_block_prologue_local_vars): Rewritten.
(declare_block_prologue_local_byref_vars): New
(block_build_prologue): Call declare_block_prologue_local_byref_vars
for byref variables.
2008-09-03 Fariborz Jahanian <fjahanian@apple.com>
Radar 6185344
* typeck.c (check_return_expr): Added extra check
for return type checking.
* parser.c (cp_parser_direct_declarator): Added
extra check for type used as block return type.
(cp_parser_block_literal_expr): Parse and handle
user provided block return type syntax.
2008-08-28 Fariborz Jahanian <fjahanian@apple.com>
Radar 6160536
* parser.c (cp_parser_block_literal_expr): Call build_block_helper_name
to get pretty name for block helper function.
2008-08-28 Fariborz Jahanian <fjahanian@apple.com>
Radar 6180456
* decl.c (synth_block_byref_id_object_copy_func): Use different
API when copying __block object in c language.
(synth_block_byref_id_object_dispose_func): Use different
API when releasing a __block object in c.
* parser.c (synth_copy_helper_block_func): Refactored to
call build_block_byref_assign_copy_decl().
2008-08-27 Fariborz Jahanian <fjahanian@apple.com>
Radar 6087117
* typeck.c (convert_arguments): Takes an extra argument
for distiguinsing block call to function calls.
(build_function_call): Tell convert_arguments if we
are calling a block.
2008-08-24 Caroline Tice <ctice@apple.com.
Radar 6144664
* parser.c (build_block_byref_decl): Assign the
source location for each byref decl to the source
location of the helper function decl.
(build_block_ref_decl): Ditto for ref decls.
2008-07-21 Fariborz Jahanian <fjahanian@apple.com>
Radar 6029624
* call.c (objcp_reference_related_p): New
* cp-tree.h (objcp_reference_related_p): New decl.
2008-06-05 Fariborz Jahanian <fjahanian@apple.com>
Radar 5982990
* parser.c (cp_parser_compound_statement): Take a new
argument which is used to call objc_mark_locals_volatile.
(cp_parser_primary_expression, cp_parser_statement,
etc.): add extra argument in calling cp_parser_compound_statement.
(cp_parser_objc_synchronized_statement): Passes
flag_objc_sjlj_exceptions as last argument in calling
cp_parser_compound_statement.
2008-03-20 Fariborz Jahanian <fjahanian@apple.com>
Radar 5802025
* typeck.c (finish_class_member_access_expr): Generate getter call
from an OBJC_PROPERTY_REFERENCE_EXPR.
2008-03-19 Fariborz Jahanian <fjahanian@apple.com>
Radar 5733674
* decl.c (expand_static_init): Generate write barrier for
static initialization in objective-c++ mode.
2008-02-20 Fariborz Jahanian <fjahanian@apple.com>
Radar 5732232 - code gen part 2.
* cp-lang.c (c_finish_return): Defined these
templates to get a clean compile.
2007-08-22 Fariborz Jahanian <fjahanian@apple.com>
Radar 4947311
* parser.c (cp_parser_objc_protocol_declaration): Takes attribute list
as extra argument and passes it down to
objc_declare_protocols/objc_start_protocol.
(cp_parser_objc_class_interface): Now receives attribute list as input.
(cp_parser_objc_declaration): Parses attribute list and passes it down
to cp_parser_objc_class_interface/cp_parser_objc_protocol_declaration.
2007-07-24 Fariborz Jahanian <fjahanian@apple.com>
Radar 5355344
* cp-tree.h (cp_objc_protocol_id_list): New declaration
* cp-lang.c (cp_objc_protocol_id_list): New stub
* parser.c (cp_parser_type_name): Added code to disambiguate
conditional from a protocol type.
(cp_parser_objc_tentative_protocol_refs_opt): New
2007-07-13 Fariborz Jahanian <fjahanian@apple.com>
Radar 5277239
* parser.c (cp_parser_objc_reference_expression): New routine to
build a property reference expression.
(cp_objc_property_reference_prefix): New routine to recognize a
property dot syntax.
(cp_parser_primary_expression): Build a property reference expression
when a property dot-syntax is recognized.
(cp_parser_type_name): Exclude property dot-syntax from being recognized
as a type name.
(cp_parser_class_name): Exclude property dot-syntax from being recognized
as a class name.
2007-07-10 Fariborz Jahanian <fjahanian@apple.com>
Radar 5285911
* typeck.c (finish_class_member_access_expr): Call
objc_build_property_reference_expr instead of objc_build_getter_call.
2007-06-29 Fariborz Jahanian <fjahanian@apple.com>
Radar 5276085
* typeck.c (build_modify_expr): Call objc_weak_reference_expr
instead of objc_remove_weak_read.
* parser.c (cp_parser_cast_expression): Call
objc_build_weak_reference_tree instead of objc_generate_weak_read.
(cp_parser_cast_expression): Ditto.
2007-05-18 Fariborz Jahanian <fjahanian@apple.com>
Radar 5202926
* mangle.c (write_mangled_name): Removed suppression in last patch.
2007-04-20 Fariborz Jahanian <fjahanian@apple.com>
Radar 5130983
* c-common.h (enum lvalue_use): New enumerator lv_foreach
added.
* c-common.c (lvalue_error): Diagnose on lv_foreach.
2007-04-20 Fariborz Jahanian <fjahanian@apple.com>
Radar 5130983
* parser.c (cp_parser_parse_foreach_stmt): Parse selector expression
as an expression.
(objc_foreach_stmt): Issue diagnostic on non-lavlue selector
expression.
2007-03-29 Fariborz Jahanian <fjahanian@apple.com>
Radar 4947014 - objc atomic property
* lex.c (RID_NONATOMIC): Add
* parser.c (objc_cp_parser_at_property): Recognize 'nonatomic' as
new property attribute.
2007-03-29 Fariborz Jahanian <fjahanian@apple.com>
Radar 4564694
* lex.c (RID_AT_PACKAGE): Add
* parser.c (cp_lexer_get_preprocessor_token): Parse @package.
2006-12-14 Fariborz Jahanian <fjahania@apple.com>
Radar 4854605
* parser.c (objc_foreach_stmt): Set iterator
to nil.
2006-09-01 Fariborz Jahanian <fjahania@apple.com>
Radar 4712269
* typeck.c (build_unary_op): Call objc_build_incr_decr_setter_call
for potential ince/decr pre/post expressions involving properties.
2006-07-21 Fariborz Jahanian <fjahanian@apple.com>
Radar 4631818
* parser.c (cp_parser_parse_foreach_stmt): New.
(cp_parser_iteration_statement): Remove old code.
Replace it with call to cp_parser_parse_foreach_stmt.
(cp_parser_simple_declaration): Remove old code.
(cp_parser_init_declarator): Remove old code.
2006-08-31 Fariborz Jahanian <fjahanian@apple.com>
Radar 4697411
* typeck.c (build_class_member_access_expr): Call
objc_volatilize_component_ref.
2006-07-18 Fariborz Jahanian <fjahanian@apple.com>
Radar 4592503
* class.c (layout_class_type): Check on illegal use of __weak
on struct fields.
* decl.c (start_decl): Check on illegal use of __weak on
variable declarations.
2006-07-14 Fariborz Jahanian <fjahanian@apple.com>
Radar 4621020
* lex.c (reswords): Added entry for 'weak' attribute keyword.
* parser.c (objc_cp_parser_at_property): Recorgnize 'weak'attribute.
2006-06-26 Fariborz Jahanian <fjahanian@apple.com>
Radar 4591909
* lex.c (reswords): New entry for 'dynamic' attribute.
* parser.c (objc_cp_parser_at_property): Change to parse new
attribute syntax.
2006-05-18 Fariborz Jahanian <fjahanian@apple.com>
Radar 4548636 (objc attributes on class)
* parser.c (objc_attr_follwed_by_at_keyword): New routine to disambiguate
attribute before a type and attribute before an @interface declaration..
(cp_parser_declaration): Handle case of attribute list which can be
followed by an @interface.
(cp_parser_objc_class_interface): Parse possible attribute list before
parsing @interface.
(cp_parser_objc_declaration): Recognize 'attribute' as a valid token which
can start an @interface declaration.
2006-05-16 Fariborz Jahanian <fjahanian@apple.com>
Radar 4547045
* parser.c (objc_foreach_stmt): Fix a thinko.
2006-04-12 Fariborz Jahanian <fjahanian@apple.com>
Radar 4507230
* parser.c (objc_foreach_stmt): Check for valid objc
objects in foreach header.
2006-04-06 Fariborz Jahanian <fjahanian@apple.com>
Radar 4436866
(Missing copies attribute)
* lex.c (reswords): New keyword 'copies' added.
* parser.c (objc_cp_parser_at_property): Parse 'copies'
attribute.
2006-02-15 Fariborz Jahanian <fjahanian@apple.com>
Radar 4445586
* semantics.c (begin_do_stmt): DO_STMT nodes take an
extra argument to build.
2005-11-08 Fariborz Jahanian <fjahanian@apple.com>
Radar 4330422
* typeck.c (comp_ptr_ttypes_real): Remove the hack. un-volatize the
artificially 'volatized' type before doing pointer comparison.
2005-08-15 Ziemowit Laski <zlaski@apple.com>
Radar 4093475
* parser.c (cp_parser_objc_interstitial_code): Catch stray
'{' and '}' tokens and issue appropriate errors.
(cp_parser_objc_method_prototype_list,
cp_parser_objc_method_definition_list): Bail out if end-of-file
is seen; issue error if trailing '@end' is not seen.
2008-08-06 Fariborz Jahanian <fjahanian@apple.com>
Radar 6040305 - work in progress.
* parser.c (clean_and_exit): Clean up if inside
a function.
(cp_parser_block_literal_expr): Set DECL_NO_STATIC_CHAIN
if inside a function.
2008-08-05 Fariborz Jahanian <fjahanian@apple.com>
Radar 6040305 - work in progress.
* decl.c (init_byref_decl): Generate c-style helper
functions for compose/dispose helpers.
2008-08-04 Fariborz Jahanian <fjahanian@apple.com>
Radar 6040305 - work in progress.
* decl.c (synth_block_byref_id_object_copy_func,
synth_block_byref_id_object_dispose_func,
block_start_struct, block_finish_struct,
new_block_byref_decl, init_byref_decl): New routines.
(cp_finish_decl): Build the APIed version of
a __byref local vriable.
* semantics.c (finish_id_expression): Add a __byref
variable to the list of such variables for current
block.
* parser.c (build_component_ref): Fix to make it work.
(cp_parser_block_literal_expr): Push/pop language-c,
set context of the helper function.
(declare_block_prologue_local_vars): Mend tree for
the built-in local variables in the helper prologue.
2008-07-30 Fariborz Jahanian <fjahanian@apple.com>
Radar 6040305
* call.c (standard_conversion): Allow conversion of 'id'
type to a block pointer.
2008-07-30 Fariborz Jahanian <fjahanian@apple.com>
Radar 6040305
* typeck.c (build_block_call): New
(build_function_call): Call build_block_call
for block calls.
* call.c (standard_conversion): Remove "void *" to
block pointer conversion.
2008-07-29 Fariborz Jahanian <fjahanian@apple.com>
Radar 6040305
* call.c (standard_conversion): Allow assignment of
"void *" to block pointer object.
2008-07-28 Fariborz Jahanian <fjahanian@apple.com>
Radar 6040305
* typeck.c (comptypes): block-pointer types'
return type get special treatment.
2008-07-16 Eugene Marinelli <marinelli@apple.com>
Radar 5559195
* decl.c (cxx_maybe_build_cleanup): When considering whether to
build a cleanup for a class type, use
CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY and
CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE instead of
TYPE_HAS_NONTRIVIAL_DESTRUCTOR to determine whether it must be
output.
2008-07-15 Eugene Marinelli <marinelli@apple.com>
Radar 5559195
* cp-tree.h (struct lang_type_class): Add destructor_triviality_final
flag to mark when has_nontrivial_destructor_body and
destructor_nontrivial_because_of_base are final. Add accessor for
this flag.
* parser.c (cp_parser_statement_seq_opt): Use
CLASSTYPE_DESTRUCTOR_TRIVIALITY_FINAL to determine if
destructor should be checked for being empty, and set it if
CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY is changed.
2008-07-10 Eugene Marinelli <marinelli@apple.com>
Radar 5559195
* init.c (push_base_cleanups): Check flags indicating whether
destructor of base class has a nontrivial body, has a base destructor
that must be called, or is private to determine whether it should be
called by the derived class. Set
CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE to 1 if it has
members that must be deleted.
* class.c (check_bases, finish_struct_bits,
add_implicitly_declared_members): Set
CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE and
CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY based on base classes.
(check_methods): Set CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY to 1
whenever a user-declared destructor is seen as a conservative
assumption.
* cp-tree.h (struct lang_type_class): Add
has_nontrivial_destructor_body and
destructor_nontrivial_because_of_base flags. Decrement remaining
dummy bits. Add accessors for these flags.
* parser.c (cp_parser_statement_seq_opt): Unmark
CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY and then set it again only if
a statement is parsed.
2007-05-07 Fariborz Jahanian <fjahanian@apple.com>
Radar 4157812
* parser.c (cp_parser_objc_method_keyword_params): Recognize optional
method argument attribute.
2007-03-21 Fariborz Jahanian <fjahanian@apple.com>
Radar 2848255
* except.c (do_begin_catch): Take a new argument to decide
to call objc_begin_catch for objc exceptions.
(objcp_build_eh_type_type): New.
(do_end_catch): Call objc_end_catch for objc type
exceptions.
(expand_start_catch_block): Add new argument to do_begin_catch call.
(build_throw): Call objc_throw_exception for throwing objc type objects.
* cp-tree.h (objc2_valid_objc_catch_type, objcp_build_eh_type_type):
New extern decl.
* parser.c (cp_parser_objc_try_catch_finally_stateme): Add syntax for
@catch(...).
2006-04-26 Fariborz Jahanian <fjahanian@apple.com>
Radar 3803157 (method attributes)
* parser.c (cp_parser_objc_maybe_attributes): New.
(cp_parser_objc_method_keyword_params): Parse attributes at end
of method declaration.
(cp_parser_objc_method_tail_params_opt): Parse attributes after
'...'.
(cp_parser_objc_method_signature): Retreive method attribute for
the caller.
(cp_parser_objc_method_prototype_list): Pass new arg. to
cp_parser_objc_method_signature and pass attributes to
objc_add_method_declaration.
(cp_parser_objc_method_definition_list): Pass new arg. to
cp_parser_objc_method_signature and pass attributes to
objc_start_method_definition.
2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
Radar 4133425
* lex.c (unqualified_name_lookup_error): Issue diagnostic
for private 'ivar' access.
2006-02-02 Fariborz Jahanian <fjahanian@apple.com>
Radar 4426814
* typeck.c (build_modify_expr): Undo call to objc_read_weak
on LHS of the assignment.
* parser.c (cp_parser_cast_expression): Central place to add
objc_read_weak call on expressions of __weak objects.
2005-12-15 Fariborz Jahanian <fjahanian@apple.com>
Radar 4229905
* typeck.c (composite_pointer_type): Call objc_have_common_type
when comparing two objective-c pointer types.
2005-10-17 Fariborz Jahanian <fjahanian@apple.com>
Radar 4290840
* parser.c (cp_parser_objc_method_keyword_params): Check for valid
method parameters and issue error.
(cp_parser_objc_method_definition_list): Check for invalid tokens
which cannot start a function definition.
2005-08-02 Ziemowit Laski <zlaski@apple.com>
Radar 4185810
* parser.c (cp_parser_compound_statement): Continue
parsing even if the initial '{' is missing; an error
message is already being produced.
(cp_parser_statement_seq_opt): In addition to '}' and
end-of-file, a statement sequence may also be terminated
by a stray 'else' or '@end'.
# APPLE LOCAL begin for-fsf-4_4 3274130 5295549
2007-08-03 Geoffrey Keating <geoffk@apple.com>

View File

@ -7,6 +7,17 @@
* typeck.c (cxx_alignof_expr): When alignof is used on a plain
FUNCTION_DECL, return its alignment.
2007-07-01 Ollie Wild <aaw@google.com> (r126177)
* name-lookup.c (ambiguous_decl): Fix case when new->value is hidden.
(select_decl): Remove function.
(unqualified_namespace_lookup): Populate binding by calling
ambiguous_decl. Remove select_decl call.
(lookup_qualified_name): Remove select_decl call.
* decl.c (lookup_and_check_tag): Check for ambiguous references.
* parser.c (cp_parser_elaborated_type_specifier): Skip redundant error
generation when name lookup is ambiguous.
2007-06-28 Geoffrey Keating <geoffk@apple.com> (r126088)
* decl2.c (determine_visibility): Implement
@ -29,6 +40,11 @@
* typeck.c (build_binary_op): Include types in error.
2007-05-22 Ollie Wild <aaw@google.com> (r124963)
* name-lookup.c (ambiguous_decl): Adds check for hidden types.
(unqualified_namespace_lookup): Adds check for hidden types.
2007-05-18 Geoffrey Keating <geoffk@apple.com> (r124839)
* mangle.c (write_real_cst): Use 'unsigned long' for %lx.

View File

@ -281,7 +281,8 @@ build_call (tree function, tree parms)
function = build_addr_func (function);
gcc_assert (TYPE_PTR_P (TREE_TYPE (function)));
/* APPLE LOCAL blocks 6040305 */
gcc_assert (TYPE_PTR_P (TREE_TYPE (function)) || TREE_CODE (TREE_TYPE (function)) == BLOCK_POINTER_TYPE);
fntype = TREE_TYPE (TREE_TYPE (function));
gcc_assert (TREE_CODE (fntype) == FUNCTION_TYPE
|| TREE_CODE (fntype) == METHOD_TYPE);
@ -657,7 +658,8 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
if (same_type_p (from, to))
return conv;
if ((tcode == POINTER_TYPE || TYPE_PTR_TO_MEMBER_P (to))
/* APPLE LOCAL blocks 6040305 (ck) */
if ((tcode == POINTER_TYPE || tcode == BLOCK_POINTER_TYPE || TYPE_PTR_TO_MEMBER_P (to))
&& expr && null_ptr_cst_p (expr))
conv = build_conv (ck_std, to, conv);
else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE)
@ -810,6 +812,8 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
if (ARITHMETIC_TYPE_P (from)
|| fcode == ENUMERAL_TYPE
|| fcode == POINTER_TYPE
/* APPLE LOCAL blocks 6040305 (cl) */
|| fcode == BLOCK_POINTER_TYPE
|| TYPE_PTR_TO_MEMBER_P (from))
{
conv = build_conv (ck_std, to, conv);
@ -877,6 +881,15 @@ reference_related_p (tree t1, tree t2)
&& DERIVED_FROM_P (t1, t2)));
}
/* APPLE LOCAL begin radar 6029624 */
/* Used in objective-c++, same as reference_related_p */
bool
objcp_reference_related_p (tree t1, tree t2)
{
return reference_related_p (t1, t2);
}
/* APPLE LOCAL end radar 6029624 */
/* Returns nonzero if T1 is reference-compatible with T2. */
static bool
@ -3520,10 +3533,19 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3)
cv-qualification of either the second or the third operand.
The result is of the common type. */
else if ((null_ptr_cst_p (arg2)
&& (TYPE_PTR_P (arg3_type) || TYPE_PTR_TO_MEMBER_P (arg3_type)))
/* APPLE LOCAL begin blocks 6040305 (co) */
&& (TYPE_PTR_P (arg3_type) || TYPE_PTR_TO_MEMBER_P (arg3_type)
|| TREE_CODE (arg3_type) == BLOCK_POINTER_TYPE))
/* APPLE LOCAL end blocks 6040305 (co) */
|| (null_ptr_cst_p (arg3)
&& (TYPE_PTR_P (arg2_type) || TYPE_PTR_TO_MEMBER_P (arg2_type)))
|| (TYPE_PTR_P (arg2_type) && TYPE_PTR_P (arg3_type))
/* APPLE LOCAL begin blocks 6040305 (co) */
&& (TYPE_PTR_P (arg2_type) || TYPE_PTR_TO_MEMBER_P (arg2_type)
|| TREE_CODE (arg2_type) == BLOCK_POINTER_TYPE))
|| ((TYPE_PTR_P (arg2_type)
|| TREE_CODE (arg2_type) == BLOCK_POINTER_TYPE)
&& (TYPE_PTR_P (arg3_type)
|| TREE_CODE (arg3_type) == BLOCK_POINTER_TYPE))
/* APPLE LOCAL end blocks 6040305 (co) */
|| (TYPE_PTRMEM_P (arg2_type) && TYPE_PTRMEM_P (arg3_type))
|| (TYPE_PTRMEMFUNC_P (arg2_type) && TYPE_PTRMEMFUNC_P (arg3_type)))
{

View File

@ -1282,6 +1282,12 @@ check_bases (tree t,
TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (basetype);
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
|= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (basetype);
/* APPLE LOCAL begin omit calls to empty destructors 5559195 */
if (CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY (basetype)
|| CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE (basetype))
CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE (t) = 1;
/* APPLE LOCAL end omit calls to empty destructors 5559195 */
TYPE_HAS_COMPLEX_ASSIGN_REF (t)
|= TYPE_HAS_COMPLEX_ASSIGN_REF (basetype);
TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (basetype);
@ -1440,6 +1446,13 @@ finish_struct_bits (tree t)
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (variants)
= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t);
/* APPLE LOCAL begin omit calls to empty destructors 5559195 */
CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY (variants) =
CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY (t);
CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE (variants) =
CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE (t);
/* APPLE LOCAL end omit calls to empty destructors 5559195 */
TYPE_POLYMORPHIC_P (variants) = TYPE_POLYMORPHIC_P (t);
TYPE_BINFO (variants) = TYPE_BINFO (t);
@ -2540,6 +2553,13 @@ add_implicitly_declared_members (tree t,
{
bool lazy_p = true;
/* APPLE LOCAL begin omit calls to empty destructors 5559195 */
/* Since this is an empty destructor, it can only be nontrivial
because one of its base classes has a destructor that must be
called. */
CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE (t) = 1;
/* APPLE LOCAL end omit calls to empty destructors 5559195 */
if (TYPE_FOR_JAVA (t))
/* If this a Java class, any non-trivial destructor is
invalid, even if compiler-generated. Therefore, if the
@ -3729,7 +3749,16 @@ check_methods (tree t)
}
/* All user-declared destructors are non-trivial. */
if (DECL_DESTRUCTOR_P (x))
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = 1;
/* APPLE LOCAL begin omit calls to empty destructors 5559195 */
{
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = 1;
/* Conservatively assume that destructor body is nontrivial. Will
be unmarked during parsing of function body if it happens to be
trivial. */
CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY (t) = 1;
}
/* APPLE LOCAL end omit calls to empty destructors 5559195 */
}
}

View File

@ -200,8 +200,20 @@ gimplify_cp_loop (tree cond, tree body, tree incr, tree attrs,
stmt_list = NULL_TREE;
entry = NULL_TREE;
break_block = begin_bc_block (bc_break);
cont_block = begin_bc_block (bc_continue);
/* APPLE LOCAL begin C* language */
/* Order of label addition to stack is important for objc's foreach-stmt. */
/* APPLE LOCAL radar 4667060 */
if (inner_foreach == integer_zero_node)
{
cont_block = begin_bc_block (bc_continue);
break_block = begin_bc_block (bc_break);
}
else
{
break_block = begin_bc_block (bc_break);
cont_block = begin_bc_block (bc_continue);
}
/* APPLE LOCAL end C* language */
/* If condition is zero don't generate a loop construct. */
if (cond && integer_zerop (cond))
@ -252,10 +264,19 @@ gimplify_cp_loop (tree cond, tree body, tree incr, tree attrs,
}
}
/* APPLE LOCAL begin radar 4547045 */
/* Pop foreach's inner loop break label so outer loop's
break label becomes target of inner loop body's break statements.
*/
t = NULL_TREE;
gimplify_stmt (&body);
gimplify_stmt (&incr);
body = finish_bc_block (bc_continue, cont_block, body);
/* APPLE LOCAL begin radar 4547045 */
/* Push back inner loop's own 'break' label so rest
of code works seemlessly. */
/* APPLE LOCAL radar 4667060 */
append_to_statement_list (top, &stmt_list);
append_to_statement_list (body, &stmt_list);

View File

@ -259,5 +259,37 @@ init_shadowed_var_for_decl (void)
tree_map_eq, 0);
}
/* APPLE LOCAL begin radar 5741070 */
/* Given an IDENTIFIER tree for a class interface, find (if possible) and
return the record type for the class interface. */
tree
c_return_interface_record_type (tree typename)
{
enum tree_code_class class;
enum tree_code code;
tree retval = NULL;
if (typename == NULL)
return retval;
code = TREE_CODE (typename);
class = TREE_CODE_CLASS (code);
if (code != IDENTIFIER_NODE
|| class != tcc_exceptional)
return retval;
if (TREE_TYPE (typename)
&& TREE_CODE (TREE_TYPE (typename)) == RECORD_TYPE)
retval = TREE_TYPE (typename);
if (retval
&& TREE_CODE (retval) != RECORD_TYPE)
retval = NULL;
return retval;
}
/* APPLE LOCAL end radar 5741070 */
#include "gt-cp-cp-objcp-common.h"

View File

@ -166,4 +166,10 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
#undef LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE
#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE cxx_omp_privatize_by_reference
/* APPLE LOCAL begin radar 6353006 */
#undef LANG_HOOKS_BUILD_GENERIC_BLOCK_STRUCT_TYPE
#define LANG_HOOKS_BUILD_GENERIC_BLOCK_STRUCT_TYPE \
c_build_generic_block_struct_type
/* APPLE LOCAL end radar 6353006 */
#endif /* GCC_CP_OBJCP_COMMON */

View File

@ -1052,6 +1052,13 @@ struct lang_type_class GTY(())
unsigned has_complex_assign_ref : 1;
unsigned non_aggregate : 1;
/* APPLE LOCAL begin omit calls to empty destructors 5559195 */
unsigned has_nontrivial_destructor_body : 1;
unsigned destructor_nontrivial_because_of_base : 1;
unsigned destructor_triviality_final : 1;
/* APPLE LOCAL end omit calls to empty destructors 5559195 */
/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
so, make sure to copy it in instantiate_class_template! */
@ -1059,7 +1066,9 @@ struct lang_type_class GTY(())
/* There are some bits left to fill out a 32-bit word. Keep track
of this by updating the size of this bitfield whenever you add or
remove a flag. */
unsigned dummy : 12;
/* APPLE LOCAL begin omit calls to empty destructors 5559195 */
unsigned dummy : 10;
/* APPLE LOCAL end omit calls to empty destructors 5559195 */
tree primary_base;
VEC(tree_pair_s,gc) *vcall_indices;
@ -2439,6 +2448,8 @@ extern void decl_shadowed_for_var_insert (tree, tree);
|| TREE_CODE (TYPE) == ENUMERAL_TYPE \
|| ARITHMETIC_TYPE_P (TYPE) \
|| TYPE_PTR_P (TYPE) \
/* APPLE LOCAL blocks 6040305 */ \
|| TREE_CODE (TYPE) == BLOCK_POINTER_TYPE \
|| TYPE_PTRMEMFUNC_P (TYPE))
/* [dcl.init.aggr]
@ -2520,6 +2531,20 @@ extern void decl_shadowed_for_var_insert (tree, tree);
#define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \
(TYPE_LANG_FLAG_4 (NODE))
/* APPLE LOCAL begin omit calls to empty destructors 5559195 */
/* One if the body of the destructor of class type NODE has been shown to do
nothing, else zero. */
#define CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_nontrivial_destructor_body)
/* One if destructor of this type must be called by its base classes because
one of its base classes' destructors must be called. */
#define CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->destructor_nontrivial_because_of_base)
/* One if the values of CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE
and CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY are final. */
#define CLASSTYPE_DESTRUCTOR_TRIVIALITY_FINAL(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->destructor_triviality_final)
/* APPLE LOCAL end omit calls to empty destructors 5559195 */
/* Nonzero for class type means that copy initialization of this type can use
a bitwise copy. */
#define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
@ -3704,6 +3729,8 @@ typedef enum cp_declarator_kind {
cdk_pointer,
cdk_reference,
cdk_ptrmem,
/* APPLE LOCAL blocks 6040305 (ch) */
cdk_block_pointer,
cdk_error
} cp_declarator_kind;
@ -3772,6 +3799,13 @@ struct cp_declarator {
/* For cdk_ptrmem, the class type containing the member. */
tree class_type;
} pointer;
/* APPLE LOCAL begin blocks 6040305 (ch) */
/* For cdk_block_pointer. */
struct {
/* The cv-qualifiers for the pointer. */
cp_cv_quals qualifiers;
} block_pointer;
/* APPLE LOCAL end blocks 6040305 (ch) */
} u;
};
@ -3922,6 +3956,8 @@ extern tree push_throw_library_fn (tree, tree);
extern tree check_tag_decl (cp_decl_specifier_seq *);
extern tree shadow_tag (cp_decl_specifier_seq *);
extern tree groktypename (cp_decl_specifier_seq *, const cp_declarator *);
/* APPLE LOCAL 6339747 */
extern tree grokblockdecl (cp_decl_specifier_seq *, const cp_declarator *);
extern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *);
extern void start_decl_1 (tree, bool);
extern void cp_finish_decl (tree, tree, bool, tree, int);
@ -4600,5 +4636,11 @@ extern void cp_genericize (tree);
extern void cp_cpp_error (cpp_reader *, int,
const char *, va_list *)
ATTRIBUTE_GCC_CXXDIAG(3,0);
/* APPLE LOCAL radar 5741070 */
extern tree c_return_interface_record_type (tree);
/* APPLE LOCAL begin blocks 6040305 (cg) */
extern cp_declarator* make_block_pointer_declarator (tree, cp_cv_quals,
cp_declarator *);
/* APPLE LOCAL end blocks 6040305 (cg) */
#endif /* ! GCC_CP_TREE_H */

View File

@ -52,7 +52,8 @@ Boston, MA 02110-1301, USA. */
#include "timevar.h"
#include "tree-flow.h"
static tree grokparms (cp_parameter_declarator *, tree *);
/* APPLE LOCAL blocks 6040305 (ce) */
tree grokparms (cp_parameter_declarator *, tree *);
static const char *redeclaration_error_message (tree, tree);
static int decl_jump_unsafe (tree);
@ -3800,7 +3801,26 @@ shadow_tag (cp_decl_specifier_seq *declspecs)
return t;
}
/* APPLE LOCAL begin blocks 6339747 */
/* Decode a block literal type, such as "int **", returning a ...FUNCTION_DECL node. */
tree
grokblockdecl (cp_decl_specifier_seq *type_specifiers,
const cp_declarator *declarator)
{
tree decl;
tree attrs = type_specifiers->attributes;
type_specifiers->attributes = NULL_TREE;
decl = grokdeclarator (declarator, type_specifiers, BLOCKDEF, 0, &attrs);
if (attrs)
cplus_decl_attributes (&decl, attrs, 0);
return decl;
}
/* APPLE LOCAL end blocks 6339747 */
/* Decode a "typename", such as "int **", returning a ..._TYPE node. */
tree
@ -5002,10 +5022,15 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
if (DECL_LANG_SPECIFIC (decl) && DECL_IN_AGGR_P (decl))
{
gcc_assert (TREE_STATIC (decl));
/* APPLE LOCAL begin templated static data 6298605 */
/* An in-class declaration of a static data member should be
external; it is only a declaration, and not a definition. */
if (init == NULL_TREE && DECL_INITIAL (decl) == NULL_TREE)
external if the decl is accessible from outside this
translation unit (eg something not in an anonymous
namespace); it is only a declaration, and not a
definition. */
if (init == NULL_TREE && TREE_PUBLIC (decl))
gcc_assert (DECL_EXTERNAL (decl));
/* APPLE LOCAL end templated static data 6298605 */
}
/* We don't create any RTL for local variables. */
@ -5160,6 +5185,367 @@ value_dependent_init_p (tree init)
return false;
}
/* APPLE LOCAL begin blocks 6040305 (cr) */
#define BLOCK_ALIGN_MAX 18
static tree block_byref_id_object_copy[BLOCK_BYREF_CURRENT_MAX*(BLOCK_ALIGN_MAX+1)];
static tree block_byref_id_object_dispose[BLOCK_BYREF_CURRENT_MAX*(BLOCK_ALIGN_MAX+1)];
/**
This routine builds:
void __Block_byref_id_object_copy(struct Block_byref_id_object *dst,
struct Block_byref_id_object *src) {
_Block_object_assign (&_dest->object, _src->object, BLOCK_FIELD_IS_OBJECT[|BLOCK_FIELD_IS_WEAK]) // objects
_Block_object_assign(&_dest->object, _src->object, BLOCK_FIELD_IS_BLOCK[|BLOCK_FIELD_IS_WEAK]) // blocks
} */
static void
synth_block_byref_id_object_copy_func (int flag, int kind)
{
tree stmt;
tree dst_arg, src_arg;
tree dst_obj, src_obj;
tree call_exp;
gcc_assert (block_byref_id_object_copy[kind]);
/* Set up: (void* _dest, void*_src) parameters. */
dst_arg = build_decl (PARM_DECL, get_identifier ("_dst"),
ptr_type_node);
TREE_USED (dst_arg) = 1;
DECL_ARG_TYPE (dst_arg) = ptr_type_node;
src_arg = build_decl (PARM_DECL, get_identifier ("_src"),
ptr_type_node);
TREE_USED (src_arg) = 1;
DECL_ARG_TYPE (src_arg) = ptr_type_node;
/* arg_info = xcalloc (1, sizeof (struct c_arg_info)); */
TREE_CHAIN (dst_arg) = src_arg;
/* arg_info->parms = dst_arg; */
/* arg_info->types = tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE,
ptr_type_node,
NULL_TREE)); */
DECL_ARGUMENTS (block_byref_id_object_copy[kind]) = dst_arg;
/* function header synthesis. */
push_function_context ();
/* start_block_helper_function (block_byref_id_object_copy[kind], true); */
/* store_parm_decls_from (arg_info); */
start_preparsed_function (block_byref_id_object_copy[kind],
/*attrs*/NULL_TREE,
SF_PRE_PARSED);
/* Body of the function. */
stmt = begin_compound_stmt (BCS_FN_BODY);
/* Build dst->object */
dst_obj = build_indirect_object_id_exp (dst_arg);
/* src_obj is: _src->object. */
src_obj = build_indirect_object_id_exp (src_arg);
/* APPLE LOCAL begin radar 6180456 */
/* _Block_object_assign (&_dest->object, _src->object, BLOCK_FIELD_IS_OBJECT) or:
_Block_object_assign (&_dest->object, _src->object, BLOCK_FIELD_IS_BLOCK) */
/* APPLE LOCAL begin radar 6573923 */
/* Also add the new flag when calling _Block_object_dispose
from byref dispose helper. */
flag |= BLOCK_BYREF_CALLER;
/* APPLE LOCAL end radar 6573923 */
call_exp = build_block_object_assign_call_exp (build_fold_addr_expr (dst_obj), src_obj, flag);
add_stmt (call_exp);
/* APPLE LOCAL end radar 6180456 */
finish_compound_stmt (stmt);
/* APPLE LOCAL radar 6169580 */
finish_function (4);
pop_function_context ();
}
/**
This routine builds:
void __Block_byref_id_object_dispose(struct Block_byref_id_object *_src) {
_Block_object_dispose(_src->object, BLOCK_FIELD_IS_OBJECT[|BLOCK_FIELD_IS_WEAK]) // objects
_Block_object_dispose(_src->object, BLOCK_FIELD_IS_BLOCK[|BLOCK_FIELD_IS_WEAK]) // blocks
} */
static void synth_block_byref_id_object_dispose_func (int flag, int kind)
{
tree stmt;
tree src_arg, src_obj, rel_exp;
gcc_assert (block_byref_id_object_dispose[kind]);
/* Set up: (void *_src) parameter. */
src_arg = build_decl (PARM_DECL, get_identifier ("_src"),
ptr_type_node);
TREE_USED (src_arg) = 1;
DECL_ARG_TYPE (src_arg) = ptr_type_node;
/* arg_info = xcalloc (1, sizeof (struct c_arg_info));
arg_info->parms = src_arg;
arg_info->types = tree_cons (NULL_TREE, ptr_type_node,
NULL_TREE); */
DECL_ARGUMENTS (block_byref_id_object_dispose[kind]) = src_arg;
/* function header synthesis. */
push_function_context ();
/* start_block_helper_function (block_byref_id_object_dispose[kind], true); */
/* store_parm_decls_from (arg_info); */
start_preparsed_function (block_byref_id_object_dispose[kind],
/*attrs*/NULL_TREE,
SF_PRE_PARSED);
/* Body of the function. */
stmt = begin_compound_stmt (BCS_FN_BODY);
src_obj = build_indirect_object_id_exp (src_arg);
/* APPLE LOCAL begin radar 6180456 */
/* _Block_object_dispose(_src->object, BLOCK_FIELD_IS_OBJECT) or:
_Block_object_dispose(_src->object, BLOCK_FIELD_IS_BLOCK) */
/* APPLE LOCAL begin radar 6573923 */
/* Also add the new flag when calling _Block_object_dispose
from byref dispose helper. */
flag |= BLOCK_BYREF_CALLER;
/* APPLE LOCAL end radar 6573923 */
rel_exp = build_block_object_dispose_call_exp (src_obj, flag);
/* APPLE LOCAL end radar 6180456 */
add_stmt (rel_exp);
finish_compound_stmt (stmt);
/* APPLE LOCAL radar 6169580 */
finish_function (4);
pop_function_context ();
}
static tree
block_start_struct (tree name)
{
tree s;
/* The idea here is to mimic the actions that the C++ parser takes when
constructing 'extern "C" struct NAME {'. */
push_lang_context (lang_name_c);
s = xref_tag (record_type, name, ts_global, 0);
CLASSTYPE_DECLARED_CLASS (s) = 0; /* this is a 'struct', not a 'class'. */
xref_basetypes (s, NULL_TREE); /* no base classes here! */
return begin_class_definition (s, NULL_TREE);
}
static tree
block_finish_struct (tree t, tree fieldlist)
{
tree field, next_field;
for (field = fieldlist; field; field = next_field)
{
next_field = TREE_CHAIN (field); /* insert one field at a time; */
TREE_CHAIN (field) = NULL_TREE; /* otherwise, grokfield croaks. */
finish_member_declaration (field);
}
t = finish_struct (t, NULL);
pop_lang_context ();
return t;
}
/* new_block_byref_decl - This routine changes a 'typex x' declared variable into:
struct __Block_byref_x {
// APPLE LOCAL radar 6244520
void *__isa; // NULL for everything except __weak pointers
struct Block_byref_x *__forwarding;
int32_t __flags;
int32_t __size;
void *__ByrefKeepFuncPtr; // Only if variable is __block ObjC object
void *__ByrefDestroyFuncPtr; // Only if variable is __block ObjC object
typex x;
} x;
*/
static tree
new_block_byref_decl (tree decl)
{
static int unique_count;
/* APPLE LOCAL radar 5847976 */
int save_flag_objc_gc;
tree Block_byref_type;
tree fields = NULL_TREE, field;
const char *prefix = "__Block_byref_";
char *string = (char*)alloca (strlen (IDENTIFIER_POINTER (DECL_NAME (decl))) +
strlen (prefix) + 8 /* to hold the count */);
sprintf (string, "%s%d_%s", prefix, ++unique_count,
IDENTIFIER_POINTER (DECL_NAME (decl)));
push_to_top_level ();
/* Block_byref_type = start_struct (RECORD_TYPE, get_identifier (string)); */
Block_byref_type = block_start_struct (get_identifier (string));
/* APPLE LOCAL begin radar 6244520 */
/* void *__isa; */
field = build_decl (FIELD_DECL, get_identifier ("__isa"), ptr_type_node);
fields = field;
/* APPLE LOCAL end radar 6244520 */
/* struct Block_byref_x *__forwarding; */
field = build_decl (FIELD_DECL, get_identifier ("__forwarding"),
build_pointer_type (Block_byref_type));
/* APPLE LOCAL radar 6244520 */
chainon (fields, field);
/* int32_t __flags; */
field = build_decl (FIELD_DECL, get_identifier ("__flags"),
unsigned_type_node);
chainon (fields, field);
/* int32_t __size; */
field = build_decl (FIELD_DECL, get_identifier ("__size"),
unsigned_type_node);
chainon (fields, field);
if (COPYABLE_BYREF_LOCAL_NONPOD (decl))
{
/* void *__ByrefKeepFuncPtr; */
field = build_decl (FIELD_DECL, get_identifier ("__ByrefKeepFuncPtr"),
ptr_type_node);
chainon (fields, field);
/* void *__ByrefDestroyFuncPtr; */
field = build_decl (FIELD_DECL, get_identifier ("__ByrefDestroyFuncPtr"),
ptr_type_node);
chainon (fields, field);
}
/* typex x; */
field = build_decl (FIELD_DECL, DECL_NAME (decl), TREE_TYPE (decl));
chainon (fields, field);
/* APPLE LOCAL begin radar 5847976 */
/* Hack so we don't issue warning on a field_decl having __weak attribute */
save_flag_objc_gc = flag_objc_gc;
flag_objc_gc = 0;
/* finish_struct (Block_byref_type, field_decl_chain, NULL_TREE); */
block_finish_struct (Block_byref_type, fields);
flag_objc_gc = save_flag_objc_gc;
/* APPLE LOCAL end radar 5847976 */
pop_from_top_level ();
TREE_TYPE (decl) = Block_byref_type;
/* Force layout_decl to recompute these fields. */
DECL_SIZE (decl) = DECL_SIZE_UNIT (decl) = 0;
layout_decl (decl, 0);
return decl;
}
/* init_byref_decl - This routine builds the initializer for the __Block_byref_x
type in the form of:
{ NULL, &x, 0, sizeof(struct __Block_byref_x), initializer-expr};
or:
{ NULL, &x, 0, sizeof(struct __Block_byref_x)};
when INIT is NULL_TREE
For __block ObjC objects, it also adds "byref_keep" and "byref_destroy"
Funtion pointers. So the most general initializers would be:
{ NULL, &x, 0, sizeof(struct __Block_byref_x), &byref_keep, &byref_destroy,
&initializer-expr};
*/
static tree
init_byref_decl (tree decl, tree init, int flag)
{
tree initlist;
tree block_byref_type = TREE_TYPE (decl);
int size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (block_byref_type));
unsigned flags = 0;
tree fields;
if (COPYABLE_BYREF_LOCAL_NONPOD (decl))
flags = BLOCK_HAS_COPY_DISPOSE;
fields = TYPE_FIELDS (block_byref_type);
/* APPLE LOCAL begin radar 6244520 */
initlist = tree_cons (fields, fold_convert (ptr_type_node, ((flag & BLOCK_FIELD_IS_WEAK) != 0) ? integer_one_node
: integer_zero_node),
0);
fields = TREE_CHAIN (fields);
initlist = tree_cons (fields,
build_unary_op (ADDR_EXPR, decl, 0), initlist);
/* APPLE LOCAL end radar 6244520 */
fields = TREE_CHAIN (fields);
initlist = tree_cons (fields, build_int_cst (TREE_TYPE (fields), flags),
initlist);
fields = TREE_CHAIN (fields);
initlist = tree_cons (fields, build_int_cst (TREE_TYPE (fields), size),
initlist);
fields = TREE_CHAIN (fields);
if (COPYABLE_BYREF_LOCAL_NONPOD (decl))
{
char name[64];
int align = exact_log2 ((DECL_ALIGN (decl)+TYPE_ALIGN (ptr_type_node)-1) / TYPE_ALIGN (ptr_type_node));
int kind;
if (align == -1 || align > BLOCK_ALIGN_MAX) {
error ("invalid alignment for __block variable");
kind = 0;
} else
kind = align*BLOCK_BYREF_CURRENT_MAX + flag;
/* Add &__Block_byref_id_object_copy, &__Block_byref_id_object_dispose
initializers. */
if (!block_byref_id_object_copy[kind])
{
tree func_type;
push_lang_context (lang_name_c);
/* Build a void __Block_byref_id_object_copy(void*, void*) type. */
func_type =
build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node,
void_list_node)));
sprintf (name, "__Block_byref_id_object_copy%d", kind);
block_byref_id_object_copy[kind] = build_helper_func_decl (get_identifier (name),
func_type);
DECL_CONTEXT (block_byref_id_object_copy[kind]) = current_function_decl;
/* Synthesize function definition. */
synth_block_byref_id_object_copy_func (flag, kind);
pop_lang_context ();
}
initlist = tree_cons (fields,
build_fold_addr_expr (block_byref_id_object_copy[kind]),
initlist);
fields = TREE_CHAIN (fields);
if (!block_byref_id_object_dispose[kind])
{
tree func_type;
push_lang_context (lang_name_c);
/* Synthesize void __Block_byref_id_object_dispose (void*) and
build &__Block_byref_id_object_dispose. */
func_type =
build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node, void_list_node));
sprintf (name, "__Block_byref_id_object_dispose%d", kind);
block_byref_id_object_dispose[kind] = build_helper_func_decl (get_identifier (name),
func_type);
DECL_CONTEXT (block_byref_id_object_dispose[kind]) = current_function_decl;
/* Synthesize function definition. */
synth_block_byref_id_object_dispose_func (flag, kind);
pop_lang_context ();
}
initlist = tree_cons (fields,
build_fold_addr_expr (block_byref_id_object_dispose[kind]),
initlist);
fields = TREE_CHAIN (fields);
}
if (init)
{
init = digest_init (TREE_TYPE (fields), init);
initlist = tree_cons (fields, init, initlist);
}
init = build_constructor_from_list (block_byref_type, nreverse (initlist));
return init;
}
/* APPLE LOCAL end blocks 6040305 (cr) */
/* Finish processing of a declaration;
install its line number and initial value.
If the length of an array type is not known before,
@ -5295,6 +5681,17 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
if (DECL_THREAD_LOCAL_P (decl) && !pod_type_p (TREE_TYPE (decl)))
error ("%qD cannot be thread-local because it has non-POD type %qT",
decl, TREE_TYPE (decl));
/* APPLE LOCAL begin blocks 6040305 (cq) */
if (COPYABLE_BYREF_LOCAL_VAR (decl)) {
if (DECL_EXTERNAL (decl) || TREE_STATIC (decl))
{
error ("__block attribute on %q+D not allowed, only allowed on local variables", decl);
COPYABLE_BYREF_LOCAL_VAR (decl) = 0;
COPYABLE_BYREF_LOCAL_NONPOD (decl) = 0;
}
}
/* APPLE LOCAL end blocks 6040305 (cq) */
/* If this is a local variable that will need a mangled name,
register it now. We must do this before processing the
initializer for the variable, since the initialization might
@ -5760,6 +6157,16 @@ expand_static_init (tree decl, tree init)
&& TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
return;
/* APPLE LOCAL begin radar 5733674 */
if (c_dialect_objc () && flag_objc_gc && init && TREE_CODE (init) == INIT_EXPR)
{
tree result = objc_generate_write_barrier (TREE_OPERAND (init, 0),
INIT_EXPR, TREE_OPERAND (init, 1));
if (result)
init = result;
}
/* APPLE LOCAL end radar 5733674 */
if (DECL_FUNCTION_SCOPE_P (decl))
{
/* Emit code to perform this initialization but once. */
@ -7235,6 +7642,8 @@ grokdeclarator (const cp_declarator *declarator,
case cdk_pointer:
case cdk_reference:
case cdk_ptrmem:
/* APPLE LOCAL blocks 6040305 */
case cdk_block_pointer:
break;
case cdk_error:
@ -7930,6 +8339,33 @@ grokdeclarator (const cp_declarator *declarator,
ctype = NULL_TREE;
break;
/* APPLE LOCAL begin blocks 6040305 (cj) */
case cdk_block_pointer:
if (TREE_CODE (type) != FUNCTION_TYPE)
{
error ("block pointer to non-function type is invalid");
type = error_mark_node;
}
else
{
/* We now know that the TYPE_QUALS don't apply to the decl,
but to the target of the pointer. */
type_quals = TYPE_UNQUALIFIED;
type = build_block_pointer_type (type);
if (declarator->u.pointer.qualifiers)
{
type
= cp_build_qualified_type (type,
declarator->u.pointer.qualifiers);
type_quals = cp_type_quals (type);
}
}
ctype = NULL_TREE;
break;
/* APPLE LOCAL end blocks 6040305 (cj) */
case cdk_error:
break;
@ -8121,6 +8557,38 @@ grokdeclarator (const cp_declarator *declarator,
}
}
/* APPLE LOCAL begin blocks 6339747 */
if (decl_context == BLOCKDEF)
{
tree decl;
if (type == error_mark_node)
return error_mark_node;
if (TREE_CODE (type) != FUNCTION_TYPE)
{
tree t = make_node (FUNCTION_TYPE);
if (TREE_CODE (type) == ARRAY_TYPE)
{
error ("block declared as returning an array");
return error_mark_node;
}
TYPE_ARG_TYPES (t) = void_list_node;
TREE_TYPE (t) = type;
type = t;
parms = NULL_TREE;
}
if (raises)
type = build_exception_variant (type, raises);
decl = build_lang_decl (FUNCTION_DECL, NULL_TREE, type);
DECL_ARGUMENTS (decl) = parms;
return decl;
}
/* APPLE LOCAL end blocks 6339747 */
/* If this is declaring a typedef name, return a TYPE_DECL. */
if (declspecs->specs[(int)ds_typedef] && decl_context != TYPENAME)
{
@ -8973,7 +9441,8 @@ check_default_argument (tree decl, tree arg)
*PARMS is set to the chain of PARM_DECLs created. */
static tree
/* APPLE LOCAL blocks 6040305 (ce) */
tree
grokparms (cp_parameter_declarator *first_parm, tree *parms)
{
tree result = NULL_TREE;
@ -9784,6 +10253,12 @@ lookup_and_check_tag (enum tag_types tag_code, tree name,
| DECL_SELF_REFERENCE_P (decl));
return t;
}
else if (decl && TREE_CODE (decl) == TREE_LIST)
{
error ("reference to %qD is ambiguous", name);
print_candidates (decl);
return error_mark_node;
}
else
return NULL_TREE;
}
@ -10909,6 +11384,82 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
}
/* APPLE LOCAL begin warn missing prototype 6261539 */
static bool
fn_previously_found (tree decl, tree olddecl)
{
int types_match;
if (olddecl == 0)
return false;
if (TREE_CODE (olddecl) == OVERLOAD)
{
if (OVL_CHAIN (olddecl) == NULL_TREE)
olddecl = OVL_CURRENT (olddecl);
else
{
tree match;
for (match = olddecl; match; match = OVL_NEXT (match))
{
if (fn_previously_found (decl, OVL_CURRENT (match)))
return true;
}
return false;
}
}
/* Don't warn about previously erroneous things that have the same
name. */
if (TREE_TYPE (olddecl) == error_mark_node)
return true;
/* Internally defined things still need a prototype to escape the
warning. */
if (DECL_ARTIFICIAL (olddecl))
return false;
if (TREE_CODE (olddecl) != FUNCTION_DECL)
return false;
/* These will match or error, don't also spew prototype warnings. */
if (DECL_EXTERN_C_P (olddecl)
&& DECL_EXTERN_C_P (decl))
return true;
/* These will match or error, don't also spew prototype warnings. */
if (compparms (TYPE_ARG_TYPES (TREE_TYPE (decl)),
TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
return true;
types_match = decls_match (decl, olddecl);
if (types_match)
return true;
return false;
}
inline static void
check_missing_prototype (tree decl)
{
if (warn_missing_prototypes
&& namespace_bindings_p ()
&& TREE_PUBLIC (decl)
&& !DECL_MAIN_P (decl)
&& DECL_NON_THUNK_FUNCTION_P (decl)
&& ! DECL_FUNCTION_MEMBER_P (decl)
&& DECL_NAMESPACE_SCOPE_P (decl)
&& ! decl_anon_ns_mem_p (decl)
&& ! DECL_DECLARED_INLINE_P (decl))
{
tree olddecl = namespace_binding (DECL_NAME (decl), DECL_CONTEXT (decl));
if (!fn_previously_found (decl, olddecl))
warning (OPT_Wmissing_prototypes, "no previous prototype for %q+D", decl);
}
}
/* APPLE LOCAL end warn missing prototype 6261539 */
/* Like start_preparsed_function, except that instead of a
FUNCTION_DECL, this function takes DECLSPECS and DECLARATOR.
@ -11253,6 +11804,8 @@ finish_function (int flags)
tree fndecl = current_function_decl;
tree fntype, ctype = NULL_TREE;
int inclass_inline = (flags & 2) != 0;
/* APPLE LOCAL radar 6169580 */
int in_blocks_helper_function = (flags & 4) != 0;
int nested;
/* When we get some parse errors, we can end up without a
@ -11446,7 +11999,8 @@ finish_function (int flags)
maybe_end_member_template_processing ();
/* Leave the scope of the class. */
if (ctype)
/* APPLE LOCAL radar 6169580 */
if (ctype && !in_blocks_helper_function)
pop_nested_class ();
--function_depth;
@ -11672,13 +12226,32 @@ cxx_maybe_build_cleanup (tree decl)
{
tree type = TREE_TYPE (decl);
if (type != error_mark_node && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
/* APPLE LOCAL begin omit calls to empty destructors 5559195 */
tree dtor = NULL_TREE;
bool build_cleanup = false;
if (TREE_CODE (type) == RECORD_TYPE)
dtor = CLASSTYPE_DESTRUCTORS (type);
if (type != error_mark_node)
{
if (TREE_CODE (type) == RECORD_TYPE)
/* For RECORD_TYPEs, we can refer to more precise flags than
TYPE_HAS_NONTRIVIAL_DESTRUCTOR. */
build_cleanup = (dtor && TREE_PRIVATE (dtor))
|| CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY (type)
|| CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE (type);
else
build_cleanup = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type);
}
if (build_cleanup)
{
/* APPLE LOCAL end omit calls to empty destructors 5559195 */
int flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR;
tree rval;
bool has_vbases = (TREE_CODE (type) == RECORD_TYPE
&& CLASSTYPE_VBASECLASSES (type));
if (TREE_CODE (type) == ARRAY_TYPE)
rval = decl;
else

View File

@ -27,6 +27,8 @@ enum decl_context
FIELD, /* Declaration inside struct or union */
BITFIELD, /* Likewise but with specified width */
TYPENAME, /* Typename (inside cast or sizeof) */
/* APPLE LOCAL blocks 6339747 */
BLOCKDEF, /* Declaratin of block literal */
MEMFUNCDEF /* Member function definition */
};
@ -34,3 +36,7 @@ enum decl_context
extern tree grokdeclarator (const cp_declarator *,
const cp_decl_specifier_seq *,
enum decl_context, int, tree*);
/* APPLE LOCAL radar 4721858 */
extern void emit_instantiate_pending_templates (location_t *);
/* APPLE LOCAL blocks 6040305 (ce) */
extern tree grokparms (cp_parameter_declarator *first_parm, tree *parms);

View File

@ -1904,6 +1904,27 @@ constrain_class_visibility (tree type)
}
}
/* APPLE LOCAL begin weak types 5954418 */
static bool
typeinfo_comdat (tree type)
{
tree binfo, base_binfo;
int j;
if (lookup_attribute ("weak", TYPE_ATTRIBUTES (type)))
return true;
for (binfo = TYPE_BINFO (type), j = 0;
BINFO_BASE_ITERATE (binfo, j, base_binfo); ++j)
{
if (typeinfo_comdat (BINFO_TYPE (base_binfo)))
return true;
}
return false;
}
/* APPLE LOCAL end weak types 5954418 */
/* DECL is a FUNCTION_DECL or VAR_DECL. If the object file linkage
for DECL has not already been determined, do so now by setting
DECL_EXTERNAL, DECL_COMDAT and other related flags. Until this
@ -2100,7 +2121,10 @@ import_export_decl (tree decl)
{
comdat_p = (targetm.cxx.class_data_always_comdat ()
|| (CLASSTYPE_KEY_METHOD (type)
&& DECL_DECLARED_INLINE_P (CLASSTYPE_KEY_METHOD (type))));
/* APPLE LOCAL begin weak types 5954418 */
&& DECL_DECLARED_INLINE_P (CLASSTYPE_KEY_METHOD (type)))
|| typeinfo_comdat (type));
/* APPLE LOCAL end weak types 5954418 */
mark_needed (decl);
if (!flag_weak)
{
@ -3043,6 +3067,10 @@ build_java_method_aliases (void)
}
}
/* APPLE LOCAL begin radar 4721858 */
static void emit_deferred (location_t *);
/* APPLE LOCAL end radar 4721858 */
/* This routine is called from the last rule in yyparse ().
Its job is to create all the code needed to initialize and
destroy the global aggregates. We do the destruction
@ -3051,14 +3079,10 @@ build_java_method_aliases (void)
void
cp_finish_file (void)
{
tree vars;
bool reconsider;
size_t i;
/* APPLE LOCAL begin radar 4721858 */
location_t locus;
unsigned ssdf_count = 0;
int retries = 0;
tree decl;
/* APPLE LOCAL end radar 4721858 */
locus = input_location;
at_eof = 1;
@ -3066,8 +3090,8 @@ cp_finish_file (void)
if (! global_bindings_p () || current_class_type || decl_namespace_list)
return;
if (pch_file)
c_common_write_pch ();
/* APPLE LOCAL radar 4874613 */
/* dump of pch file moved to c_parse_file (). */
#ifdef USE_MAPPED_LOCATION
/* FIXME - huh? */
@ -3097,6 +3121,29 @@ cp_finish_file (void)
emit_support_tinfos ();
/* APPLE LOCAL begin radar 4721858 */
emit_instantiate_pending_templates (&locus);
emit_deferred (&locus);
}
/* This routine emits pending functions and instatiates pending templates
as more opportunities arises. */
void
emit_instantiate_pending_templates (location_t *locusp)
{
tree vars;
bool reconsider;
size_t i;
unsigned ssdf_count = 0;
int retries = 0;
/* APPLE LOCAL radar 4874626 */
/* initialization removed. */
at_eof = 1;
/* APPLE LOCAL end radar 4721858 */
do
{
tree t;
@ -3174,7 +3221,8 @@ cp_finish_file (void)
/* Set the line and file, so that it is obviously not from
the source file. */
input_location = locus;
/* APPLE LOCAL radar 4721858 */
input_location = *locusp;
ssdf_body = start_static_storage_duration_function (ssdf_count);
/* Make sure the back end knows about all the variables. */
@ -3200,7 +3248,8 @@ cp_finish_file (void)
/* Finish up the static storage duration function for this
round. */
input_location = locus;
/* APPLE LOCAL radar 4721858 */
input_location = *locusp;
finish_static_storage_duration_function (ssdf_body);
/* All those initializations and finalizations might cause
@ -3211,7 +3260,8 @@ cp_finish_file (void)
#ifdef USE_MAPPED_LOCATION
/* ??? */
#else
locus.line++;
/* APPLE LOCAL radar 4721858 */
locusp->line++;
#endif
}
@ -3309,27 +3359,36 @@ cp_finish_file (void)
retries++;
}
while (reconsider);
/* APPLE LOCAL begin radar 4721858 */
}
static void
emit_deferred (location_t *locusp)
{
size_t i;
tree decl;
bool reconsider = false;
/* APPLE LOCAL end radar 4721858 */
/* All used inline functions must have a definition at this point. */
for (i = 0; VEC_iterate (tree, deferred_fns, i, decl); ++i)
{
if (/* Check online inline functions that were actually used. */
TREE_USED (decl) && DECL_DECLARED_INLINE_P (decl)
/* If the definition actually was available here, then the
fact that the function was not defined merely represents
that for some reason (use of a template repository,
#pragma interface, etc.) we decided not to emit the
definition here. */
&& !DECL_INITIAL (decl)
/* An explicit instantiation can be used to specify
that the body is in another unit. It will have
already verified there was a definition. */
&& !DECL_EXPLICIT_INSTANTIATION (decl))
{
warning (0, "inline function %q+D used but never defined", decl);
/* Avoid a duplicate warning from check_global_declaration_1. */
TREE_NO_WARNING (decl) = 1;
}
TREE_USED (decl) && DECL_DECLARED_INLINE_P (decl)
/* If the definition actually was available here, then the
fact that the function was not defined merely represents
that for some reason (use of a template repository,
#pragma interface, etc.) we decided not to emit the
definition here. */
&& !DECL_INITIAL (decl)
/* An explicit instantiation can be used to specify
that the body is in another unit. It will have
already verified there was a definition. */
&& !DECL_EXPLICIT_INSTANTIATION (decl))
{
warning (0, "inline function %q+D used but never defined", decl);
/* Avoid a duplicate warning from check_global_declaration_1. */
TREE_NO_WARNING (decl) = 1;
}
}
/* We give C linkage to static constructors and destructors. */
@ -3340,17 +3399,20 @@ cp_finish_file (void)
if (priority_info_map)
splay_tree_foreach (priority_info_map,
generate_ctor_and_dtor_functions_for_priority,
/*data=*/&locus);
/* APPLE LOCAL radar 4721858 */
/*data=*/locusp);
else
{
/* If we have a ctor or this is obj-c++ and we need a static init,
call generate_ctor_or_dtor_function. */
if (static_ctors || (c_dialect_objc () && objc_static_init_needed_p ()))
generate_ctor_or_dtor_function (/*constructor_p=*/true,
DEFAULT_INIT_PRIORITY, &locus);
/* APPLE LOCAL radar 4721858 */
DEFAULT_INIT_PRIORITY, locusp);
if (static_dtors)
generate_ctor_or_dtor_function (/*constructor_p=*/false,
DEFAULT_INIT_PRIORITY, &locus);
/* APPLE LOCAL radar 4721858 */
DEFAULT_INIT_PRIORITY, locusp);
}
/* We're done with the splay-tree now. */
@ -3403,7 +3465,8 @@ cp_finish_file (void)
dump_tree_statistics ();
dump_time_statistics ();
}
input_location = locus;
/* APPLE LOCAL radar 4721858 */
input_location = *locusp;
#ifdef ENABLE_CHECKING
validate_conversion_obstack ();

View File

@ -342,6 +342,8 @@ dump_type (tree t, int flags)
reduces code size. */
case ARRAY_TYPE:
case POINTER_TYPE:
/* APPLE LOCAL blocks 6040305 */
case BLOCK_POINTER_TYPE:
case REFERENCE_TYPE:
case OFFSET_TYPE:
offset_type:
@ -497,6 +499,8 @@ dump_type_prefix (tree t, int flags)
switch (TREE_CODE (t))
{
case POINTER_TYPE:
/* APPLE LOCAL blocks 6040305 */
case BLOCK_POINTER_TYPE:
case REFERENCE_TYPE:
{
tree sub = TREE_TYPE (t);
@ -507,7 +511,10 @@ dump_type_prefix (tree t, int flags)
pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp);
}
pp_character (cxx_pp, "&*"[TREE_CODE (t) == POINTER_TYPE]);
/* APPLE LOCAL begin blocks 6040305 */
pp_character (cxx_pp, "&*^"[(TREE_CODE (t) == POINTER_TYPE)
+ (TREE_CODE (t) == BLOCK_POINTER_TYPE)*2]);
/* APPLE LOCAL end blocks 6040305 */
pp_base (cxx_pp)->padding = pp_before;
pp_cxx_cv_qualifier_seq (cxx_pp, t);
}
@ -593,6 +600,8 @@ dump_type_suffix (tree t, int flags)
switch (TREE_CODE (t))
{
case POINTER_TYPE:
/* APPLE LOCAL blocks 6040305 */
case BLOCK_POINTER_TYPE:
case REFERENCE_TYPE:
case OFFSET_TYPE:
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)

Some files were not shown because too many files have changed in this diff Show More