63ad61edae
* c-common.c (declare_function_name): Use func_id_node, function_id_node, and pretty_function_id_node. Do not make __func__ visible at file scope. * c-common.h (c_tree_index): Add CTI_FUNCTION_ID, CTI_PRETTY_FUNCTION_ID, and CTI_FUNC_ID. (function_id_node, pretty_function_id_node, func_id_node): New macros. * c-decl.c (init_decl_processing): Initialize function_id_node, pretty_function_id_node, and func_id_node. (c_make_fname_decl): Correct comment. * tree.h (struct tree_identifier): Constify pointer member. * c-decl.c (pushdecl, implicit_decl_warning): Constify a char *. * c-pragma.h (struct weak_syms): Constify name and value members. (add_weak): Constify arguments. * calls.c (special_function_p): Constify a char *. (expand_call): Remove variable which is initialized and then never used. * dependence.c (struct def_use, struct induction, struct subscript): Constify 'variable' member. (get_low_bound, have_induction_variable): Constify char * argument. (find_induction_variable): Add braces to avoid dangling else. (classify_dependence): Constify char * arrays. * profile.c (output_func_start_profiler): Constify a char *. * stor-layout.c (finalize_record_size): Constify a char *. * tree.c (is_attribute_p): Constify a char *. * varasm.c (add_weak, remove_from_pending_weak_list): Constify argument. * varasm.c (make_function_rtl, make_decl_rtl): Rearrange code for comprehensibility. Do not call get_identifier if we did not change the DECL_ASSEMBLER_NAME of the decl. Use alloca to create temporary string constants, not ggc_alloc_string. No need to copy result of ASM_FORMAT_PRIVATE_NAME. Use const char * to hold IDENTIFIER_POINTERs. ch: * inout.c (add_enum_to_list): Use DECL_NAME directly, don't get its IDENTIFIER_POINTER and immediately call get_identifier on it. * lex.c (yywrap): Constify a char *. cp: * class.c (build_secondary_vtable): Constify a char *. * decl.c (init_decl_processing): Initialize function_id_node, pretty_function_id_node, and func_id_node. * input.c (struct input_source): Constify 'str'. (feed_input): Constify first argument. * mangle.c (write_identifier): Constify argument. * pt.c (mangle_class_name_for_template): Constify argument. f: * ansify.c: Use #line, not # <number>. java: * jcf-parse.c (set_source_filename): Constify a char *. * jcf-write.c (append_innerclasses_attribute, make_class_file_name): Constify a char *. Don't recycle a variable for an unrelated purpose. * parse.y: (build_alias_initializer_parameter_list): Constify a char *. (breakdown_qualified): Do not modify IDENTIFIER_POINTER strings. From-SVN: r36055
189 lines
3.1 KiB
C
189 lines
3.1 KiB
C
/* ansify.c
|
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
|
Contributed by James Craig Burley.
|
|
|
|
This file is part of GNU Fortran.
|
|
|
|
GNU Fortran is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
any later version.
|
|
|
|
GNU Fortran is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GNU Fortran; see the file COPYING. If not, write to
|
|
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
02111-1307, USA. */
|
|
|
|
#include "hconfig.h"
|
|
#include "system.h"
|
|
|
|
#define die_unless(c) \
|
|
do if (!(c)) \
|
|
{ \
|
|
fprintf (stderr, "%s:%lu: %s\n", argv[1], lineno, #c); \
|
|
die (); \
|
|
} \
|
|
while(0)
|
|
|
|
static void ATTRIBUTE_NORETURN
|
|
die (void)
|
|
{
|
|
exit (1);
|
|
}
|
|
|
|
int
|
|
main(int argc, char **argv)
|
|
{
|
|
int c;
|
|
static unsigned long lineno = 1;
|
|
|
|
die_unless (argc == 2);
|
|
|
|
printf ("\
|
|
/* This file is automatically generated from `%s',\n\
|
|
which you should modify instead. */\n\
|
|
#line 1 \"%s\"\n\
|
|
",
|
|
argv[1], argv[1]);
|
|
|
|
while ((c = getchar ()) != EOF)
|
|
{
|
|
switch (c)
|
|
{
|
|
default:
|
|
putchar (c);
|
|
break;
|
|
|
|
case '\n':
|
|
++lineno;
|
|
putchar (c);
|
|
break;
|
|
|
|
case '"':
|
|
putchar (c);
|
|
for (;;)
|
|
{
|
|
c = getchar ();
|
|
die_unless (c != EOF);
|
|
switch (c)
|
|
{
|
|
case '"':
|
|
putchar (c);
|
|
goto next_char;
|
|
|
|
case '\n':
|
|
putchar ('\\');
|
|
putchar ('n');
|
|
putchar ('\\');
|
|
putchar ('\n');
|
|
++lineno;
|
|
break;
|
|
|
|
case '\\':
|
|
putchar (c);
|
|
c = getchar ();
|
|
die_unless (c != EOF);
|
|
putchar (c);
|
|
if (c == '\n')
|
|
++lineno;
|
|
break;
|
|
|
|
default:
|
|
putchar (c);
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case '\'':
|
|
putchar (c);
|
|
for (;;)
|
|
{
|
|
c = getchar ();
|
|
die_unless (c != EOF);
|
|
switch (c)
|
|
{
|
|
case '\'':
|
|
putchar (c);
|
|
goto next_char;
|
|
|
|
case '\n':
|
|
putchar ('\\');
|
|
putchar ('n');
|
|
putchar ('\\');
|
|
putchar ('\n');
|
|
++lineno;
|
|
break;
|
|
|
|
case '\\':
|
|
putchar (c);
|
|
c = getchar ();
|
|
die_unless (c != EOF);
|
|
putchar (c);
|
|
if (c == '\n')
|
|
++lineno;
|
|
break;
|
|
|
|
default:
|
|
putchar (c);
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case '/':
|
|
putchar (c);
|
|
c = getchar ();
|
|
putchar (c);
|
|
if (c != '*')
|
|
break;
|
|
for (;;)
|
|
{
|
|
c = getchar ();
|
|
die_unless (c != EOF);
|
|
|
|
switch (c)
|
|
{
|
|
case '\n':
|
|
++lineno;
|
|
putchar (c);
|
|
break;
|
|
|
|
case '*':
|
|
c = getchar ();
|
|
die_unless (c != EOF);
|
|
if (c == '/')
|
|
{
|
|
putchar ('*');
|
|
putchar ('/');
|
|
goto next_char;
|
|
}
|
|
if (c == '\n')
|
|
{
|
|
++lineno;
|
|
putchar (c);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
/* Don't bother outputting content of comments. */
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
next_char:
|
|
;
|
|
}
|
|
|
|
die_unless (c == EOF);
|
|
|
|
return 0;
|
|
}
|