Module Name:    src
Committed By:   jruoho
Date:           Fri Dec 17 12:14:05 UTC 2010

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/share/man/man3: Makefile
        src/share/man/man7: c.7
Added Files:
        src/share/man/man3: typeof.3

Log Message:
There is no harm to add a manual page for the GNU typeof()-construct, given
that it has already crawled into the source tree.


To generate a diff of this commit:
cvs rdiff -u -r1.1553 -r1.1554 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.63 -r1.64 src/share/man/man3/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man3/typeof.3
cvs rdiff -u -r1.9 -r1.10 src/share/man/man7/c.7

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1553 src/distrib/sets/lists/comp/mi:1.1554
--- src/distrib/sets/lists/comp/mi:1.1553	Fri Dec 17 08:13:09 2010
+++ src/distrib/sets/lists/comp/mi	Fri Dec 17 12:14:03 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1553 2010/12/17 08:13:09 jruoho Exp $
+#	$NetBSD: mi,v 1.1554 2010/12/17 12:14:03 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -8518,6 +8518,7 @@
 ./usr/share/man/cat3/ttyslot.0			comp-c-catman		.cat
 ./usr/share/man/cat3/ttyunlock.0		comp-c-catman		.cat
 ./usr/share/man/cat3/twalk.0			comp-c-catman		.cat
+./usr/share/man/cat3/typeof.0			comp-c-catman		.cat
 ./usr/share/man/cat3/types.0			comp-c-catman		.cat
 ./usr/share/man/cat3/tzalloc.0			comp-c-catman		.cat
 ./usr/share/man/cat3/tzfree.0			comp-c-catman		.cat
@@ -14468,6 +14469,7 @@
 ./usr/share/man/html3/ttyslot.html		comp-c-htmlman		html
 ./usr/share/man/html3/ttyunlock.html		comp-c-htmlman		html
 ./usr/share/man/html3/twalk.html		comp-c-htmlman		html
+./usr/share/man/html3/typeof.html		comp-c-htmlman		html
 ./usr/share/man/html3/types.html		comp-c-htmlman		html
 ./usr/share/man/html3/tzalloc.html		comp-c-htmlman		html
 ./usr/share/man/html3/tzfree.html		comp-c-htmlman		html
@@ -20488,6 +20490,7 @@
 ./usr/share/man/man3/ttyslot.3			comp-c-man		.man
 ./usr/share/man/man3/ttyunlock.3		comp-c-man		.man
 ./usr/share/man/man3/twalk.3			comp-c-man		.man
+./usr/share/man/man3/typeof.3			comp-c-man		.man
 ./usr/share/man/man3/types.3			comp-c-man		.man
 ./usr/share/man/man3/tzalloc.3			comp-c-man		.man
 ./usr/share/man/man3/tzfree.3			comp-c-man		.man

Index: src/share/man/man3/Makefile
diff -u src/share/man/man3/Makefile:1.63 src/share/man/man3/Makefile:1.64
--- src/share/man/man3/Makefile:1.63	Fri Dec 17 08:13:09 2010
+++ src/share/man/man3/Makefile	Fri Dec 17 12:14:04 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.63 2010/12/17 08:13:09 jruoho Exp $
+#	$NetBSD: Makefile,v 1.64 2010/12/17 12:14:04 jruoho Exp $
 #	@(#)Makefile	8.2 (Berkeley) 12/13/93
 
 MAN=	_DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \
@@ -9,7 +9,7 @@
 	ilog2.3 intro.3 inttypes.3 iso646.3 \
 	makedev.3 offsetof.3 queue.3 rbtree.3 sigevent.3 \
 	stdarg.3 stdbool.3 stddef.3 stdint.3 stdlib.3 sysexits.3 \
-	tgmath.3 timeradd.3 timeval.3 tree.3 types.3 varargs.3
+	tgmath.3 timeradd.3 timeval.3 tree.3 typeof.3 types.3 varargs.3
 
 USETBL=	# used by queue.3
 
@@ -176,7 +176,7 @@
 	queue.3 SIMPLEQ_FOREACH.3 \
 	queue.3 SIMPLEQ_EMPTY.3 \
 	queue.3 SIMPLEQ_FIRST.3 \
-	queue.3 SIMPLEQ_NEXT.3 
+	queue.3 SIMPLEQ_NEXT.3
 MLINKS+=queue.3 TAILQ_HEAD.3 \
 	queue.3 TAILQ_HEAD_INITIALIZER.3 \
 	queue.3 TAILQ_ENTRY.3 \

Index: src/share/man/man7/c.7
diff -u src/share/man/man7/c.7:1.9 src/share/man/man7/c.7:1.10
--- src/share/man/man7/c.7:1.9	Fri Dec 17 07:25:33 2010
+++ src/share/man/man7/c.7	Fri Dec 17 12:14:04 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: c.7,v 1.9 2010/12/17 07:25:33 jruoho Exp $
+.\" $NetBSD: c.7,v 1.10 2010/12/17 12:14:04 jruoho Exp $
 .\"
 .\" Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved.
 .\"
@@ -158,7 +158,9 @@
 .Pq Xr gcc 1 .
 Most of the UNIX-like operating systems use GNU C as a system compiler,
 but the various extensions of GNU C, such as
-.Xr attribute 3 ,
+.Xr attribute 3
+or
+.Xr typeof 3 ,
 should not be considered standard features.
 .Sh SEE ALSO
 .Xr c89 1 ,

Added files:

Index: src/share/man/man3/typeof.3
diff -u /dev/null src/share/man/man3/typeof.3:1.1
--- /dev/null	Fri Dec 17 12:14:05 2010
+++ src/share/man/man3/typeof.3	Fri Dec 17 12:14:04 2010
@@ -0,0 +1,62 @@
+.\" $NetBSD: typeof.3,v 1.1 2010/12/17 12:14:04 jruoho Exp $
+.\"
+.\" Copyright (c) 2010 Jukka Ruohonen <jruoho...@iki.fi>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd December 17, 2010
+.Dt TYPEOF 3
+.Os
+.Sh NAME
+.Nm typeof
+.Nd GNU extension for type of an expression
+.Sh SYNOPSIS
+.Ft type
+.Fn typeof "expression"
+.Sh DESCRIPTION
+The
+.Fn typeof
+construct can be used to obtain the type of an expression.
+The syntax is comparable to that of
+.Fn sizeof ,
+but semantically
+.Fn typeof
+operates like a type name defined with
+.Em typedef .
+.Sh EXAMPLES
+The following is a typical example of a type-generic macro:
+.Bd -literal -offset indent
+#define MAX(a, b) ({		\\
+	typeof(a) _a = (a);	\\
+	typeof(b) _b = (b);	\\
+	_a > _b ? _a : _b;	\\
+})
+.Ed
+.Sh SEE ALSO
+.Xr gcc 1 ,
+.Xr attribute 3 ,
+.Xr offsetof 3
+.Sh CAVEATS
+The
+.Fn typeof
+construct is a non-standard, compiler-specific extension.

Reply via email to