aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcov-io.h
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-29 08:58:59 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-29 08:58:59 +0000
commit421055caa5d450505d0fbf6a472dace6c3f12f9e (patch)
tree16726bd91201d3686e4da590f47456b9a7153c9d /gcc/gcov-io.h
parentf0376c19272666256dece44da813084d8e78cb5e (diff)
* gcov-io.h: Allow zero tag as EOF indicator.
(gcov_is_eof): Remove. (gcov_truncate): Remove. * gcov-io.c (gcov_seek): Always SEEK_SET. * libgcov.c (gcov_exit): Don't use gcov_truncate. Write explicit EOF tag. * coverage.c (read_counts_file): Don't use gcov_is_eof. * gcov-dump.c (dump_file): Likewise. * gcov.c (read_graph_file, read_count_file): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85291 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov-io.h')
-rw-r--r--gcc/gcov-io.h42
1 files changed, 11 insertions, 31 deletions
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index 75abbea479b..50eacccdc46 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -29,22 +29,21 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
the executable file might be covered by the GNU General Public License. */
/* Coverage information is held in two files. A notes file, which is
- generated by the compiler, and a data file, which is generated
- by the program under test. Both files use a similar structure. We
- do not attempt to make these files backwards compatible with
- previous versions, as you only need coverage information when
- developing a program. We do hold version information, so that
- mismatches can be detected, and we use a format that allows tools
- to skip information they do not understand or are not interested
- in.
+ generated by the compiler, and a data file, which is generated by
+ the program under test. Both files use a similar structure. We do
+ not attempt to make these files backwards compatible with previous
+ versions, as you only need coverage information when developing a
+ program. We do hold version information, so that mismatches can be
+ detected, and we use a format that allows tools to skip information
+ they do not understand or are not interested in.
Numbers are recorded in the 32 bit unsigned binary form of the
endianness of the machine generating the file. 64 bit numbers are
stored as two 32 bit numbers, the low part first. Strings are
padded with 1 to 4 NUL bytes, to bring the length up to a multiple
of 4. The number of 4 bytes is stored, followed by the padded
- string. Zero length and NULL strings are simply stored as
- a length of zero (they have no trailing NUL or padding).
+ string. Zero length and NULL strings are simply stored as a length
+ of zero (they have no trailing NUL or padding).
int32: byte3 byte2 byte1 byte0 | byte0 byte1 byte2 byte3
int64: int32:low int32:high
@@ -243,7 +242,6 @@ typedef HOST_WIDEST_INT gcov_type;
#define gcov_seek __gcov_seek
#define gcov_rewrite __gcov_rewrite
#define gcov_is_error __gcov_is_error
-#define gcov_is_eof __gcov_is_eof
#define gcov_write_unsigned __gcov_write_unsigned
#define gcov_write_counter __gcov_write_counter
#define gcov_write_summary __gcov_write_summary
@@ -284,7 +282,8 @@ typedef HOST_WIDEST_INT gcov_type;
/* The record tags. Values [1..3f] are for tags which may be in either
file. Values [41..9f] for those in the note file and [a1..ff] for
- the data file. */
+ the data file. The tag value zero is used as an explicit end of
+ file marker -- it is not required to be present. */
#define GCOV_TAG_FUNCTION ((gcov_unsigned_t)0x01000000)
#define GCOV_TAG_FUNCTION_LENGTH (2)
@@ -510,7 +509,6 @@ GCOV_LINKAGE int gcov_close (void);
/* Available everywhere. */
static gcov_position_t gcov_position (void);
static int gcov_is_error (void);
-static int gcov_is_eof (void);
GCOV_LINKAGE gcov_unsigned_t gcov_read_unsigned (void);
GCOV_LINKAGE gcov_type gcov_read_counter (void);
@@ -522,7 +520,6 @@ GCOV_LINKAGE void gcov_write_counter (gcov_type);
GCOV_LINKAGE void gcov_write_tag_length (gcov_unsigned_t, gcov_unsigned_t);
GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/,
const struct gcov_summary *);
-static void gcov_truncate (void);
static void gcov_rewrite (void);
GCOV_LINKAGE void gcov_seek (gcov_position_t /*position*/);
#else
@@ -567,14 +564,6 @@ gcov_position (void)
return gcov_var.start + gcov_var.offset;
}
-/* Return nonzero if we read to end of file. */
-
-static inline int
-gcov_is_eof (void)
-{
- return !gcov_var.overread;
-}
-
/* Return nonzero if the error flag is set. */
static inline int
@@ -595,15 +584,6 @@ gcov_rewrite (void)
gcov_var.offset = 0;
fseek (gcov_var.file, 0L, SEEK_SET);
}
-
-#ifdef __MINGW32__
-#define ftruncate _chsize
-#endif
-static inline void
-gcov_truncate (void)
-{
- ftruncate (fileno (gcov_var.file), 0L);
-}
#endif
#endif /* IN_LIBGCOV >= 0 */