diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6273b2ae5a4d2acc44369f7b7e52c831230fb050..0937f2473b01298ac743273345f453760b47bf4a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2001-01-30 Bruce Korb <bkorb@gnu.org> + + fixinc/fixincl.c(process): Emit error message only if appropriate :) + (load_file): do not rely on load_file_data() to close file pointer + fixinc/fixlib.c(load_file_data): do not close passed in file pointer + fixinc/inclhack.def(irix_limits_const): add test_text + 2001-02-06 Neil Booth <neil@daikokuya.demon.co.uk> * cppexp.c (parse_defined): Improve diagnostics for invalid diff --git a/gcc/fixinc/fixincl.c b/gcc/fixinc/fixincl.c index 3f2cb564e7c2ed70dd0e1cd4fce3cca0435bbd38..bd134255b8f5438e3de7e24231eeaf4bcf81c81c 100644 --- a/gcc/fixinc/fixincl.c +++ b/gcc/fixinc/fixincl.c @@ -364,14 +364,13 @@ load_file ( fname ) res = (char*)mmap ((void*)NULL, data_map_size, PROT_READ, MAP_PRIVATE, data_map_fd, 0); if (res == (char*)BAD_ADDR) +#endif { + FILE* fp = fdopen (data_map_fd, "r"); curr_data_mapped = BOOL_FALSE; - res = load_file_data ( fdopen (data_map_fd, "r")); + res = load_file_data (fp); + fclose (fp); } -#else - curr_data_mapped = BOOL_FALSE; - res = load_file_data ( fdopen (data_map_fd, "r")); -#endif return res; } @@ -1431,8 +1430,9 @@ process () read_fd = open (pz_temp_file, O_RDONLY); if (read_fd < 0) { - fprintf (stderr, "error %d (%s) opening output (%s) for read\n", - errno, xstrerror (errno), pz_temp_file); + if (errno != ENOENT) + fprintf (stderr, "error %d (%s) opening output (%s) for read\n", + errno, xstrerror (errno), pz_temp_file); } else { diff --git a/gcc/fixinc/fixlib.c b/gcc/fixinc/fixlib.c index 7bf8cbcb957f557694cf975c884f0641b4937652..647d2b379686f765028b25c56e37d2bb7ae87a60 100644 --- a/gcc/fixinc/fixlib.c +++ b/gcc/fixinc/fixlib.c @@ -39,6 +39,9 @@ load_file_data (fp) int space_left = -1; /* allow for terminating NUL */ size_t space_used = 0; + if (fp == (FILE*)NULL) + return pz_data; + do { size_t size_read; @@ -62,7 +65,6 @@ load_file_data (fp) fprintf (stderr, "error %d (%s) reading input\n", err, xstrerror (err)); free ((void *) pz_data); - fclose (fp); return (char *) NULL; } } @@ -73,7 +75,6 @@ load_file_data (fp) pz_data = xrealloc ((void*)pz_data, space_used+1 ); pz_data[ space_used ] = NUL; - fclose (fp); return pz_data; } diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def index 860ec37848c0c59aa1f89646e4ead98f83f23141..40332750c1dfe61e9d5139ec845bbe84a0ec18f1 100644 --- a/gcc/fixinc/inclhack.def +++ b/gcc/fixinc/inclhack.def @@ -1292,6 +1292,7 @@ fix = { select = "^extern const "; c_fix = format; c_fix_arg = "extern __const "; + test_text = "extern const char limit; /* test\n\tlimits */"; };