This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Add basic-block.h dependency to gcov-io.h
- From: "Mark G. Adams" <mark dot g dot adams at sympatico dot ca>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 16 Jun 2004 08:26:07 -0400
- Subject: [PATCH] Add basic-block.h dependency to gcov-io.h
gcov-io.h requires a definition of gcov_type to compile. Now there are
three different ways that gcov-io.h can be compiled based on #defines:
1) if IN_LIBGCOV is defined, then gcov_type is typedef'd with different
attributes based on LONG_LONG_TYPE_SIZE
2) otherwise, if IN_GCOV is defined, then gcov_type is typedef'd to
HOST_WIDEST_INT
3) otherwise, gcov_type isn't typedef'd but is still used in the header
For case 3, the typedef in basic-block.h (to HOST_WIDEST_INT) is
required to be present prior to including gcov-io.h; thus, this patch
modifies gcov-io.h to include basic-block.h if !IN_LIBGCOV and !IN_GCOV
An alternative would be to move the definition of gcov_type to a
separate header which then gets included by gcov-io.h and basic-block.h;
however, I was a bit antsy about moving definitions out of gcov-io.h
without a better understanding of the different contexts in which it is
compiled.
Bootstrapped and tested on i686-pc-linux-gnu.
Comments? Ok to apply?
//Mark
2004-06-16 Mark G. Adams <mark.g.adams@sympatico.ca>
* gcov-io.h: Include basic-block.h if !IN_LIBGCOV and !IN_GCOV
* Makefile.in: Fix gcov-io.h dependencies
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1298
diff -c -3 -p -r1.1298 Makefile.in
*** Makefile.in 14 Jun 2004 14:17:45 -0000 1.1298
--- Makefile.in 15 Jun 2004 18:44:49 -0000
*************** PARAMS_H = params.h params.def
*** 686,693 ****
TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h builtins.def \
input.h statistics.h
BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h varray.h $(PARTITION_H) \
! hard-reg-set.h cfghooks.h
! COVERAGE_H = coverage.h gcov-io.h gcov-iov.h
DEMANGLE_H = $(srcdir)/../include/demangle.h
RECOG_H = recog.h
ALIAS_H = alias.h
--- 686,694 ----
TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h builtins.def \
input.h statistics.h
BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h varray.h $(PARTITION_H) \
! hard-reg-set.h cfghooks.h input.h
! GCOV_IO_H = gcov-io.h gcov-iov.h $(BASIC_BLOCK_H)
! COVERAGE_H = coverage.h $(GCOV_IO_H)
DEMANGLE_H = $(srcdir)/../include/demangle.h
RECOG_H = recog.h
ALIAS_H = alias.h
*************** s-iov: gcov-iov$(build_exeext)
*** 2671,2678 ****
$(SHELL) $(srcdir)/../move-if-change tmp-gcov-iov.h gcov-iov.h
$(STAMP) s-iov
! gcov.o: gcov.c gcov-io.h gcov-io.c gcov-iov.h intl.h $(SYSTEM_H) coretypes.h $(TM_H) $(CONFIG_H)
! gcov-dump.o: gcov-dump.c gcov-io.h gcov-io.c gcov-iov.h $(SYSTEM_H) coretypes.h $(TM_H) $(CONFIG_H)
# Only one of 'gcov' or 'gcov.exe' is actually built, depending
# upon whether $(exeext) is empty or not.
--- 2672,2679 ----
$(SHELL) $(srcdir)/../move-if-change tmp-gcov-iov.h gcov-iov.h
$(STAMP) s-iov
! gcov.o: gcov.c $(GCOV_IO_H) gcov-io.c intl.h $(SYSTEM_H) coretypes.h $(TM_H) $(CONFIG_H)
! gcov-dump.o: gcov-dump.c $(GCOV_IO_H) gcov-io.c $(SYSTEM_H) coretypes.h $(TM_H) $(CONFIG_H)
# Only one of 'gcov' or 'gcov.exe' is actually built, depending
# upon whether $(exeext) is empty or not.
Index: gcov-io.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcov-io.h,v
retrieving revision 1.50
diff -c -3 -p -r1.50 gcov-io.h
*** gcov-io.h 25 Apr 2004 16:38:07 -0000 1.50
--- gcov-io.h 15 Jun 2004 18:44:49 -0000
*************** typedef signed gcov_type __attribute__ (
*** 207,213 ****
typedef unsigned gcov_unsigned_t;
typedef unsigned gcov_position_t;
! /* gcov_type is typedef'd elsewhere for the compiler */
#if IN_GCOV
#define GCOV_LINKAGE static
typedef HOST_WIDEST_INT gcov_type;
--- 207,213 ----
typedef unsigned gcov_unsigned_t;
typedef unsigned gcov_position_t;
!
#if IN_GCOV
#define GCOV_LINKAGE static
typedef HOST_WIDEST_INT gcov_type;
*************** typedef HOST_WIDEST_INT gcov_type;
*** 215,220 ****
--- 215,221 ----
#include <sys/types.h>
#endif
#else /*!IN_GCOV */
+ #include "basic-block.h" /* for gcov_type */
#if LONG_LONG_TYPE_SIZE > 32
#define GCOV_TYPE_NODE intDI_type_node
#else