Hi David, Hi Martin,
OK, take 3 of the patch is attached. In this version:

* The escaping is handled by a new class.
* Self-tests have been added (and they helped find a bug - yay!)
* The documentation has been extended to mention -fmessage-length's
effect on the #-directives, and to add documentation for #pragma
GCC error and #pragma GCC warning. (Which appeared to be missing).
I did try to add backslash characters to the regexp in the new testcase
but I just could not find a way to persuade dejagnu to accept them.
OK to apply ?
(Apologies for the poor C++ coding - it is not my strong point. I am
an assembler level programmer at heart).
Cheers
Nick
gcc/ChangeLog
2018-02-09 Nick Clifton <ni...@redhat.com>
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.
gcc/testsuite/ChangeLog
2018-02-07 Nick Clifton <ni...@redhat.com>
* gcc.c-torture/compile/pr84195.c: New test.