Commit 0313e85b by Zack Weinberg Committed by Zack Weinberg

genattr.c, [...]: Wrap generated header in multiple-include guard.

	* genattr.c, gencheck.c, gencodes.c, genconfig.c, genflags.c,
	gengenrtl.c:  Wrap generated header in multiple-include guard.
	Improve error checking.

From-SVN: r41006
parent 79cb7361
2001-04-02 Zack Weinberg <zackw@stanford.edu>
* genattr.c, gencheck.c, gencodes.c, genconfig.c, genflags.c,
gengenrtl.c: Wrap generated header in multiple-include guard.
Improve error checking.
2001-04-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2001-04-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* configure.in: Don't check for putenv. * configure.in: Don't check for putenv.
......
...@@ -213,14 +213,16 @@ main (argc, argv) ...@@ -213,14 +213,16 @@ main (argc, argv)
if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE) if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
return (FATAL_EXIT_CODE); return (FATAL_EXIT_CODE);
printf ("/* Generated automatically by the program `genattr'\n\ puts ("/* Generated automatically by the program `genattr'");
from the machine description file `md'. */\n\n"); puts (" from the machine description file `md'. */\n");
puts ("#ifndef GCC_INSN_ATTR_H");
puts ("#define GCC_INSN_ATTR_H\n");
/* For compatibility, define the attribute `alternative', which is just /* For compatibility, define the attribute `alternative', which is just
a reference to the variable `which_alternative'. */ a reference to the variable `which_alternative'. */
printf ("#define HAVE_ATTR_alternative\n"); puts ("#define HAVE_ATTR_alternative");
printf ("#define get_attr_alternative(insn) which_alternative\n"); puts ("#define get_attr_alternative(insn) which_alternative");
/* Read the machine description. */ /* Read the machine description. */
...@@ -359,8 +361,12 @@ from the machine description file `md'. */\n\n"); ...@@ -359,8 +361,12 @@ from the machine description file `md'. */\n\n");
printf("#define ATTR_FLAG_unlikely\t0x10\n"); printf("#define ATTR_FLAG_unlikely\t0x10\n");
printf("#define ATTR_FLAG_very_unlikely\t0x20\n"); printf("#define ATTR_FLAG_very_unlikely\t0x20\n");
fflush (stdout); puts("\n#endif /* GCC_INSN_ATTR_H */");
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
return FATAL_EXIT_CODE;
return SUCCESS_EXIT_CODE;
} }
/* Define this so we can link with print-rtl.o to get debug_rtx function. */ /* Define this so we can link with print-rtl.o to get debug_rtx function. */
......
...@@ -35,7 +35,7 @@ static void usage PARAMS ((void)); ...@@ -35,7 +35,7 @@ static void usage PARAMS ((void));
static void static void
usage () usage ()
{ {
fprintf (stderr,"Usage: gencheck\n"); fputs ("Usage: gencheck\n", stderr);
} }
extern int main PARAMS ((int, char **)); extern int main PARAMS ((int, char **));
...@@ -57,13 +57,17 @@ main (argc, argv) ...@@ -57,13 +57,17 @@ main (argc, argv)
return (1); return (1);
} }
printf ("/* This file is generated using gencheck. Do not edit. */\n"); puts ("/* This file is generated using gencheck. Do not edit. */\n");
puts ("#ifndef GCC_TREE_CHECK_H");
puts ("#define GCC_TREE_CHECK_H\n");
for (i = 0; tree_codes[i]; i++) for (i = 0; tree_codes[i]; i++)
{ {
printf ("#define %s_CHECK(t)\tTREE_CHECK (t, %s)\n", printf ("#define %s_CHECK(t)\tTREE_CHECK (t, %s)\n",
tree_codes[i], tree_codes[i]); tree_codes[i], tree_codes[i]);
} }
puts ("\n#endif /* GCC_TREE_CHECK_H */");
return 0; return 0;
} }
......
...@@ -88,10 +88,10 @@ main (argc, argv) ...@@ -88,10 +88,10 @@ main (argc, argv)
if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE) if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
return (FATAL_EXIT_CODE); return (FATAL_EXIT_CODE);
printf ("/* Generated automatically by the program `gencodes'\n\ puts ("/* Generated automatically by the program `gencodes'");
from the machine description file `md'. */\n\n"); puts (" from the machine description file `md'. */\n");
puts ("#ifndef GCC_INSN_CODES_H");
printf ("#ifndef MAX_INSN_CODE\n\n"); puts ("#define GCC_INSN_CODES_H\n");
/* Read the machine description. */ /* Read the machine description. */
...@@ -118,10 +118,12 @@ from the machine description file `md'. */\n\n"); ...@@ -118,10 +118,12 @@ from the machine description file `md'. */\n\n");
output_predicate_decls (); output_predicate_decls ();
printf ("\n#endif /* MAX_INSN_CODE */\n"); puts("\n#endif /* GCC_INSN_CODES_H */");
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
return FATAL_EXIT_CODE;
fflush (stdout); return SUCCESS_EXIT_CODE;
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
} }
/* Define this so we can link with print-rtl.o to get debug_rtx function. */ /* Define this so we can link with print-rtl.o to get debug_rtx function. */
......
...@@ -280,8 +280,10 @@ main (argc, argv) ...@@ -280,8 +280,10 @@ main (argc, argv)
if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE) if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
return (FATAL_EXIT_CODE); return (FATAL_EXIT_CODE);
printf ("/* Generated automatically by the program `genconfig'\n\ puts ("/* Generated automatically by the program `genconfig'");
from the machine description file `md'. */\n\n"); puts (" from the machine description file `md'. */\n");
puts ("#ifndef GCC_INSN_CONFIG_H");
puts ("#define GCC_INSN_CONFIG_H\n");
/* Allow at least 10 operands for the sake of asm constructs. */ /* Allow at least 10 operands for the sake of asm constructs. */
max_recog_operands = 9; /* We will add 1 later. */ max_recog_operands = 9; /* We will add 1 later. */
...@@ -356,8 +358,12 @@ from the machine description file `md'. */\n\n"); ...@@ -356,8 +358,12 @@ from the machine description file `md'. */\n\n");
printf ("#define MAX_INSNS_PER_PEEP2 %d\n", max_insns_per_peep2); printf ("#define MAX_INSNS_PER_PEEP2 %d\n", max_insns_per_peep2);
} }
fflush (stdout); puts("\n#endif /* GCC_INSN_CONFIG_H */");
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
return FATAL_EXIT_CODE;
return SUCCESS_EXIT_CODE;
} }
/* Define this so we can link with print-rtl.o to get debug_rtx function. */ /* Define this so we can link with print-rtl.o to get debug_rtx function. */
......
...@@ -233,8 +233,10 @@ main (argc, argv) ...@@ -233,8 +233,10 @@ main (argc, argv)
if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE) if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
return (FATAL_EXIT_CODE); return (FATAL_EXIT_CODE);
printf ("/* Generated automatically by the program `genflags'\n\ puts ("/* Generated automatically by the program `genflags'");
from the machine description file `md'. */\n\n"); puts (" from the machine description file `md'. */\n");
puts ("#ifndef GCC_INSN_FLAGS_H");
puts ("#define GCC_INSN_FLAGS_H\n");
/* Read the machine description. */ /* Read the machine description. */
...@@ -258,8 +260,12 @@ from the machine description file `md'. */\n\n"); ...@@ -258,8 +260,12 @@ from the machine description file `md'. */\n\n");
for (insn_ptr = insns; *insn_ptr; insn_ptr++) for (insn_ptr = insns; *insn_ptr; insn_ptr++)
gen_proto (*insn_ptr); gen_proto (*insn_ptr);
fflush (stdout); puts("\n#endif /* GCC_INSN_FLAGS_H */");
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
return FATAL_EXIT_CODE;
return SUCCESS_EXIT_CODE;
} }
/* Define this so we can link with print-rtl.o to get debug_rtx function. */ /* Define this so we can link with print-rtl.o to get debug_rtx function. */
......
...@@ -351,7 +351,10 @@ genheader () ...@@ -351,7 +351,10 @@ genheader ()
{ {
int i; int i;
const char **fmt; const char **fmt;
puts ("#ifndef GCC_GENRTL_H");
puts ("#define GCC_GENRTL_H\n");
for (fmt = formats; *fmt; ++fmt) for (fmt = formats; *fmt; ++fmt)
gendecl (*fmt); gendecl (*fmt);
...@@ -360,6 +363,8 @@ genheader () ...@@ -360,6 +363,8 @@ genheader ()
for (i = 0; i < NUM_RTX_CODE; i++) for (i = 0; i < NUM_RTX_CODE; i++)
if (! special_format (defs[i].format)) if (! special_format (defs[i].format))
genmacro (i); genmacro (i);
puts ("\n#endif /* GCC_GENRTL_H */");
} }
/* Generate the text of the code file we write, genrtl.c. */ /* Generate the text of the code file we write, genrtl.c. */
...@@ -420,6 +425,8 @@ main (argc, argv) ...@@ -420,6 +425,8 @@ main (argc, argv)
else else
gencode (); gencode ();
fflush (stdout); if (ferror (stdout) || fflush (stdout) || fclose (stdout))
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); return FATAL_EXIT_CODE;
return SUCCESS_EXIT_CODE;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment