Introduce gcov.h header file (PR gcov-profile/80435).

2017-04-19  Martin Liska  <mliska@suse.cz>

	PR gcov-profile/80435
	* Makefile.in: Install gcov.h.
	* gcov.h: New file.
	* libgcov.h: Use the header and make __gcov_flush publicly
	visible.

From-SVN: r246990
This commit is contained in:
Martin Liska 2017-04-19 10:08:44 +02:00 committed by Martin Liska
parent a16c8d8b61
commit 46928a8fda
4 changed files with 60 additions and 10 deletions

View File

@ -1,3 +1,11 @@
2017-04-19 Martin Liska <mliska@suse.cz>
PR gcov-profile/80435
* Makefile.in: Install gcov.h.
* gcov.h: New file.
* libgcov.h: Use the header and make __gcov_flush publicly
visible.
2017-04-18 Martin Liska <mliska@suse.cz>
PR gcov-profile/78783

View File

@ -907,14 +907,14 @@ libgcov-driver-objects = $(patsubst %,%$(objext),$(LIBGCOV_DRIVER))
libgcov-objects = $(libgcov-merge-objects) $(libgcov-profiler-objects) \
$(libgcov-interface-objects) $(libgcov-driver-objects)
$(libgcov-merge-objects): %$(objext): $(srcdir)/libgcov-merge.c $(srcdir)/libgcov.h
$(libgcov-merge-objects): %$(objext): $(srcdir)/libgcov-merge.c $(srcdir)/gcov.h $(srcdir)/libgcov.h
$(gcc_compile) -DL$* -c $(srcdir)/libgcov-merge.c
$(libgcov-profiler-objects): %$(objext): $(srcdir)/libgcov-profiler.c $(srcdir)/libgcov.h
$(libgcov-profiler-objects): %$(objext): $(srcdir)/libgcov-profiler.c $(srcdir)/gcov.h $(srcdir)/libgcov.h
$(gcc_compile) -DL$* -c $(srcdir)/libgcov-profiler.c
$(libgcov-interface-objects): %$(objext): $(srcdir)/libgcov-interface.c $(srcdir)/libgcov.h
$(libgcov-interface-objects): %$(objext): $(srcdir)/libgcov-interface.c $(srcdir)/gcov.h $(srcdir)/libgcov.h
$(gcc_compile) -DL$* -c $(srcdir)/libgcov-interface.c
$(libgcov-driver-objects): %$(objext): $(srcdir)/libgcov-driver.c \
$(srcdir)/libgcov-driver-system.c $(srcdir)/libgcov.h
$(srcdir)/libgcov-driver-system.c $(srcdir)/gcov.h $(srcdir)/libgcov.h
$(gcc_compile) -DL$* -c $(srcdir)/libgcov-driver.c
@ -1114,6 +1114,10 @@ install-unwind_h:
all: install-unwind_h-forbuild
install-gcov_h:
$(mkinstalldirs) $(DESTDIR)$(libsubdir)/include
$(INSTALL_DATA) $(srcdir)/gcov.h $(DESTDIR)$(libsubdir)/include
# Documentation targets (empty).
.PHONY: info html dvi pdf install-info install-html install-pdf
@ -1171,13 +1175,14 @@ install-leaf: $(install-shared) $(install-libunwind)
esac; \
done
install: install-leaf install-unwind_h
install: install-leaf install-unwind_h install-gcov_h
@: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
install-strip: install
.PHONY: install install-shared install-libunwind install-strip
.PHONY: install-unwind_h install-unwind_h-forbuild
.PHONY: install-gcov_h
# Don't export variables to the environment, in order to not confuse
# configure.

41
libgcc/gcov.h Normal file
View File

@ -0,0 +1,41 @@
/* GCOV interface routines.
Copyright (C) 2017 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_GCOV_H
#define GCC_GCOV_H
/* Set all counters to zero. */
extern void __gcov_reset (void);
/* Write profile information to a file. */
extern void __gcov_dump (void);
/* Write profile information to a file and reset counters to zero.
The function does operations under a mutex. */
extern void __gcov_flush (void);
#endif /* GCC_GCOV_H */

View File

@ -42,6 +42,7 @@
#include "coretypes.h"
#include "tm.h"
#include "libgcc_tm.h"
#include "gcov.h"
#if __CHAR_BIT__ == 8
typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI)));
@ -237,16 +238,11 @@ extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN;
/* GCOV exit function registered via a static destructor. */
extern void __gcov_exit (void) ATTRIBUTE_HIDDEN;
/* Called before fork, to avoid double counting. */
extern void __gcov_flush (void) ATTRIBUTE_HIDDEN;
/* Function to reset all counters to 0. Both externally visible (and
overridable) and internal version. */
extern void __gcov_reset (void);
extern void __gcov_reset_int (void) ATTRIBUTE_HIDDEN;
/* User function to enable early write of profile information so far. */
extern void __gcov_dump (void);
extern void __gcov_dump_int (void) ATTRIBUTE_HIDDEN;
/* The merge function that just sums the counters. */