aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBen Elliston <bje@au.ibm.com>2005-03-04 04:43:03 +0000
committerBen Elliston <bje@gcc.gnu.org>2005-03-04 15:43:03 +1100
commitee4c708e37964f3d70176da58996305e90eded76 (patch)
tree0ae9adc5763c0f414c1e7844ef1f48831d53a205 /gcc
parentc7d1b4498649c78fd1b0746371dcd29e1645f7af (diff)
downloadgcc-ee4c708e37964f3d70176da58996305e90eded76.zip
gcc-ee4c708e37964f3d70176da58996305e90eded76.tar.gz
gcc-ee4c708e37964f3d70176da58996305e90eded76.tar.bz2
gcc.c (option_map): Add --coverage.
* gcc.c (option_map): Add --coverage. (LINK_COMMAND_SPEC): Pass -lgcov for `coverage'. (cc1_options): Pass -fprofile-arcs -ftest-coverage for `coverage'. * config/darwin.h: Pass -lgcov for `coverage'. * doc/invoke.texi (Debugging Options): Document --coverage. From-SVN: r95878
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/darwin.h2
-rw-r--r--gcc/doc/invoke.texi9
-rw-r--r--gcc/gcc.c6
4 files changed, 22 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4faebd4..ce68c0e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2005-03-04 Ben Elliston <bje@au.ibm.com>
+
+ * gcc.c (option_map): Add --coverage.
+ (LINK_COMMAND_SPEC): Pass -lgcov for `coverage'.
+ (cc1_options): Pass -fprofile-arcs -ftest-coverage for `coverage'.
+ * config/darwin.h: Pass -lgcov for `coverage'.
+ * doc/invoke.texi (Debugging Options): Document --coverage.
+
2005-03-04 Kazu Hirata <kazu@cs.umass.edu>
* gcse.c (bypass_block): Use find_edge wherever possible.
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 027aa68..937b497 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -226,7 +226,7 @@ extern const char *darwin_fix_and_continue_switch;
%{!Zdynamiclib:%{A} %{e*} %{m} %{N} %{n} %{r} %{u*} %{x} %{z}} \
%{@:-o %f%u.out}%{!@:%{o*}%{!o:-o a.out}} \
%{!Zdynamiclib:%{!A:%{!nostdlib:%{!nostartfiles:%S}}}} \
- %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate:-lgcov} \
+ %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate|coverage:-lgcov} \
%{!nostdlib:%{!nodefaultlibs:%G %L}} \
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}}"
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 891b384..6dcff82 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -3345,6 +3345,15 @@ the basename of the source file. In both cases any suffix is removed
(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
+@cindex @command{gcov}
+@item --coverage
+@opindex coverage
+
+This option is used to compile and link code instrumented for coverage
+analysis. The option is a synonym for @option{-fprofile-arcs}
+@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
+linking). See the documentation for those options for more details.
+
@itemize
@item
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 1a9cc50..eda3fa4 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -700,7 +700,7 @@ proper position among the other output files. */
%(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
%{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib)\
- %{fprofile-arcs|fprofile-generate:-lgcov}\
+ %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
%{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
#endif
@@ -796,7 +796,8 @@ static const char *cc1_options =
%{--target-help:--target-help}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
%{fsyntax-only:-o %j} %{-param*}\
- %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}";
+ %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}\
+ %{coverage:-fprofile-arcs -ftest-coverage}";
static const char *asm_options =
"%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
@@ -1065,6 +1066,7 @@ static const struct option_map option_map[] =
{"--for-assembler", "-Wa", "a"},
{"--for-linker", "-Xlinker", "a"},
{"--force-link", "-u", "a"},
+ {"--coverage", "-coverage", 0},
{"--imacros", "-imacros", "a"},
{"--include", "-include", "a"},
{"--include-barrier", "-I-", 0},