Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1013

Better error handling for unexpected data types in cpp.cxxFlags

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 1.7.0
    • 1.6.0
    • General
    • None
    • QtCreator 4.1, Mac OSX
    • 2c75537141283895da9b80e249b391bc38d63505

    Description

      I was pushing an array of strings onto an array, which worked in the previous versions of qbs but doesn't work in 1.6. I think I'm using 1.6 since I'm on QtCreator 4.1? I know this is wrong, but instead of qbs handling gracefully, and qbs fails to parse my app's qbs files with the following error:

      /Users/vpicaver/Qt/Qt Creator.app/Contents/Resources/qbs/share/qbs/modules/cpp/GenericGCC.qbs:218: error: Result of expression 'value[i].startsWith' [undefined] is not a function.
      

      I was using the following cxxFlags that caused the problem.

              
      cpp.cxxFlags: {
                  var flags = [
                              "-stdlib=libc++", //Needed for protoc
                              "-Werror", //Treat warnings as errors
                          ];
      
                  if(qbs.buildVariant == "debug") {
                      flags.push(["-fsanitize=address",
                                  "-fno-omit-frame-pointer"])
      
                      console.error("Flags:" + JSON.stringify(flags));
                  }
      
                  return flags;
              }
      

      GenericGCC.qbs assumes your passing string to it (so that startWidth() function is defined), but sometimes users aren't so smart... I think qbs should validate that all the inputs are the correct type and report to the user where their input's aren't.

      Attachments

        For Gerrit Dashboard: QBS-1013
        # Subject Branch Project Status CR V

        Activity

          People

            kandeler Christian Kandeler
            vpicaver Philip Schuchardt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes