summaryrefslogtreecommitdiff
path: root/gcc/gcov-io.h
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-04 15:20:26 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-04 15:20:26 +0000
commit35cb45c4eaeb15d82c29d4555824c4fe2f7d1678 (patch)
tree05de4edb80cb0ae6e59ff9b0f5b6509cae6fde04 /gcc/gcov-io.h
parent65ff8f7314508add07c15d6c9d77e2724318bdeb (diff)
downloadgcc-35cb45c4eaeb15d82c29d4555824c4fe2f7d1678.tar.gz
* Makefile.in (LIBGCOV): Add _gcov_merge_add.
* gcov-io.h: Make GCOV_LINKAGE extern in libgcov and prevent resulting namespace clash. (GCOV_MERGE_FUNCTIONS): New. (gcov_merge_fn): Declare. (struct gcov_ctr_info): New field "merge". (__gcov_merge_add): Declare. * coverage.c (ctr_merge_functions): New. (build_ctr_info_type, build_ctr_info_value): Initialize merge field of gcov_ctr_info type. * libgcov.c (__gcov_merge_add): New. (gcov_exit): Call a hook to merge values of counters. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66457 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov-io.h')
-rw-r--r--gcc/gcov-io.h50
1 files changed, 45 insertions, 5 deletions
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index df5fb976543..19b43aba35f 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -176,15 +176,46 @@ typedef HOST_WIDEST_INT gcov_type;
#endif
#endif
-/* In lib gcov we want function linkage to be static, so we do not
- polute the global namespace. In the compiler we want it extern, so
- that they can be accessed from elsewhere. */
-#if IN_LIBGCOV || IN_GCOV
+/* In gcov we want function linkage to be static, so we do not
+ polute the global namespace. In libgcov we need these functions
+ to be extern, so prefix them with __gcov so that we do not conflict.
+ In the compiler we want it extern, so that they can be accessed from
+ elsewhere. */
+#if IN_LIBGCOV
+
+#define GCOV_LINKAGE /* nothing */
+#define gcov_var __gcov_var
+#define gcov_open __gcov_open
+#define gcov_close __gcov_close
+#define gcov_write_bytes __gcov_write_bytes
+#define gcov_write_unsigned __gcov_write_unsigned
+#define gcov_write_counter __gcov_write_counter
+#define gcov_write_string __gcov_write_string
+#define gcov_write_tag __gcov_write_tag
+#define gcov_write_length __gcov_write_length
+#define gcov_write_summary __gcov_write_summary
+#define gcov_read_bytes __gcov_read_bytes
+#define gcov_read_unsigned __gcov_read_unsigned
+#define gcov_read_counter __gcov_read_counter
+#define gcov_read_string __gcov_read_string
+#define gcov_read_summary __gcov_read_summary
+#define gcov_position __gcov_position
+#define gcov_seek __gcov_seek
+#define gcov_seek_end __gcov_seek_end
+#define gcov_is_eof __gcov_is_eof
+#define gcov_is_error __gcov_is_error
+#define gcov_time __gcov_time
+
+#elif IN_GCOV
+
#define GCOV_LINKAGE static
-#else
+
+#else /* !IN_LIBGCOV && !IN_GCOV */
+
#ifndef GCOV_LINKAGE
#define GCOV_LINKAGE extern
#endif
+
#endif
/* File suffixes. */
@@ -220,6 +251,9 @@ typedef HOST_WIDEST_INT gcov_type;
/* A list of human readable names of the counters */
#define GCOV_COUNTER_NAMES {"arcs"}
+/* Names of merge functions for counters. */
+#define GCOV_MERGE_FUNCTIONS {"__gcov_merge_add"}
+
/* Convert a counter index to a tag. */
#define GCOV_TAG_FOR_COUNTER(COUNT) \
(GCOV_TAG_COUNTER_BASE + ((COUNT) << 17))
@@ -286,11 +320,15 @@ struct gcov_fn_info
unsigned n_ctrs[0]; /* instrumented counters */
};
+/* Type of function used to merge counters. */
+typedef void (*gcov_merge_fn) (gcov_type *, unsigned);
+
/* Information about counters. */
struct gcov_ctr_info
{
unsigned num; /* number of counters. */
gcov_type *values; /* their values. */
+ gcov_merge_fn merge; /* The function used to merge them. */
};
/* Information about a single object file. */
@@ -317,6 +355,8 @@ extern void __gcov_init (struct gcov_info *);
/* Called before fork, to avoid double counting. */
extern void __gcov_flush (void);
+/* The merge function that just sums the counters. */
+extern void __gcov_merge_add (gcov_type *, unsigned);
#endif /* IN_LIBGCOV */
/* Because small reads and writes, interspersed with seeks cause lots