if anything needs to be done. (e.g. ./include/stdio.h)
* OPTIONS are such as you would pass to cpp.
- Written by Per Bothner <bothner@cygnus.com>, July 1993. */
+ Written by Per Bothner <bothner@cygnus.com>, July 1993. */
#include <stdio.h>
#include <ctype.h>
#include "xsys-protos.h"
#ifdef FIXPROTO_IGNORE_LIST
-/* This is a currently unused feature. */
+/* This is a currently unused feature. */
/* List of files and directories to ignore.
A directory name (ending in '/') means ignore anything in that
};
/* A NAMELIST is a sequence of names, separated by '\0', and terminated
- by an empty name (i.e. by "\0\0"). */
+ by an empty name (i.e. by "\0\0"). */
-typedef const char* namelist;
+typedef const char *namelist;
-/* The following macros provide the bits for symbol_flags. */
+/* The following macros provide the bits for symbol_flags. */
typedef int symbol_flags;
-/* Used to mark names defined in the ANSI/ISO C standard. */
+/* Used to mark names defined in the ANSI/ISO C standard. */
#define ANSI_SYMBOL 1
-/* Used to mark names defined in the Posix.1 or Posix.2 standard. */
+/* Used to mark names defined in the Posix.1 or Posix.2 standard. */
#define POSIX1_SYMBOL 2
#define POSIX2_SYMBOL 4
-/* Used to mark names defined in X/Open Portability Guide. */
+/* Used to mark names defined in X/Open Portability Guide. */
#define XOPEN_SYMBOL 8
-/* Used to mark names defined in X/Open UNIX Extensions. */
+/* Used to mark names defined in X/Open UNIX Extensions. */
#define XOPEN_EXTENDED_SYMBOL 16
/* Used to indicate names that are not functions */
cur_symbol_table_size++;
if (cur_symbol_table_size >= SYMBOL_TABLE_SIZE)
fatal ("too many calls to add_symbols");
- symbol_table[cur_symbol_table_size].names = NULL; /* Termination. */
+ symbol_table[cur_symbol_table_size].names = NULL; /* Termination. */
}
struct std_include_entry {
namelist names;
};
-const char NONE[] = ""; /* The empty namelist. */
+const char NONE[] = ""; /* The empty namelist. */
-/* Special name to indicate a continuation line in std_include_table. */
+/* Special name to indicate a continuation line in std_include_table. */
const char CONTINUED[] = "";
struct std_include_entry *include_entry;
{ "errno.h", ANSI_SYMBOL|MACRO_SYMBOL, "errno\0" },
- /* ANSI_SYMBOL is wrong, but ... */
+ /* ANSI_SYMBOL is wrong, but ... */
{ "curses.h", ANSI_SYMBOL, "box\0delwin\0endwin\0getcurx\0getcury\0initscr\0\
mvcur\0mvwprintw\0mvwscanw\0newwin\0overlay\0overwrite\0\
scroll\0subwin\0touchwin\0waddstr\0wclear\0wclrtobot\0wclrtoeol\0\
{ "pwd.h", POSIX1_SYMBOL, "getpwnam\0getpwuid\0" },
- /* Left out siglongjmp sigsetjmp - these depend on sigjmp_buf. */
+ /* Left out siglongjmp sigsetjmp - these depend on sigjmp_buf. */
{ "setjmp.h", ANSI_SYMBOL, "longjmp\0setjmp\0" },
/* Left out signal() - its prototype is too complex for us!
Also left out "sigaction sigaddset sigdelset sigemptyset
sigfillset sigismember sigpending sigprocmask sigsuspend"
because these need sigset_t or struct sigaction.
- Most systems that provide them will also declare them. */
+ Most systems that provide them will also declare them. */
{ "signal.h", ANSI_SYMBOL, "kill\0raise\0" },
{ "stdio.h", ANSI_SYMBOL,
setvbuf\0sprintf\0sscanf\0vprintf\0vsprintf\0vfprintf\0tmpfile\0\
tmpnam\0ungetc\0" },
{ CONTINUED, POSIX1_SYMBOL, "fdopen\0fileno\0" },
- { CONTINUED, POSIX2_SYMBOL, "pclose\0popen\0" }, /* I think ... */
+ { CONTINUED, POSIX2_SYMBOL, "pclose\0popen\0" }, /* I think ... */
/* Should perhaps also handle NULL, EOF, ... ? */
/* "div ldiv", - ignored because these depend on div_t, ldiv_t
/* Actually, XPG4 does not seem to have <sys/ioctl.h>, but defines
ioctl in <strops.h>. However, many systems have it is sys/ioctl.h,
- and many systems do have <sys/ioctl.h> but not <strops.h>. */
+ and many systems do have <sys/ioctl.h> but not <strops.h>. */
{ "sys/ioctl.h", XOPEN_EXTENDED_SYMBOL, "ioctl\0" },
{ "sys/socket.h", XOPEN_EXTENDED_SYMBOL, "socket\0" },
enum special_file special_file_handling = no_special;
-/* They are set if the corresponding macro has been seen. */
+/* They are set if the corresponding macro has been seen. */
/* The following are only used when handling sys/stat.h */
int seen_S_IFBLK = 0, seen_S_ISBLK = 0;
int seen_S_IFCHR = 0, seen_S_ISCHR = 0;
/* The following are only used when handling stdlib.h */
int seen_EXIT_FAILURE = 0, seen_EXIT_SUCCESS = 0;
\f
-/* Wrapper around free, to avoid prototype clashes. */
+/* Wrapper around free, to avoid prototype clashes. */
void
xfree (ptr)
struct obstack scan_file_obstack;
/* NOTE: If you edit this, also edit gen-protos.c !! */
+
struct fn_decl *
lookup_std_proto (name, name_length)
const char *name;
recognized_macro (fname)
char *fname;
{
- /* The original include file defines fname as a macro. */
+ /* The original include file defines fname as a macro. */
struct fn_decl *fn = lookup_std_proto (fname, strlen (fname));
- /* Since fname is a macro, don't require a prototype for it. */
+ /* Since fname is a macro, don't require a prototype for it. */
if (fn)
{
if (REQUIRED (fn))
KIND is 'I' for an inline function;
'F' if a normal function declaration preceded by 'extern "C"'
(or nested inside 'extern "C"' braces); or
- 'f' for other function declarations. */
+ 'f' for other function declarations. */
void
recognized_function (fname, fname_length,
fn = lookup_std_proto (fname, fname_length);
- /* Remove the function from the list of required function. */
+ /* Remove the function from the list of required function. */
if (fn)
{
if (REQUIRED (fn))
SET_SEEN (fn);
}
- /* If we have a full prototype, we're done. */
+ /* If we have a full prototype, we're done. */
if (have_arg_list)
return;
return;
/* If the partial prototype was included from some other file,
- we don't need to patch it up (in this run). */
+ we don't need to patch it up (in this run). */
i = strlen (file_seen);
if (i < inc_filename_length
|| strcmp (inc_filename, file_seen + (i - inc_filename_length)) != 0)
return;
/* We only have a partial function declaration,
- so remember that we have to add a complete prototype. */
+ so remember that we have to add a complete prototype. */
partial_count++;
- partial = (struct partial_proto*)
+ partial = (struct partial_proto *)
obstack_alloc (&scan_file_obstack, sizeof (struct partial_proto));
partial->fname = obstack_alloc (&scan_file_obstack, fname_length + 1);
bcopy (fname, partial->fname, fname_length);
}
/* For any name in NAMES that is defined as a macro,
- call recognized_macro on it. */
+ call recognized_macro on it. */
void
check_macro_names (pfile, names)
exit (0);
/* Traditionally, getc and putc are defined in terms of _filbuf and _flsbuf.
- If so, those functions are also required. */
+ If so, those functions are also required. */
if (special_file_handling == stdio_h
&& (fn = lookup_std_proto ("_filbuf", 7)) != NULL)
{
int old_written = CPP_WRITTEN (&scan_in);
int seen_filbuf = 0;
- /* Scan the macro expansion of "getchar();". */
+ /* Scan the macro expansion of "getchar();". */
for (;;)
{
enum cpp_token token = cpp_get_token (&scan_in);
int length = CPP_WRITTEN (&scan_in) - old_written;
CPP_SET_WRITTEN (&scan_in, old_written);
- if (token == CPP_EOF) /* Should not happen ... */
+ if (token == CPP_EOF) /* Should not happen ... */
break;
if (token == CPP_POP && CPP_BUFFER (&scan_in) == buf)
{
int need_flsbuf
= flsbuf_fn && !SEEN (flsbuf_fn) && !REQUIRED (flsbuf_fn);
- /* Append "_filbuf" and/or "_flsbuf" to the required functions. */
+ /* Append "_filbuf" and/or "_flsbuf" to the required functions. */
if (need_filbuf + need_flsbuf)
{
char *new_list;
#endif
}
- /* Now we print out prototypes for those functions that we haven't seen. */
+ /* Now we print out prototypes for those functions that we haven't seen. */
for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++)
{
int if_was_emitted = 0;
*/
-#define INF_GET() (inf_ptr < inf_limit ? *(unsigned char*)inf_ptr++ : EOF)
+#define INF_GET() (inf_ptr < inf_limit ? *(unsigned char *) inf_ptr++ : EOF)
#define INF_UNGET(c) ((c)!=EOF && inf_ptr--)
int
return c;
}
-/* Read into STR from inf_buffer upto DELIM. */
+/* Read into STR from inf_buffer upto DELIM. */
int
inf_read_upto (str, delim)
/* Returns 1 if the file is correctly protected against multiple
inclusion, setting *ifndef_line to the line number of the initial #ifndef
and setting *endif_line to the final #endif.
- Otherwise return 0. */
+ Otherwise return 0. */
int
check_protection (ifndef_line, endif_line)
char *protect_name = NULL; /* Identifier following initial #ifndef */
int define_seen = 0;
- /* Skip initial white space (including comments). */
+ /* Skip initial white space (including comments). */
for (;; lineno++)
{
c = inf_skip_spaces (' ');
if (SSTRING_LENGTH (&buf) == 0 || strcmp (buf.base, "ifndef") != 0)
return 0;
- /* So far so good: We've seen an initial #ifndef. */
+ /* So far so good: We've seen an initial #ifndef. */
*ifndef_line = lineno;
c = inf_scan_ident (&buf, inf_skip_spaces (c));
if (SSTRING_LENGTH (&buf) == 0 || c == EOF)
if (!define_seen)
return 0;
*endif_line = lineno;
- /* Skip final white space (including comments). */
+ /* Skip final white space (including comments). */
for (;;)
{
c = inf_skip_spaces (' ');
else
symbol_table[0].names = NULL;
- /* Count and mark the prototypes required for this include file. */
+ /* Count and mark the prototypes required for this include file. */
for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++)
{
int name_len;
exit (-1);
}
inf_size = sbuf.st_size;
- inf_buffer = (char*) xmalloc (inf_size + 2);
+ inf_buffer = (char *) xmalloc (inf_size + 2);
inf_buffer[inf_size] = '\n';
inf_buffer[inf_size + 1] = '\0';
inf_limit = inf_buffer + inf_size;
close (inf_fd);
- /* If file doesn't end with '\n', add one. */
+ /* If file doesn't end with '\n', add one. */
if (inf_limit > inf_buffer && inf_limit[-1] != '\n')
inf_limit++;
rbrac_line = -1;
}
- /* Reset input file. */
+ /* Reset input file. */
inf_ptr = inf_buffer;
lineno = 1;
fn = lookup_std_proto (buf.base, strlen (buf.base));
/* We only want to edit the declaration matching the one
seen by scan-decls, as there can be multiple
- declarations, selected by #ifdef __STDC__ or whatever. */
+ declarations, selected by #ifdef __STDC__ or whatever. */
if (fn && fn->partial && fn->partial->line_seen == lineno)
{
c = inf_skip_spaces (' ');
}
\f
/* Stub error functions. These replace cpperror.c,
- because we want to suppress error messages. */
+ because we want to suppress error messages. */
void
cpp_file_line_for_message (pfile, filename, line, column)
}
/* IS_ERROR is 2 for fatal error, 1 for error, 0 for warning */
+
void cpp_message (pfile, is_error, msg, arg1, arg2, arg3)
int is_error;
cpp_reader *pfile;