summaryrefslogtreecommitdiff
path: root/usr.bin/pcc
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-09-27 19:56:49 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-09-27 19:56:49 +0000
commit2736758c95141eb666f6d5224384a044cd659aa2 (patch)
tree2ee2a06c46b5399c242a91f0fa4750dfc3a883c8 /usr.bin/pcc
parent057e06cb81ad30f6d5be7e91f445496490bf8b81 (diff)
pullup of manual pages from ragge's repo
Diffstat (limited to 'usr.bin/pcc')
-rw-r--r--usr.bin/pcc/cc/cc/cc.1128
-rw-r--r--usr.bin/pcc/cc/ccom/ccom.14
-rw-r--r--usr.bin/pcc/cc/cpp/cpp.1190
3 files changed, 300 insertions, 22 deletions
diff --git a/usr.bin/pcc/cc/cc/cc.1 b/usr.bin/pcc/cc/cc/cc.1
index 7c424a240fe..299b5d810fa 100644
--- a/usr.bin/pcc/cc/cc/cc.1
+++ b/usr.bin/pcc/cc/cc/cc.1
@@ -1,5 +1,5 @@
-.\" $OpenBSD: cc.1,v 1.2 2007/09/15 22:04:38 ray Exp $
-.\"
+.\" $OpenBSD: cc.1,v 1.3 2007/09/27 19:56:48 otto Exp $
+."\
.\" Copyright (c) 2007 Jeremy C. Reed <reed@reedmedia.net>
.\"
.\" Permission to use, copy, modify, and/or distribute this software for any
@@ -23,13 +23,26 @@
.Nd front-end to the C compiler
.Sh SYNOPSIS
.Nm
-.Op Fl TODO
-.Op infile...
+.Op Fl cdEgkLMPOStvxX
+.Op Fl B Ar prefix
+.Op Fl fPIC
+.Op Fl include Ar path
+.Op Fl isystem Ar path
+.Op Fl nostdinc
+.Op Fl nostdlib
+.Op Fl nostartfiles
+.Op Fl o Ar outfile
+.Op Fl pg
+.Op Fl pthread
+.Op Fl static
+.Op Fl Wl Ar flags
+.Op Ar infile ...
.Pp
.Sh DESCRIPTION
The
.Nm
-utility provides a front-end to the PCC C compiler.
+utility provides a front-end to the
+.Dq portable C compiler.
Multiple files may be given on the command line.
Unrecognized options are all sent directly to
.Xr ld 1 .
@@ -44,6 +57,13 @@ are passed via
.Xr ld 1 .
.Pp
Filenames that end with
+.Sy .i
+are passed via
+.Xr ccom 1 ->
+.Xr as 1 ->
+.Xr ld 1 .
+.Pp
+Filenames that end with
.Sy .s
are passed via
.Xr as 1 ->
@@ -54,8 +74,6 @@ Filenames that end with
are passed directly to
.Xr ld 1 .
.Pp
-.\" TODO: document when -D__ASSEMBLER__ ??
-.\" TODO: document __PCC__, __PCC_MINOR__, and __PCC_MINORMINOR__
.\"
The options are as follows:
.Bl -tag -width Ds
@@ -71,20 +89,36 @@ executables.
.It Fl c
Only compile or assemble and then stop.
Do not link.
+The resulting object output is saved
+as a filename with a
+.Dq .o
+suffix unless
+.Fl o
+option is used.
Note: cannot be combined with
.Fl o
if multiple files are given.
-.It Fl d
-Sent to assembler. TODO?
+.It Fl d Ar option
+Passed to the
+.Xr as 1
+assembler.
+.\" TODO: what is as -dfoo for?
+.It Fl D Ar macro[=value]
+Passed to the
+.Xr cpp 1
+preprocessor to define
+.Ar macro .
.It Fl E
Stop after preprocessing with
.Xr cpp 1 .
Do not compile, assemble, or link.
+.It Fl fpic
+Tells C compiler to generate PIC code
+and tells assembler that PIC code has been generated.
+.\" TODO: document difference between PIC and pic
.It Fl fPIC
Generate PIC code.
-See
-.Fl k
-option.
+.\" TODO: document about avoiding machine-specific maximum size?
.\" other -f GCC compatibility flags are ignored for now
.It Fl g
Send
@@ -92,13 +126,22 @@ Send
flag to
.Xr ccom 1
to create debug output.
+This unsets the
+.Fl O
+option.
.It Fl include Ar path
.\" TODO
.It Fl isystem Ar path
.\" TODO
.It Fl k
-Tells C compiler to generate PIC code
-and tells assembler that PIC code has been generated.
+Generate PIC code.
+See
+.Fl fpic
+option.
+.It Fl I Ar path
+Passed to the
+.Xr cpp 1
+preprocessor to add header search directory to override system defaults.
.It Fl L
.\" TODO
.It Fl M
@@ -120,10 +163,15 @@ Save result to
.Ar outfile .
.It Fl P
TODO: what is this?
+.\" TODO: Looks like it does cpp only, but I couldn't get it to work for me.
.It Fl pg
Not implemented.
.It Fl O
-.\" TODO: sets -xtemps for ccom??
+Enable optimizations.
+Currently passes
+.Fl xtemps
+to
+.Xr ccom 1 .
Note: this is unset if
.Fl g
option is set.
@@ -144,6 +192,12 @@ and/or shared objects for the platform.
Stop after compilation by
.Xr ccom 1 .
Do not assemble and do not link.
+The resulting assembler-language output is saved
+as a filename with a
+.Dq .s
+suffix unless the
+.Fl o
+option is used.
Note: cannot be combined with
.Fl o
if multiple files are given.
@@ -153,6 +207,10 @@ Passes
to
.Xr cpp 1
for traditional C preprocessor syntax.
+.It Fl U Ar macro
+Passed to the
+.Xr cpp 1
+preprocessor to remove the initial macro definition.
.It Fl v
Outputs the version of
.Nm
@@ -164,12 +222,47 @@ TODO
.It Fl Wl Ar flags
Options for the linker
.\" what is ignored? llist?
-.\" TODO: DIUC options?
.El
+.Sh Predefined Macros
+A few
+macros are predefined by
+.Nm
+went sent to
+.Xr cpp 1 .
+.Bl -diag
+.\" TODO:
+.\" .It __ASSEMBLER__
+.\" Defined if suffix is .S -- why not with .s? what does this mean?
+.It __PCC__
+Set to the major version of
+.Xr pcc 1 .
+These macros can be used to select code based on
+.Xr pcc 1
+compatibility.
+See
+.Fl v
+option.
+.It __PCC_MINOR__
+Set to the minor version.
+.It __PCC_MINORMINOR__
+Set to the minor-minor version -- the number after the minor version.
+.It _PTHREADS
+Defined when
+.Fl pthread
+switch is used.
+.El
+.Pp
+Also system- and/or machine-dependent macros may also be predefined;
+for example:
+.Dv __NetBSD__ ,
+.Dv __ELF__ ,
+and
+.Dv __i386__ .
.Sh SEE ALSO
.Xr as 1 ,
.Xr ccom 1 ,
-.Xr cpp 1
+.Xr cpp 1 ,
+.Xr ld 1
.Sh HISTORY
The
.Nm
@@ -178,4 +271,3 @@ Johnson, written in the late 70's.
.Pp
This product includes software developed or owned by Caldera
International, Inc.
-
diff --git a/usr.bin/pcc/cc/ccom/ccom.1 b/usr.bin/pcc/cc/ccom/ccom.1
index eb39b05569e..5bca790fea0 100644
--- a/usr.bin/pcc/cc/ccom/ccom.1
+++ b/usr.bin/pcc/cc/ccom/ccom.1
@@ -1,5 +1,5 @@
-.\" $OpenBSD: ccom.1,v 1.2 2007/09/15 22:04:38 ray Exp $
-.\"
+.\" $OpenBSD: ccom.1,v 1.3 2007/09/27 19:56:48 otto Exp $
+."\
.\" Copyright (c) 2007 Jeremy C. Reed <reed@reedmedia.net>
.\" Permission to use, copy, modify, and/or distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
diff --git a/usr.bin/pcc/cc/cpp/cpp.1 b/usr.bin/pcc/cc/cpp/cpp.1
index e12dacce4a3..f1010223b4c 100644
--- a/usr.bin/pcc/cc/cpp/cpp.1
+++ b/usr.bin/pcc/cc/cpp/cpp.1
@@ -1,3 +1,189 @@
-.\" $OpenBSD: cpp.1,v 1.2 2007/09/15 21:48:06 ray Exp $
+.\" $OpenBSD: cpp.1,v 1.3 2007/09/27 19:56:48 otto Exp $
+."\
+.\" Copyright (c) 2007 Jeremy C. Reed <reed@reedmedia.net>
+.\"
+.\" Permission to use, copy, modify, and/or distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR AND CONTRIBUTORS DISCLAIM
+.\" ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHOR AND
+.\" CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+.\" THIS SOFTWARE.
.\"
-.\" Placeholder
+.Dd September 17, 2007
+.Dt cpp 1
+.Os
+.Sh NAME
+.Nm cpp
+.Nd C preprocessor
+.Sh SYNOPSIS
+.Nm
+.\" TODO also document -Dvar and below without spaces?
+.Op Fl Cdt
+.Op Fl D Ar var=val
+.Op Fl U Ar var
+.Op Fl I Ar path
+.Op Fl S Ar path
+.Op Ar infile | -
+.Op Ar outfile
+.Pp
+.Sh DESCRIPTION
+The
+.Nm
+utility is a macro preprocessor used by the
+.Xr pcc 1
+compiler.
+It is used to include header files,
+expand macro definitions,
+and perform conditional compilation.
+.Pp
+The
+.Ar infile
+input file is optional.
+If not provided or the file name is
+.Qq -
+(dash),
+.Nm
+reads its initial file from standard input.
+The
+.Ar outfile
+output file is also optional.
+It writes by default to standard output.
+.Pp
+.\" TODO: document MAXARG 250 args to a macro, limited by char value
+.\" TODO: Include order:
+.\" For "..." files, first search "current" dir, then as <...> files.
+.\" For <...> files, first search -I directories, then system directories.
+.\"
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl C
+Do not discard comments.
+.It Fl dM
+Print list of
+.Dq #define
+statements to standard output for all defined macros other than
+builtin macros (see below).
+The normal results of preprocessing are not outputted.
+.\" TODO this doesn't show predefined macros
+.\" other -d options are ignored
+.It Fl D Ar macro[=value]
+Fake a definition at the beginning by using
+.Do #define
+.Ar macro=value Dc .
+If
+.Ar value
+is not set on command-line, then defines as 1.
+.\" TODO: show example
+.It Fl i Ar file
+Include a file at the beginning by using
+.Do #include
+.Ar file Dc .
+.\" Note: I did not use the .In macro above
+.It Fl I Ar directory
+Add
+.Ar directory
+to the list of system directories containing needed header files.
+This may be used to override system include directories
+(see
+.Fl S
+option).
+.Fl I
+may be specified multiple times.
+.It Fl M
+Generate dependencies for
+.Xr make 1 .
+.\" TODO: explain and show example?
+.It Fl S Ar directory
+Add
+.Ar directory
+to the list of system directories containing needed header files.
+.Fl S
+may be specified multiple times.
+Note:
+.Nm
+does not have a default include directory defined.
+.\" TODO: explain difference between -I and -S
+.\" The directories listed by -I are searched first?
+.It Fl t
+Traditional cpp syntax.
+Do not define the
+.Dv __TIME__ ,
+.Dv __DATE__ ,
+and
+.Dv __STDC__
+macros.
+.\"
+.It Fl U Ar macro
+Undefine a macro at the beginning by using
+.Do #undef
+.Ar macro Dc .
+.It Fl v
+Verbose debugging output.
+.Fl v
+can be repeated for further details.
+.\" -v only available if cpp source built with CPP_DEBUG, which is the default.
+.It Fl ?
+Show command line usage for
+.Nm .
+.El
+.Sh Builtin Macros
+A few macros are interpreted inside the
+.Nm cpp
+program:
+.Bl -diag
+.It __DATE__
+Expands to the date in abbreviated month, day, and year format from
+.Xr ctime 3
+in quotes.
+.\" TODO: is that ctime(3) format output change according to locale?
+.It __FILE__
+Expands to the name of the current input file in quotes.
+When read from standard input, it expands to
+.Qq Ao stdin Ac .
+.It __LINE__
+Expands to the line number of the current line containing the macro.
+.It __STDC__
+Expands to the constant 1.
+This means the compiler conforms to ISO Standard C.
+.It __TIME__
+Expands to the time in hour, minutes, and seconds from
+.Xr ctime 3
+in quotes.
+.El
+.Pp
+Also see the
+.Fl t
+option.
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with one of the following values:
+.Bl -tag -width Ds
+.It 0
+Successfully finished.
+.It 1
+An error occurred.
+.El
+.Sh SEE ALSO
+.Xr as 1 ,
+.Xr ccom 1 ,
+.Xr pcc 1
+.\"
+.Sh HISTORY
+The
+.Nm
+command comes from the original Portable C Compiler by S. C.
+Johnson, written in the late 70's.
+The code originates from the V6 preprocessor with some additions
+from V7 cpp and ansi/c99 support.
+.Pp
+A lot of the PCC code was rewritten by Anders Magnusson.
+.Pp
+This product includes software developed or owned by Caldera
+International, Inc.