/* Protoize program - Original version by Ron Guilmette (rfg@segfault.us.com).
Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GCC.
/* Type of the structure that holds information about macro unexpansions. */
struct unexpansion_struct {
- const char *expanded;
- const char *contracted;
+ const char *const expanded;
+ const char *const contracted;
};
typedef struct unexpansion_struct unexpansion;
#define LOCAL_INCLUDE_DIR "/usr/local/include"
#endif
-struct default_include { const char *fname;
- const char *component;
- int x1, x2; } include_defaults[]
+static const struct default_include { const char *const fname;
+ const char *const component;
+ const int x1, x2; } include_defaults[]
#ifdef INCLUDE_DEFAULTS
= INCLUDE_DEFAULTS;
#else
static void
notice VPARAMS ((const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- const char *msgid;
-#endif
- va_list ap;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- msgid = va_arg (ap, const char *);
-#endif
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
vfprintf (stderr, _(msgid), ap);
- va_end (ap);
+ VA_CLOSE (ap);
}
\f
}
if (nchars == 0)
break;
- /* Arithmetic on void pointers is a gcc extention. */
+ /* Arithmetic on void pointers is a gcc extension. */
ptr = (char *) ptr + nchars;
left -= nchars;
}
pname, shortpath (NULL, out_fname), xstrerror (errno_val));
return;
}
- /* Arithmetic on void pointers is a gcc extention. */
+ /* Arithmetic on void pointers is a gcc extension. */
ptr = (char *) ptr + written;
len -= written;
}
is_id_char (ch)
int ch;
{
- return (ISALNUM (ch) || (ch == '_') || (ch == '$'));
+ return (ISIDNUM (ch) || (ch == '$'));
}
/* Give a message indicating the proper way to invoke this program and then
in_system_include_dir (path)
const char *path;
{
- struct default_include *p;
+ const struct default_include *p;
if (! is_abspath (path))
abort (); /* Must be an absolutized filename. */
strcpy (copy_p, unexp_p->contracted);
copy_p += size;
- /* Assume the there will not be another replacement required
+ /* Assume that there will not be another replacement required
within the text just replaced. */
s += len;
const char *rel_filename;
{
/* Setup the current working directory as needed. */
- const char *cwd2 = (cwd) ? cwd : cwd_buffer;
+ const char *const cwd2 = (cwd) ? cwd : cwd_buffer;
char *const abs_buffer
= (char *) alloca (strlen (cwd2) + strlen (rel_filename) + 2);
char *endp = abs_buffer;
{
file_info *file_p = hp->fip;
def_dec_info *prev = NULL;
- def_dec_info *current = (def_dec_info *)file_p->defs_decs;
+ def_dec_info *current = (def_dec_info *) file_p->defs_decs;
if (!current)
return; /* no list to reverse */
prev = current;
- if (! (current = (def_dec_info *)current->next_in_file))
+ if (! (current = (def_dec_info *) current->next_in_file))
return; /* can't reverse a single list element */
prev->next_in_file = NULL;
while (current)
{
- def_dec_info *next = (def_dec_info *)current->next_in_file;
+ def_dec_info *next = (def_dec_info *) current->next_in_file;
current->next_in_file = prev;
prev = current;
code being converted contains its own definition of a function which
could have been supplied by libc.a. In such cases, we should avoid
issuing the normal warning, and defer to the definition given in the
- user's own code. */
+ user's own code. */
for (dd_p = head; dd_p; dd_p = dd_p->next_for_func)
if (dd_p->is_func_def && !dd_p->is_static)
for (dd_p2 = dd_p->next_for_func; dd_p2; dd_p2 = dd_p2->next_for_func)
if (!dd_p2->is_func_def && dd_p2->is_static
&& !dd_p2->definition && (dd_p2->file == dd_p->file))
- ((NONCONST def_dec_info *)dd_p2)->definition = dd_p->definition;
+ ((NONCONST def_dec_info *) dd_p2)->definition = dd_p->definition;
}
/* Convert any dummy (-1) definitions we created in the step above back to
by an alphabetic character, while others *cannot* validly be followed
by such characters. */
- if ((ch == '{') || ISALPHA ((unsigned char)ch))
+ if ((ch == '{') || ISALPHA ((unsigned char) ch))
break;
/* At this point, we have found a right paren, but we know that it is
/* Now write out full prototypes for all of the things that had been
implicitly declared in this file (but only those for which we were
actually able to find unique matching definitions). Avoid duplicates
- by marking things that we write out as we go. */
+ by marking things that we write out as we go. */
{
int some_decls_added = 0;
have_newlines |= (*scan_orig == '\n');
/* Leave identical whitespace alone. */
if (!ISSPACE ((const unsigned char)*scan_orig))
- *((NONCONST char *)scan_orig) = ' '; /* identical - so whiteout */
+ *((NONCONST char *) scan_orig) = ' '; /* identical - so whiteout */
}
else
have_flotsam = 1;
while (scan_p[1] != '\'' || scan_p[0] == '\\')
{
if (scan_p[0] == '\\'
- && !ISSPACE ((const unsigned char)scan_p[1]))
+ && !ISSPACE ((const unsigned char) scan_p[1]))
scan_p[1] = ' ';
if (!ISSPACE ((const unsigned char)*scan_p))
*scan_p = ' ';
while (scan_p[1] != '"' || scan_p[0] == '\\')
{
if (scan_p[0] == '\\'
- && !ISSPACE ((const unsigned char)scan_p[1]))
+ && !ISSPACE ((const unsigned char) scan_p[1]))
scan_p[1] = ' ';
if (!ISSPACE ((const unsigned char)*scan_p))
*scan_p = ' ';
#endif /* !defined (UNPROTOIZE) */
}
\f
-static struct option longopts[] =
+static const struct option longopts[] =
{
{"version", 0, 0, 'V'},
{"file_name", 0, 0, 'p'},
signal (SIGCHLD, SIG_DFL);
#endif
-/* LC_CTYPE determines the character set used by the terminal so it has be set
- to output messages correctly. */
-
-#ifdef HAVE_LC_MESSAGES
- setlocale (LC_CTYPE, "");
- setlocale (LC_MESSAGES, "");
-#else
- setlocale (LC_ALL, "");
-#endif
-
- (void) bindtextdomain (PACKAGE, localedir);
- (void) textdomain (PACKAGE);
+ gcc_init_libintl ();
cwd_buffer = getpwd ();
if (!cwd_buffer)
{
const char *cp;
- for (cp = varargs_style_indicator;
- ISALNUM ((const unsigned char)*cp) || *cp == '_'; cp++)
+ for (cp = varargs_style_indicator; ISIDNUM (*cp); cp++)
continue;
if (*cp != 0)
varargs_style_indicator = savestring (varargs_style_indicator,