diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4faebd4e6d11..ce68c0e6c616 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-03-04 Ben Elliston + + * 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 * gcse.c (bypass_block): Use find_edge wherever possible. diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 027aa6839a36..937b4977fcdb 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 891b38445f75..6dcff820158e 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 1a9cc5005d6f..eda3fa49f530 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},