Hi Nick,
On Fri, Feb 16 2018, Nick Clifton wrote:
> Hi David,
>
> Attached is a revised version of the patch which I hope addresses all
> of your (very helpful) comments on the v3 patch.
>
> OK to apply once the sources are back on stage 1 ?
>
> Cheers
> Nick
>
> gcc/ChangeLog
> 2018-02-09 Nick Clifton <[email protected]>
>
> PR 84195
> * tree.c (escaped_string): New class. Converts an unescaped
> string into its escaped equivalent.
> (warn_deprecated_use): Use the new class to convert the
> deprecation message, if present.
> (test_escaped_strings): New self test.
> (test_c_tests): Add test_escaped_strings.
> * doc/extend.texi (deprecated): Add a note that the
> deprecation message is affected by the -fmessage-length
> option, and that control characters will be escaped.
> (#pragma GCC error): Document this pragma.
> (#pragma GCC warning): Likewise.
> * doc/invoke.texi (-fmessage-length): Document this option's
> effect on the #warning and #error preprocessor directives and
> the deprecated attribute.
>
I'm getting a bootstrap failure:
/home/mjambor/gcc/trunk/src/gcc/tree.c:12457:20: error: cast from type ‘const
char*’ to type ‘char*’ casts away qualifiers [-Werror=cast-qual]
m_str = (char *) unescaped;
that I believe is caused by this patch, because the warning complains
about the newly added code:
> --- gcc/tree.c (revision 257653)
> +++ gcc/tree.c (working copy)
> @@ -12416,11 +12416,101 @@
>
...
>
> +/* PR 84195: Replace control characters in "unescaped" with their
> + escaped equivalents. Allow newlines if -fmessage-length has
> + been set to a non-zero value. This is done here, rather than
> + where the attribute is recorded as the message length can
> + change between these two locations. */
> +
> +void
> +escaped_string::escape (const char * unescaped)
> +{
> + char *escaped;
> + size_t i, new_i, len;
> +
> + if (m_owned)
> + free (m_str);
> +
> + m_str = (char *) unescaped;
specifically about the line above, and the complaint seems quite valid.
Sorry for bad news,
Martin