OSDN Git Service

Add Zem as Objective-C++ maintainer per Joe Buck.
[pf3gnuchains/gcc-fork.git] / gcc / gcov-io.h
index e83c516..2b49dcf 100644 (file)
@@ -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
@@ -215,11 +214,7 @@ typedef HOST_WIDEST_INT gcov_type;
 #include <sys/types.h>
 #endif
 #else /*!IN_GCOV */
-#if LONG_LONG_TYPE_SIZE > 32
-#define GCOV_TYPE_NODE intDI_type_node
-#else
-#define GCOV_TYPE_NODE intSI_type_node
-#endif
+#define GCOV_TYPE_SIZE (LONG_LONG_TYPE_SIZE > 32 ? 64 : 32)
 #endif
 
 #if defined (HOST_HAS_F_SETLKW)
@@ -243,7 +238,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 +278,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)
@@ -447,6 +442,23 @@ extern void __gcov_merge_single (gcov_type *, unsigned);
 /* The merge function to choose the most common difference between
    consecutive values.  */
 extern void __gcov_merge_delta (gcov_type *, unsigned);
+
+/* The profiler functions.  */
+extern void __gcov_interval_profiler (gcov_type *, gcov_type, int, unsigned); 
+extern void __gcov_pow2_profiler (gcov_type *, gcov_type);
+extern void __gcov_one_value_profiler (gcov_type *, gcov_type);
+
+#ifndef inhibit_libc
+/* The wrappers around some library functions..  */
+extern pid_t __gcov_fork (void);
+extern int __gcov_execl (const char *, const char *, ...);
+extern int __gcov_execlp (const char *, const char *, ...);
+extern int __gcov_execle (const char *,  const char *, ...);
+extern int __gcov_execv (const char *, char *const []);
+extern int __gcov_execvp (const char *, char *const []);
+extern int __gcov_execve (const char *, char  *const [], char *const []);
+#endif
+
 #endif /* IN_LIBGCOV */
 
 #if IN_LIBGCOV >= 0
@@ -498,7 +510,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);
@@ -510,7 +521,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
@@ -537,32 +547,15 @@ GCOV_LINKAGE void gcov_write_length (gcov_position_t /*position*/);
 GCOV_LINKAGE time_t gcov_time (void);
 #endif
 
-/* Make sure the library is used correctly.  */
-#if ENABLE_CHECKING
-#define GCOV_CHECK(expr) ((expr) ? (void)0 : (void)abort ())
-#else
-#define GCOV_CHECK(expr)
-#endif
-#define GCOV_CHECK_READING() GCOV_CHECK(gcov_var.mode > 0)
-#define GCOV_CHECK_WRITING() GCOV_CHECK(gcov_var.mode < 0)
-
 /* Save the current position in the gcov file.  */
 
 static inline gcov_position_t
 gcov_position (void)
 {
-  GCOV_CHECK_READING ();
+  gcc_assert (gcov_var.mode > 0);
   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
@@ -577,21 +570,12 @@ gcov_is_error (void)
 static inline void
 gcov_rewrite (void)
 {
-  GCOV_CHECK_READING ();
+  gcc_assert (gcov_var.mode > 0);
   gcov_var.mode = -1;
   gcov_var.start = 0;
   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 */