Ignore:
Timestamp:
Jul 12, 2011, 12:11:21 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

qmake: os2/gnumake: Replace "\<char>" escaping in DEFINE variables with "'<char>'" quoting. This allows to work around the bug of existing GCC 4.x.x OS/2 builds (that can't handle escaping meta symbols with backslashes in response files) w/o altering each .pro file containing (widely used) "DEFINES += VAR=
\"STRING
\" statements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qmake/generators/os2/gnumake.cpp

    r882 r884  
    724724}
    725725
     726static QStringList fixDefines(const QStringList &vals)
     727{
     728    // Existing GCC 4.x.x builds for OS/2 can't handle escaping meta symbols
     729    // (e.g. quotes) with backslashes in response files (probably an OS/2-
     730    // specific bug). The fix this replacing all "\<char>" occurences with
     731    // "'<char>'"-like singlequoting which works.
     732    //
     733    // This backslash escaping is so frequently used in .pro files to pass
     734    // string defines to C/C++ (in the form of "DEFINES += VAR=\\\"STRING\\\")
     735    // that it makes sense to fix it here rather than introduce an OS/2-specific
     736    // alteration of the DEFINES statement in each .pro file.
     737
     738    QStringList result;
     739    foreach(const QString &val, vals) {
     740        result << QString(val).replace(QRegExp("\\\\(.)"), "'\\1'");
     741    }
     742    return result;
     743}
     744
    726745void GNUMakefileGenerator::createCompilerResponseFiles(QTextStream &t)
    727746{
     
    749768                    rt << varGlue("QMAKE_CXXFLAGS", QString::null, "\n", "\n");
    750769                } else if (!qstrcmp(vars[i], "DEFINES")) {
    751                     rt << varGlue("PRL_EXPORT_DEFINES", "-D", "\n-D", "\n")
    752                        << varGlue("DEFINES", "-D", "\n-D", "\n");
     770                    rt << valGlue(fixDefines(project->values("PRL_EXPORT_DEFINES")),
     771                                  "-D", "\n-D", "\n")
     772                       << valGlue(fixDefines(project->values("DEFINES")),
     773                                  "-D", "\n-D", "\n");
    753774                } else if (!qstrcmp(vars[i], "INCPATH")) {
    754775                    QString opt = var("QMAKE_CFLAGS_INCDIR");
Note: See TracChangeset for help on using the changeset viewer.