-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathscc.1
93 lines (93 loc) · 3.69 KB
/
scc.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
.\" @(#)$Id: scc.1,v 1.7 2018/11/12 00:05:55 jleffler Exp $
.\" @(#)Manual page: SCC - Strip C Comments
.ds fC "Version: $Revision: 1.7 $ ($Date: 2018/11/12 00:05:55 $)
.TH SCC 1S "JLSS UNIX Tools"
.SH NAME
scc \(em Strip C comments from source code
.SH SYNOPSIS
\fBscc\fP [-cefhntwV][-S std][-s rep][-q rep] [file ...]
.SH DESCRIPTION
The \fBscc\fP program strips comments from C and C++ source code.
By default, it assumes the code is C18 and therefore eliminates both
classic C comments between `\*c/*\*d' and `\*c*/\*d' and C++ and C99
comments between `\*c//\*d' and end of line.
.P
You can select the language and standard with `\*c-S\*d' followed by a
case-insensitive code for the standard: one of `C', `C89', `C90', `C94',
`C99', `C11', `C18', `C++', `C++98', `C++03', `C++11', `C++14', `C++17`.
.P
By specifying `\*c-w\*d', you can obtain warnings about nested C
comments - that is, about `\*c/*\*d' appearing inside another classic C
comment.
The `\*c-c\*d' option prints comments and not the code.
The `\*c-n\*d' option keeps newlines in comments, so the input and
output line counts should be the same, even though comments were
stripped.
The `\*c-e\*d' option prints an empty comment (omitting the text of
the comment) rather than deleting it altogether, so it does not apply
when the `\*c-c\*d' option is used.
.P
The `\*c-s rep\*d' option replaces the body of string literals with the
single character specified by `\*crep\*d', which can simplify some forms
of analysis.
Similarly, the `\*d-q rep\*d' option replaces the body of character
literals with the single character specified by `\*crep\*d'.
.P
Starting with SCC 7.00, by default, trailing blanks are stripped from
all output.
Use the `\*c-t\*d` option to retain trailing blanks.
This change in the output format could break code using SCC.
.P
The `\*c-V\*d' option prints the version information and exits.
The `\*c-h\*d' option prints a help message and exits.
The `\*c-f\*d' option prints the flags (or features) associated with the
language version selected.
.P
The \fBscc\fP program is aware of the intricacies of backslash-newline,
and single-quoted characters, and double-quoted character strings.
Consequently, it correctly handles such bizarre comments as this:
.P
\*c/\e
.br
*\e
.br
*\e
.br
/\*d
.br
.P
By design decision, \fBscc\fP ignores both digraphs and trigraphs.
Digraphs do not affect the material the SCC deals with.
Trigraphs (especially `\*c??/\*d', the trigraph for a backslash,
`\*c\e\*d') could affect the code, but there are programs \fBdigraphs\fP
and \fBtrigraphs\fP that manipulate code with digraphs and trigraphs.
These should be used before working on the source with SCC.
Note that if trigraph sequences are embedded in raw strings, the
\fBtrigraphs\fP program will manipulate them where a C++ compiler would
not treat them as trigraphs.
Succinctly: don't do it!
.P
SCC handles C++11 raw strings and various dialects of Unicode strings.
It handles C++14 numeric punctuation (which requires full analysis of numbers).
It handles C++17 hexadecimal floating point constants with numeric punctuation.
C18 is essentially the same as C11.
.SH BUGS
Earlier versions of \fBscc\fP used `\*c-C\*d' to enable the removal of
C99 or C++ comments.
The behaviour was reversed in version 5.3.
The option was removed altogether in version 6.0 because the `\*c-S\*d'
handles this more flexibly.
.P
There are some ghastly possible behaviours related to `\*c/*\*d' or
`\*c//\*d' sequences in association with `\*c#include\*d' directives.
Once again, these are more theoretical than practical, and SCC currently
does not detect or handle them.
.SH VERSION
Documentation for
SCC Version 8.0.3 (2022-05-30) Version 8.0.3 (2022-05-30)
.SH AUTHOR
Jonathan Leffler
.br
JLSS
.br
11th November 2018