Patchwork gcov symbols

login
register
mail settings
Submitter Nathan Sidwell
Date July 22, 2014, 11:37 a.m.
Message ID <53CE4D06.40201@acm.org>
Download mbox | patch
Permalink /patch/372443/
State New
Headers show

Comments

Nathan Sidwell - July 22, 2014, 11:37 a.m.
In looking at David's gcov patch I noticed that other changes have introduced 
more global symbols into the user's namespace, without even using a gcov prefix. 
  That's bad.  This patch gets rid of one of them (set_gcov_list).

I'll apply shortly unless there are comments.

nathan
2014-07-22  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* gcov-tool.c (gcov_list): Declare here.
	(set_gcov_list): Remove.
	(gcov_output_files): Set gcov_list directly.

	libgcc/
	* libgcov-driver.c (set_gcov_list): Remove.
	(gcov_list): Make non-static in GCOV_TOOL.
	* libgcov.h (GCOV_TOOL_LINKAGE): Remove unused #define.

Patch

Index: gcc/gcov-tool.c
===================================================================
--- gcc/gcov-tool.c	(revision 212763)
+++ gcc/gcov-tool.c	(working copy)
@@ -38,12 +38,13 @@  see the files COPYING3 and COPYING.RUNTI
 #include <ftw.h>
 #include <getopt.h>
 
+extern struct gcov_info *gcov_list;
+
 extern int gcov_profile_merge (struct gcov_info*, struct gcov_info*, int, int);
 extern int gcov_profile_normalize (struct gcov_info*, gcov_type);
 extern int gcov_profile_scale (struct gcov_info*, float, int, int);
 extern struct gcov_info* gcov_read_profile_dir (const char*, int);
 extern void gcov_exit (void);
-extern void set_gcov_list (struct gcov_info *);
 extern void gcov_set_verbose (void);
 
 /* Set to verbose output mode.  */
@@ -109,7 +110,7 @@  gcov_output_files (const char *out, stru
   if (ret)
     fatal_error ("Cannot change directory to %s", out);
 
-  set_gcov_list (profile);
+  gcov_list = profile;
   gcov_exit ();
 
   ret = chdir (pwd);
Index: libgcc/libgcov-driver.c
===================================================================
--- libgcc/libgcov-driver.c	(revision 212763)
+++ libgcc/libgcov-driver.c	(working copy)
@@ -54,7 +54,6 @@  extern void gcov_exit (void) ATTRIBUTE_H
 extern void set_gcov_dump_complete (void) ATTRIBUTE_HIDDEN;
 extern void reset_gcov_dump_complete (void) ATTRIBUTE_HIDDEN;
 extern int get_gcov_dump_complete (void) ATTRIBUTE_HIDDEN;
-extern void set_gcov_list (struct gcov_info *) ATTRIBUTE_HIDDEN;
 
 struct gcov_fn_buffer
 {
@@ -71,14 +70,11 @@  struct gcov_summary_buffer
 };
 
 /* Chain of per-object gcov structures.  */
-static struct gcov_info *gcov_list;
-
-/* Set the head of gcov_list.  */
-void
-set_gcov_list (struct gcov_info *head)
-{
-  gcov_list = head;
-}
+#ifndef IN_GCOV_TOOL
+/* We need to expose this static variable when compiling for gcov-tool.  */
+static
+#endif
+struct gcov_info *gcov_list;
 
 /* Size of the longest file name. */
 /* We need to expose this static variable when compiling for gcov-tool.  */
Index: libgcc/libgcov.h
===================================================================
--- libgcc/libgcov.h	(revision 212763)
+++ libgcc/libgcov.h	(working copy)
@@ -111,12 +111,9 @@  typedef unsigned gcov_position_t;
 #define L_gcov_merge_ior 1
 #define L_gcov_merge_time_profile 1
 
-/* Make certian internal functions/variables in libgcov available for
-   gcov-tool access.  */
-#define GCOV_TOOL_LINKAGE 
-
 extern gcov_type gcov_read_counter_mem ();
 extern unsigned gcov_get_merge_weight ();
+extern struct gcov_info *gcov_list;
 
 #endif /* !IN_GCOV_TOOL */