summaryrefslogtreecommitdiff
path: root/gcc/genattr.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-02 16:29:32 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-02 16:29:32 +0000
commitd0c809e14ba0a2911203898049d7a30468adc86b (patch)
tree113af7fdc2e163e99c91162b13799deeae6fdb8d /gcc/genattr.c
parent4c47007a5147737df6bd83a6adc9201489301998 (diff)
downloadlinaro-gcc-d0c809e14ba0a2911203898049d7a30468adc86b.tar.gz
linaro-gcc-d0c809e14ba0a2911203898049d7a30468adc86b.tar.bz2
linaro-gcc-d0c809e14ba0a2911203898049d7a30468adc86b.zip
* genattr.c, gencheck.c, gencodes.c, genconfig.c, genflags.c,
gengenrtl.c: Wrap generated header in multiple-include guard. Improve error checking. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41006 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genattr.c')
-rw-r--r--gcc/genattr.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/genattr.c b/gcc/genattr.c
index bb7ccbf7c59..4fff3a100f8 100644
--- a/gcc/genattr.c
+++ b/gcc/genattr.c
@@ -213,14 +213,16 @@ main (argc, argv)
if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
return (FATAL_EXIT_CODE);
- printf ("/* Generated automatically by the program `genattr'\n\
-from the machine description file `md'. */\n\n");
+ puts ("/* Generated automatically by the program `genattr'");
+ 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
a reference to the variable `which_alternative'. */
- printf ("#define HAVE_ATTR_alternative\n");
- printf ("#define get_attr_alternative(insn) which_alternative\n");
+ puts ("#define HAVE_ATTR_alternative");
+ puts ("#define get_attr_alternative(insn) which_alternative");
/* Read the machine description. */
@@ -359,8 +361,12 @@ from the machine description file `md'. */\n\n");
printf("#define ATTR_FLAG_unlikely\t0x10\n");
printf("#define ATTR_FLAG_very_unlikely\t0x20\n");
- fflush (stdout);
- return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
+ puts("\n#endif /* GCC_INSN_ATTR_H */");
+
+ 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. */