summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/cc/cpp/cccp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/cc/cpp/cccp.c')
-rw-r--r--gnu/usr.bin/cc/cpp/cccp.c172
1 files changed, 86 insertions, 86 deletions
diff --git a/gnu/usr.bin/cc/cpp/cccp.c b/gnu/usr.bin/cc/cpp/cccp.c
index 3924004..ee8ed5a 100644
--- a/gnu/usr.bin/cc/cpp/cccp.c
+++ b/gnu/usr.bin/cc/cpp/cccp.c
@@ -116,7 +116,7 @@ typedef struct { unsigned :16, :16, :16; } vms_ino_t;
#define BSTRING /* VMS/GCC supplies the bstring routines */
#endif /* __GNUC__ */
#endif /* VMS */
-
+
extern char *index ();
extern char *rindex ();
@@ -420,11 +420,11 @@ static enum {dump_none, dump_only, dump_names, dump_definitions}
static int debug_output = 0;
/* Nonzero indicates special processing used by the pcp program. The
- special effects of this mode are:
-
+ special effects of this mode are:
+
Inhibit all macro expansion, except those inside #if directives.
- Process #define directives normally, and output their contents
+ Process #define directives normally, and output their contents
to the output file.
Output preconditions to pcp_outfile indicating all the relevant
@@ -663,7 +663,7 @@ static char *include_prefix;
/* Global list of strings read in from precompiled files. This list
is kept in the order the strings are read in, with new strings being
added at the end through stringlist_tailp. We use this list to output
- the strings at the end of the run.
+ the strings at the end of the run.
*/
static STRINGDEF *stringlist;
static STRINGDEF **stringlist_tailp = &stringlist;
@@ -742,7 +742,7 @@ union hashval {
};
/*
- * special extension string that can be added to the last macro argument to
+ * special extension string that can be added to the last macro argument to
* allow it to absorb the "rest" of the arguments when expanded. Ex:
* #define wow(a, b...) process (b, a, b)
* { wow (1, 2, 3); } -> { process (2, 3, 1, 2, 3); }
@@ -969,7 +969,7 @@ static U_CHAR is_space[256];
#define SKIP_WHITE_SPACE(p) do { while (is_hor_space[*p]) p++; } while (0)
#define SKIP_ALL_WHITE_SPACE(p) do { while (is_space[*p]) p++; } while (0)
-
+
static int errors = 0; /* Error counter for exit code */
/* Name of output file, for error messages. */
@@ -1347,7 +1347,7 @@ main (argc, argv)
if (i + 1 == argc)
fatal ("Filename missing after -pcp option");
pcp_fname = argv[++i];
- pcp_outfile =
+ pcp_outfile =
((pcp_fname[0] != '-' || pcp_fname[1] != '\0')
? fopen (pcp_fname, "w")
: fdopen (dup (fileno (stdout)), "w"));
@@ -1463,7 +1463,7 @@ main (argc, argv)
and suppress the usual output. */
deps_stream = stdout;
inhibit_output = 1;
- }
+ }
break;
case 'd':
@@ -1677,7 +1677,7 @@ main (argc, argv)
char *q;
while (*p == ' ' || *p == '\t')
p++;
- /* Handle -D options. */
+ /* Handle -D options. */
if (p[0] == '-' && p[1] == 'D') {
q = &p[2];
while (*p && *p != ' ' && *p != '\t')
@@ -1690,7 +1690,7 @@ main (argc, argv)
while (*p == ' ' || *p == '\t')
p++;
} else if (p[0] == '-' && p[1] == 'A') {
- /* Handle -A options (assertions). */
+ /* Handle -A options (assertions). */
char *assertion;
char *past_name;
char *value;
@@ -1965,7 +1965,7 @@ main (argc, argv)
deps_target = 0;
output_file = spec;
}
-
+
deps_file = output_file;
deps_mode = "a";
}
@@ -2408,7 +2408,7 @@ get_lintcmd (ibp, limit, argstart, arglen, cmdlen)
if (ibp >= limit) return NULL;
linsize = limit - ibp;
-
+
/* Oh, I wish C had lexical functions... hell, I'll just open-code the set */
if ((linsize >= 10) && !strncmp (ibp, "NOTREACHED", 10)) {
*cmdlen = 10;
@@ -2604,7 +2604,7 @@ do { ip = &instack[indepth]; \
if (ident_length)
goto specialchar;
-
+
/* # keyword: a # must be first nonblank char on the line */
if (beg_of_line == 0)
goto randomchar;
@@ -3118,7 +3118,7 @@ randomchar:
startagain:
for (hp = hashtab[MAKE_POS (hash) % HASHSIZE]; hp != NULL;
hp = hp->next) {
-
+
if (hp->length == ident_length) {
int obufp_before_macroname;
int op_lineno_before_macroname;
@@ -3126,30 +3126,30 @@ startagain:
register U_CHAR *p = hp->name;
register U_CHAR *q = obp - i;
int disabled;
-
+
if (! redo_char)
q--;
-
+
do { /* All this to avoid a strncmp () */
if (*p++ != *q++)
goto hashcollision;
} while (--i);
-
+
/* We found a use of a macro name.
see if the context shows it is a macro call. */
-
+
/* Back up over terminating character if not already done. */
if (! redo_char) {
ibp--;
obp--;
}
-
+
/* Save this as a displacement from the beginning of the output
buffer. We can not save this as a position in the output
buffer, because it may get realloc'ed by RECACHE. */
obufp_before_macroname = (obp - op->buf) - ident_length;
op_lineno_before_macroname = op->lineno;
-
+
if (hp->type == T_PCSTRING) {
pcstring_used (hp); /* Mark the definition of this key
as needed, ensuring that it
@@ -3160,10 +3160,10 @@ startagain:
/* Record whether the macro is disabled. */
disabled = hp->type == T_DISABLED;
-
+
/* This looks like a macro ref, but if the macro was disabled,
just copy its name and put in a marker if requested. */
-
+
if (disabled) {
#if 0
/* This error check caught useful cases such as
@@ -3172,7 +3172,7 @@ startagain:
if (traditional)
error ("recursive use of macro `%s'", hp->name);
#endif
-
+
if (output_marks) {
check_expand (op, limit - ibp + 2);
*obp++ = '\n';
@@ -3180,7 +3180,7 @@ startagain:
}
break;
}
-
+
/* If macro wants an arglist, verify that a '(' follows.
first skip all whitespace, copying it to the output
after the macro name. Then, if there is no '(',
@@ -3192,7 +3192,7 @@ startagain:
U_CHAR *old_obp = obp;
int old_iln = ip->lineno;
int old_oln = op->lineno;
-
+
while (1) {
/* Scan forward over whitespace, copying it to the output. */
if (ibp == limit && ip->macro != 0) {
@@ -3271,7 +3271,7 @@ startagain:
break;
}
}
-
+
/* This is now known to be a macro call.
Discard the macro name from the output,
along with any following whitespace just copied,
@@ -3304,7 +3304,7 @@ startagain:
ip->bufp = ibp;
op->bufp = obp;
macroexpand (hp, op);
-
+
/* Reexamine input stack, since macroexpand has pushed
a new level on it. */
obp = op->bufp;
@@ -3879,7 +3879,7 @@ special_symbol (hp, op)
&& hp->type != T_SPEC_DEFINED && hp->type != T_CONST)
error ("Predefined macro `%s' used inside `#if' during precompilation",
hp->name);
-
+
for (i = indepth; i >= 0; i--)
if (instack[i].fname != NULL) {
ip = &instack[i];
@@ -4389,7 +4389,7 @@ get_filename:
/* For -M, add this file to the dependencies. */
if (print_deps > (angle_brackets || (system_include_depth > 0)))
deps_output (fname, ' ');
- }
+ }
/* Handle -H option. */
if (print_include_names) {
@@ -4412,7 +4412,7 @@ get_filename:
if (!no_precomp)
do {
sprintf (pcftry, "%s%d", fname, pcfnum++);
-
+
pcf = open (pcftry, O_RDONLY, 0666);
if (pcf != -1)
{
@@ -4435,7 +4435,7 @@ get_filename:
}
}
} while (pcf != -1 && !pcfbuf);
-
+
/* Actually process the file */
if (pcfbuf) {
pcfname = xmalloc (strlen (pcftry) + 1);
@@ -4619,7 +4619,7 @@ read_name_map (dirname)
ptr->map_to[dirlen] = '/';
strcpy (ptr->map_to + dirlen + 1, to);
free (to);
- }
+ }
ptr->map_next = map_list_ptr->map_list_map;
map_list_ptr->map_list_map = ptr;
@@ -4630,12 +4630,12 @@ read_name_map (dirname)
}
fclose (f);
}
-
+
map_list_ptr->map_list_next = map_list;
map_list = map_list_ptr;
return map_list_ptr->map_list_map;
-}
+}
/* Try to open include file FILENAME. SEARCHPTR is the directory
being tried from the include file search path. This function maps
@@ -4871,7 +4871,7 @@ static struct import_file *import_hash_table[IMPORT_HASH_SIZE];
/* Hash a file name for import_hash_table. */
-static int
+static int
import_hash (f)
char *f;
{
@@ -4952,9 +4952,9 @@ add_import (fd, fname)
/* Load the specified precompiled header into core, and verify its
preconditions. PCF indicates the file descriptor to read, which must
- be a regular file. FNAME indicates the file name of the original
+ be a regular file. FNAME indicates the file name of the original
header. *LIMIT will be set to an address one past the end of the file.
- If the preconditions of the file are not satisfied, the buffer is
+ If the preconditions of the file are not satisfied, the buffer is
freed and we return 0. If the preconditions are satisfied, return
the address of the buffer following the preconditions. The buffer, in
this case, should never be freed because various pieces of it will
@@ -4975,7 +4975,7 @@ check_precompiled (pcf, fname, limit)
if (pcp_outfile)
return 0;
-
+
if (file_size_and_mode (pcf, &st_mode, &st_size) < 0)
return 0;
@@ -4988,11 +4988,11 @@ check_precompiled (pcf, fname, limit)
}
else
abort ();
-
+
if (length > 0 && buf[length-1] != '\n')
buf[length++] = '\n';
buf[length] = '\0';
-
+
*limit = buf + length;
/* File is in core. Check the preconditions. */
@@ -5017,29 +5017,29 @@ check_precompiled (pcf, fname, limit)
precompiled header. These are a series of #define and #undef
lines which must match the current contents of the hash
table. */
-static int
+static int
check_preconditions (prec)
char *prec;
{
MACRODEF mdef;
char *lineend;
-
+
while (*prec) {
lineend = (char *) index (prec, '\n');
-
+
if (*prec++ != '#') {
error ("Bad format encountered while reading precompiled file");
return 0;
}
if (!strncmp (prec, "define", 6)) {
HASHNODE *hp;
-
+
prec += 6;
mdef = create_definition (prec, lineend, NULL_PTR);
if (mdef.defn == 0)
abort ();
-
+
if ((hp = lookup (mdef.symnam, mdef.symlen, -1)) == NULL
|| (hp->type != T_MACRO && hp->type != T_CONST)
|| (hp->type == T_MACRO
@@ -5051,7 +5051,7 @@ check_preconditions (prec)
} else if (!strncmp (prec, "undef", 5)) {
char *name;
int len;
-
+
prec += 5;
while (is_hor_space[(U_CHAR) *prec])
prec++;
@@ -5059,7 +5059,7 @@ check_preconditions (prec)
while (is_idchar[(U_CHAR) *prec])
prec++;
len = prec - name;
-
+
if (lookup (name, len, -1))
return 0;
} else {
@@ -5091,14 +5091,14 @@ pcfinclude (buf, limit, name, op)
nstrings = (nstrings << 8) | *cp++;
nstrings = (nstrings << 8) | *cp++;
nstrings = (nstrings << 8) | *cp++;
-
+
/* Looping over each string... */
while (nstrings--) {
U_CHAR *string_start;
U_CHAR *endofthiskey;
STRINGDEF *str;
int nkeys;
-
+
/* Each string starts with a STRINGDEF structure (str), followed */
/* by the text of the string (string_start) */
@@ -5110,14 +5110,14 @@ pcfinclude (buf, limit, name, op)
Do not include stddef.h--it will fail! */
if ((HOST_WIDE_INT) cp & 3)
cp += 4 - ((HOST_WIDE_INT) cp & 3);
-
+
/* Now get the string. */
str = (STRINGDEF *) cp;
string_start = cp += sizeof (STRINGDEF);
-
+
for (; *cp; cp++) /* skip the string */
;
-
+
/* We need to macro expand the string here to ensure that the
proper definition environment is in place. If it were only
expanded when we find out it is needed, macros necessary for
@@ -5129,11 +5129,11 @@ pcfinclude (buf, limit, name, op)
str->writeflag = 0;
str->filename = name;
str->output_mark = outbuf.bufp - outbuf.buf;
-
+
str->chain = 0;
*stringlist_tailp = str;
stringlist_tailp = &str->chain;
-
+
/* Next comes a fourbyte number indicating the number of keys */
/* for this string. */
nkeys = *cp++;
@@ -5149,19 +5149,19 @@ pcfinclude (buf, limit, name, op)
for (; nkeys--; free (tmpbuf.buf), cp = endofthiskey + 1) {
KEYDEF *kp = (KEYDEF *) cp;
HASHNODE *hp;
-
+
/* It starts with a KEYDEF structure */
cp += sizeof (KEYDEF);
-
+
/* Find the end of the key. At the end of this for loop we
advance CP to the start of the next key using this variable. */
endofthiskey = cp + strlen (cp);
kp->str = str;
-
+
/* Expand the key, and enter it into the hash table. */
tmpbuf = expand_to_temp_buffer (cp, endofthiskey, 0, 0);
tmpbuf.bufp = tmpbuf.buf;
-
+
while (is_hor_space[*tmpbuf.bufp])
tmpbuf.bufp++;
if (!is_idstart[*tmpbuf.bufp]
@@ -5169,7 +5169,7 @@ pcfinclude (buf, limit, name, op)
str->writeflag = 1;
continue;
}
-
+
hp = lookup (tmpbuf.bufp, -1, -1);
if (hp == NULL) {
kp->chain = 0;
@@ -5184,7 +5184,7 @@ pcfinclude (buf, limit, name, op)
}
}
/* This output_line_command serves to switch us back to the current
- input file in case some of these strings get output (which will
+ input file in case some of these strings get output (which will
result in line commands for the header file being output). */
output_line_command (&instack[indepth], op, 0, enter_file);
}
@@ -5196,7 +5196,7 @@ pcstring_used (hp)
HASHNODE *hp;
{
KEYDEF *kp;
-
+
for (kp = hp->value.keydef; kp; kp = kp->chain)
kp->str->writeflag = 1;
delete_macro (hp);
@@ -5217,16 +5217,16 @@ write_output ()
/* next_string_loc, in which case we print a series of strings, or */
/* it is less than next_string_loc, in which case we write some of */
/* the buffer. */
- cur_buf_loc = outbuf.buf;
+ cur_buf_loc = outbuf.buf;
next_string = stringlist;
-
+
while (cur_buf_loc < outbuf.bufp || next_string) {
if (next_string
&& cur_buf_loc - outbuf.buf == next_string->output_mark) {
if (next_string->writeflag) {
len = 4 * strlen (next_string->filename) + 32;
while (len > line_command_len)
- line_command = xrealloc (line_command,
+ line_command = xrealloc (line_command,
line_command_len *= 2);
sprintf (line_command, "\n# %d ", next_string->lineno);
strcpy (quote_string (line_command + strlen (line_command),
@@ -5234,15 +5234,15 @@ write_output ()
"\n");
safe_write (fileno (stdout), line_command, strlen (line_command));
safe_write (fileno (stdout), next_string->contents, next_string->len);
- }
+ }
next_string = next_string->chain;
}
else {
len = (next_string
- ? (next_string->output_mark
+ ? (next_string->output_mark
- (cur_buf_loc - outbuf.buf))
: outbuf.bufp - cur_buf_loc);
-
+
safe_write (fileno (stdout), cur_buf_loc, len);
cur_buf_loc += len;
}
@@ -5298,7 +5298,7 @@ struct arglist {
char rest_args;
};
-/* Create a DEFINITION node from a #define directive. Arguments are
+/* Create a DEFINITION node from a #define directive. Arguments are
as for do_define. */
static MACRODEF
create_definition (buf, limit, op)
@@ -5354,7 +5354,7 @@ create_definition (buf, limit, op)
if (!is_idstart[*bp])
pedwarn ("invalid character in macro parameter name");
-
+
/* Find the end of the arg name. */
while (is_idchar[*bp]) {
bp++;
@@ -5473,7 +5473,7 @@ create_definition (buf, limit, op)
mdef.defn = 0;
return mdef;
}
-
+
/* Process a #define command.
BUF points to the contents of the #define command, as a contiguous string.
LIMIT points to the first character past the end of the definition.
@@ -5660,7 +5660,7 @@ comp_def_part (first, beg1, len1, beg2, len2, last)
in that list, or -1 for a macro name that wants no argument list.
MACRONAME is the macro name itself (so we can avoid recursive expansion)
and NAMELEN is its length in characters.
-
+
Note that comments and backslash-newlines have already been deleted
from the argument. */
@@ -6585,7 +6585,7 @@ do_once ()
if (ip != NULL) {
struct file_name_list *new;
-
+
new = (struct file_name_list *) xmalloc (sizeof (struct file_name_list));
new->next = dont_repeat_files;
dont_repeat_files = new;
@@ -6660,7 +6660,7 @@ do_pragma (buf, limit)
fname = p + 1;
if (p = (U_CHAR *) index (fname, '\"'))
*p = '\0';
-
+
for (ptr = all_include_files; ptr; ptr = ptr->next) {
inc_fname = (U_CHAR *) rindex (ptr->fname, '/');
inc_fname = inc_fname ? inc_fname + 1 : (U_CHAR *) ptr->fname;
@@ -6820,7 +6820,7 @@ do_xifdef (buf, limit, op, keyword)
{
int skip;
FILE_BUF *ip = &instack[indepth];
- U_CHAR *end;
+ U_CHAR *end;
int start_of_file = 0;
U_CHAR *control_macro = 0;
@@ -6892,7 +6892,7 @@ do_xifdef (buf, limit, op, keyword)
control_macro[end - buf] = 0;
}
}
-
+
conditional_skip (ip, skip, T_IF, control_macro, op);
return 0;
}
@@ -7558,7 +7558,7 @@ quote_string (dst, src)
*dst++ = '\\';
*dst++ = c;
break;
-
+
case '\0':
*dst++ = '\"';
*dst = '\0';
@@ -7705,7 +7705,7 @@ output_line_command (ip, op, conditional, file_change)
`stringified_length' is the length the argument would have
if stringified.
`use_count' is the number of times this macro arg is substituted
- into the macro. If the actual use count exceeds 10,
+ into the macro. If the actual use count exceeds 10,
the value stored is 10.
`free1' and `free2', if nonzero, point to blocks to be freed
when the macro argument data is no longer needed. */
@@ -7752,7 +7752,7 @@ macroexpand (hp, op)
/* recorded as a precondition. */
if (pcp_inside_if && pcp_outfile && defn->predefined)
dump_single_macro (hp, pcp_outfile);
-
+
nargs = defn->nargs;
if (nargs >= 0) {
@@ -8351,7 +8351,7 @@ macarg1 (start, limit, depthptr, newlines, comments, rest_args)
/* Discard comments and duplicate newlines
in the string of length LENGTH at START,
except inside of string constants.
- The string is copied into itself with its beginning staying fixed.
+ The string is copied into itself with its beginning staying fixed.
NEWLINES is the number of newlines that must be duplicated.
We assume that that much extra space is available past the end
@@ -9332,7 +9332,7 @@ make_definition (str, op)
}
*q = 0;
}
-
+
ip = &instack[++indepth];
ip->nominal_fname = ip->fname = "*Initialization*";
@@ -9417,7 +9417,7 @@ make_assertion (option, str)
error ("malformed option `%s %s'", option, str);
return;
}
-
+
ip = &instack[++indepth];
ip->nominal_fname = ip->fname = "*Initialization*";
@@ -9695,7 +9695,7 @@ output_dots (fd, depth)
depth--;
}
}
-
+
#ifdef VMS
@@ -9746,11 +9746,11 @@ hack_vms_include_specification (fname)
/* We are trying to do a number of things here. First of all, we are
trying to hammer the filenames into a standard format, such that later
processing can handle them.
-
+
If the file name contains something like [dir.], then it recognizes this
as a root, and strips the ".]". Later processing will add whatever is
needed to get things working properly.
-
+
If no device is specified, then the first directory name is taken to be
a device name (or a rooted logical). */
@@ -9950,7 +9950,7 @@ fopen (fname, type)
return fopen (fname, type, "mbc=16");
}
-static int
+static int
open (fname, flags, prot)
char *fname;
int flags;
OpenPOWER on IntegriCloud