Uploaded image for project: 'Open Development'
  1. Open Development
  2. OPEN-209

Viewer building: escape unintentional trigraph sequences

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Released
    • Component/s: None
    • Labels:
      None
    • Environment:
      -

      Description

      Some compilers, mostly GCC-derivatives, ignore and warn about trigraphs by default. However, not all compilers ignore these things, as they are a standard "Feature" of the language.

      The simple fix is to escape at least every other interrobang ("?") in a sequence. e.g. from "??!" to "?\?!"
      

      See http://stackoverflow.com/questions/1234582/purpose-of-trigraph-sequences-in-c for more info about the fun of trigraphs.

      The following regex can be used to grep for offending files:

      ".*\?\?[=/'()!<>-].*"
      e.g. grep '".*\?\?[=/'()!<>-].*"' file
      

      Currently the LL source only contains these in the lldiriterator_test.cpp test suite file, so there's no major issues at this point.

      EDIT: the above only found trigraphs embedded in strings. However, as Oz noted, trigraphs can cause issues in comments and anywhere else. See below for a better regex - the same as what Oz culled it down to.

      \?\?[=/'()!<>-]
      e.g. grep '\?\?[=/'()!<>-]' file
      

      More files are affected, and has been done in the linked branch.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            cron.stardust Cron Stardust
            Contributor:
            Cron Stardust
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: