This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Make dg-extract-results.sh explicitly treat .{sum,log} files as text
- From: Pedro Alves <palves at redhat dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 16 Dec 2014 09:36:33 +0000
- Subject: Re: [PATCH] Make dg-extract-results.sh explicitly treat .{sum,log} files as text
- Authentication-results: sourceware.org; auth=none
- References: <1418683023-26087-1-git-send-email-sergiodj at redhat dot com> <20141215224608 dot GX1667 at tucnak dot redhat dot com> <87lhm85xhy dot fsf at redhat dot com>
On 12/15/2014 11:00 PM, Sergio Durigan Junior wrote:
> +# Check if grep supports the '--text' option.
> +
> +GREP_TEXT_OPT="--text"
> +if grep --text 2>&1 | grep "unrecognized option" > /dev/null 2>&1 ; then
> + GREP_TEXT_OPT=""
> +fi
> +
That assumes all greps output "unrecognized option" on
unrecognized options. I don't think that can be counted on being
portable? ISTM reversing the logic of the test would be better.
IOW, test that --text actually works. Something like this perhaps:
# If grep supports the '--text' option, use it.
GREP_TEXT_OPT=""
if echo foo | grep --text foo > /dev/null 2>&1 ; then
GREP_TEXT_OPT="--text"
fi
Thanks,
Pedro Alves