#include <stdlib.h>
#endif
+
// PENDING: Straighten this out into configure
+#include <time.h> // all compilers need this
#ifdef __MINGW32__
#include <time.h>
#else
static void add_import ();
static void append_include_chain ();
-static void make_undef ();
static void make_assertion ();
static void path_include ();
static void initialize_builtins ();
static void initialize_char_syntax ();
-static void dump_arg_n ();
-static void dump_defn_1 ();
extern void delete_macro ();
-static void trigraph_pcp ();
static int finclude ();
static void validate_else ();
static int comp_def_part ();
extern void fancy_abort ();
-static void pipe_closed ();
-static void print_containing_files ();
static int lookup_import ();
static int redundant_include_p ();
-static is_system_include ();
+static int is_system_include (cpp_reader *, char *);
static struct file_name_map *read_name_map ();
static char *read_filename_string ();
static int open_include_file ();
-static int check_preconditions ();
-static void pcfinclude ();
-static void pcstring_used ();
static int check_macro_name ();
static int compare_defs ();
static int compare_token_lists ();
if (macro->type == T_DISABLED)
macro->type = T_MACRO;
if (macro->type != T_MACRO || pbuf->buf != macro->value.defn->expansion)
- free (pbuf->buf);
+ Safe_free (pbuf->buf);
return 0;
}
{
if (pbuf->buf)
{
- free (pbuf->buf);
+ Safe_free (pbuf->buf);
pbuf->buf = 0;
}
return 0;
}
-static void
-newline_fix (
- cpp_reader *pfile)
-{
-#if 1
- NEWLINE_FIX;
-#else
- register U_CHAR *p = bp;
-
- /* First count the backslash-newline pairs here. */
-
- while (p[0] == '\\' && p[1] == '\n')
- p += 2;
-
- /* What follows the backslash-newlines is not embarrassing. */
-
- if (*p != '/' && *p != '*')
- return;
-
- /* Copy all potentially embarrassing characters
- that follow the backslash-newline pairs
- down to where the pairs originally started. */
-
- while (*p == '*' || *p == '/')
- *bp++ = *p++;
-
- /* Now write the same number of pairs after the embarrassing chars. */
- while (bp < p) {
- *bp++ = '\\';
- *bp++ = '\n';
- }
-#endif
-}
-
/* Assuming we have read '/'.
If this is the start of a comment (followed by '*' or '/'),
skip to the end of the comment, and return ' '.
{ int c;
register struct directive *kt;
int ident_length;
- long after_ident;
+ long after_ident = 0;
U_CHAR *ident, *line_end;
long old_written = CPP_WRITTEN (pfile);
cpp_buffer *next_buf = CPP_PREV_BUFFER (buf);
(*buf->cleanup) (buf, pfile);
CPP_BUFFER (pfile) = next_buf;
- free (buf);
+ Safe_free (buf);
return next_buf;
#endif
}
CPP_PUTS_Q (pfile, sharp_line, sizeof(sharp_line)-1);
}
- sprintf (CPP_PWRITTEN (pfile), "%d ", line+2);
+ sprintf (CPP_PWRITTEN (pfile), "%ld ", line+2);
CPP_ADJUST_WRITTEN (pfile, strlen (CPP_PWRITTEN (pfile)));
// modification for SDC51
int rest_args)
{
int paren = 0;
- enum cpp_token token;
- long arg_start = CPP_WRITTEN (pfile);
+ enum cpp_token token = CPP_EOF;
+ /* long arg_start = CPP_WRITTEN (pfile); */
char save_put_out_comments = CPP_OPTIONS (pfile)->put_out_comments;
CPP_OPTIONS (pfile)->put_out_comments = 0;
adjust_position (CPP_LINE_BASE (ip), ip->cur, &line, &col);
buf = (char *) alloca (10);
- sprintf (buf, "%d", line);
+ sprintf (buf, "%ld", line);
}
break;
if (!is_idstart[*ip->cur])
goto oops;
- if (hp = cpp_lookup (pfile, ip->cur, -1, -1))
+ if ((hp = cpp_lookup (pfile, ip->cur, -1, -1)) != 0)
{
#if 0
if (pcp_outfile && pcp_inside_if
if (nargs >= 0)
{
- enum cpp_token token;
+ enum cpp_token token = CPP_EOF;
args = (struct argdata *) alloca ((nargs + 1) * sizeof (struct argdata));
int f; /* file number */
- int retried = 0; /* Have already tried macro
- expanding the include line*/
int angle_brackets = 0; /* 0 for "...", 1 for <...> */
- int pcf = -1;
+ /* int pcf = -1; */
char *pcfbuf;
/* char *pcfbuflimit;*/
int pcfnum;
{
struct tokenlist_list *next = tail->next;
free_token_list (tail->tokens);
- free (tail);
+ Safe_free (tail);
tail = next;
}
if (hp == *hp->bucket_hdr)
*hp->bucket_hdr = hp->next;
- free (hp);
+ Safe_free (hp);
}
\f
/* Convert a character string literal into a nul-terminated string.
int any)
{
int c;
- int at_beg_of_line = 1;
struct directive *kt;
IF_STACK_FRAME *save_if_stack = pfile->if_stack; /* don't pop past here */
#if 0
temp = pfile->if_stack;
pfile->if_stack = temp->next;
- free (temp);
+ Safe_free (temp);
break;
default: ;
}
}
}
}
- free (temp);
+ Safe_free (temp);
output_line_command (pfile, 1, same_file);
}
return 0;
cpp_reader *pfile)
{
register int c, c2, c3;
- long old_written;
+ long old_written = 0;
long start_line, start_column;
enum cpp_token token;
struct cpp_options *opts = CPP_OPTIONS (pfile);
strcpy (ptr->map_to, dirname);
ptr->map_to[dirlen] = '/';
strcpy (ptr->map_to + dirlen + 1, to);
- free (to);
+ Safe_free (to);
}
ptr->map_next = map_list_ptr->map_list_map;
long i;
int length;
cpp_buffer *fp; /* For input stack frame */
- int missing_newline = 0;
+ /* int missing_newline = 0; # KILL */
if (file_size_and_mode (f, &st_mode, &st_size) < 0)
{
indepth--;
input_file_stack_tick++;
- free (fp->buf);
+ Safe_free (fp->buf);
#endif
return 1;
cpp_perror_with_name (pfile, fname);
close (f);
- free (fp->buf);
+ Safe_free (fp->buf);
return 1;
}
for (pend = opts->pending; pend; )
{
struct cpp_pending *next = pend->next;
- free (pend);
+ Safe_free (pend);
pend = next;
}
opts->pending = NULL;
char *p;
if (argv[i][2] != 0)
+ {
p = argv[i] + 2;
- else if (i + 1 == argc)
- fatal ("Assertion missing after -A option");
- else
- p = argv[++i];
+ }
+ else
+ {
+ if (++i == argc)
+ {
+ fatal ("Assertion missing after -A option");
+ }
+ p = argv[i];
+ }
if (!strcmp (p, "-")) {
struct cpp_pending **ptr;
&& (pend->cmd[1] == 'D' || pend->cmd[1] == 'A'))
{
*ptr = pend->next;
- free (pend);
+ Safe_free (pend);
}
else
ptr = &pend->next;
if (pfile->token_buffer)
{
- free (pfile->token_buffer);
+ Safe_free (pfile->token_buffer);
pfile->token_buffer = NULL;
}
if (pfile->deps_buffer)
{
- free (pfile->deps_buffer);
+ Safe_free (pfile->deps_buffer);
pfile->deps_buffer = NULL;
pfile->deps_allocated_size = 0;
}
{
IF_STACK_FRAME *temp = pfile->if_stack;
pfile->if_stack = temp->next;
- free (temp);
+ Safe_free (temp);
}
while (pfile->dont_repeat_files)
{
struct file_name_list *temp = pfile->dont_repeat_files;
pfile->dont_repeat_files = temp->next;
- free (temp->fname);
- free (temp);
+ Safe_free (temp->fname);
+ Safe_free (temp);
}
while (pfile->all_include_files)
{
struct file_name_list *temp = pfile->all_include_files;
pfile->all_include_files = temp->next;
- free (temp->fname);
- free (temp);
+ Safe_free (temp->fname);
+ Safe_free (temp);
}
for (i = IMPORT_HASH_SIZE; --i >= 0; )
while (imp)
{
struct import_file *next = imp->next;
- free (imp->name);
- free (imp);
+ Safe_free (imp->name);
+ Safe_free (imp);
imp = next;
}
pfile->import_hash_table[i] = 0;
else
hp->value = tail->next;
free_token_list (tail->tokens);
- free (tail);
+ Safe_free (tail);
} else {
prev = tail;
}
{
struct arglist *temp;
long name_written = CPP_WRITTEN (pfile);
- int eofp = 0; int c;
+ int c;
cpp_skip_hspace (pfile);
{
while (tokens) {
struct arglist *next = tokens->next;
- free (tokens->name);
- free (tokens);
+ Safe_free (tokens->name);
+ Safe_free (tokens);
tokens = next;
}
}