OSDN Git Service

* gcc.c (option_map): Add --coverage.
authorbje <bje@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 4 Mar 2005 04:43:03 +0000 (04:43 +0000)
committerbje <bje@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 4 Mar 2005 04:43:03 +0000 (04:43 +0000)
(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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95878 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/darwin.h
gcc/doc/invoke.texi
gcc/gcc.c

index 4faebd4..ce68c0e 100644 (file)
@@ -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.
index 027aa68..937b497 100644 (file)
@@ -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*} }}}}}}}}"
 
index 891b384..6dcff82 100644 (file)
@@ -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
index 1a9cc50..eda3fa4 100644 (file)
--- 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},