https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79567

            Bug ID: 79567
           Summary: Compiler-warning "unknown escape sequence '\x'" about
                    genmatch-generated C-files on mingw-host
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: meisenmann....@fh-salzburg.ac.at
  Target Milestone: ---
              Host: mingw32
            Target: i386-elf

Hi!

The compilation of genmatch-genererated C-files will show a compiler-warning
like unknown escape sequence '\x', if this tool was build (runs on) an
mingw/windows-based host.
For example, if I build a mingw-hosted GCC cross-compiler.

At least, the genmatch-tool is not fully aware of the windows-path syntax
(back-slash as separator) on extracting the file-name from a full path;
resulting in format-strings, containing a back-slashes (from __FILE__-macro).

Similar to some other GCC source-files, considering the back-slash
(DIR_SEPARATOR_2) if applicable, I'm using following (simple) patch:

--- gcc-5.4.0/gcc/genmatch.c    Tue Jul 21 15:04:12 2015
+++ gcc-5.4.0/gcc/genmatch.c    (working copy)
@@ -141,6 +141,10 @@
     {
       /* When writing to a dumpfile only dump the filename.  */
       const char *file = strrchr (loc.file, DIR_SEPARATOR);
+#if defined(DIR_SEPARATOR_2) && (DIR_SEPARATOR_2 != DIR_SEPARATOR)
+      const char *pos2 = strrchr (loc.file, DIR_SEPARATOR_2);
+      if (!file || (pos2 > file)) file = pos2;
+#endif
       if (!file)
        file = loc.file;
       else

to inhibit this compiler-warnings on building our (mingw32-hosted)
cross-compiler.

Best regards from Salzburg,
Markus

Reply via email to