Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src There is no harm to add a manual page for the GNU typeof()-c...



details:   https://anonhg.NetBSD.org/src/rev/32b05f9774eb
branches:  trunk
changeset: 759824:32b05f9774eb
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Dec 17 12:14:03 2010 +0000

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

diffstat:

 distrib/sets/lists/comp/mi |   5 ++-
 share/man/man3/Makefile    |   6 ++--
 share/man/man3/typeof.3    |  62 ++++++++++++++++++++++++++++++++++++++++++++++
 share/man/man7/c.7         |   6 ++-
 4 files changed, 73 insertions(+), 6 deletions(-)

diffs (146 lines):

diff -r facfd6186f39 -r 32b05f9774eb distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Fri Dec 17 11:32:57 2010 +0000
+++ b/distrib/sets/lists/comp/mi        Fri Dec 17 12:14:03 2010 +0000
@@ -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
diff -r facfd6186f39 -r 32b05f9774eb share/man/man3/Makefile
--- a/share/man/man3/Makefile   Fri Dec 17 11:32:57 2010 +0000
+++ b/share/man/man3/Makefile   Fri Dec 17 12:14:03 2010 +0000
@@ -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 \
diff -r facfd6186f39 -r 32b05f9774eb share/man/man3/typeof.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man3/typeof.3   Fri Dec 17 12:14:03 2010 +0000
@@ -0,0 +1,62 @@
+.\" $NetBSD: typeof.3,v 1.1 2010/12/17 12:14:04 jruoho Exp $
+.\"
+.\" Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
+.\" 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.
diff -r facfd6186f39 -r 32b05f9774eb share/man/man7/c.7
--- a/share/man/man7/c.7        Fri Dec 17 11:32:57 2010 +0000
+++ b/share/man/man7/c.7        Fri Dec 17 12:14:03 2010 +0000
@@ -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 ,



Home | Main Index | Thread Index | Old Index