Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-17235

unused-variable and uninitialized parameter with gcc5.0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.6.7
    • Fix Version/s: None
    • Component/s: Build
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Build mongoDB 2.6.7 with gcc 5.0.0

      Builded by

      scons all \
      --use-system-all \
      --usev8 \
      --nostrip \
      --ssl \
      --disable-warnings-as-errors

      Show
      Build mongoDB 2.6.7 with gcc 5.0.0 Builded by scons all \ --use-system-all \ --usev8 \ --nostrip \ --ssl \ --disable-warnings-as-errors

      Description

      mongoDB 2.6.7 fails to build with gcc 5.0 .

      There is problem with this:
      -------------------------------------------------------------------
      src/mongo/base/global_initializer.cpp:32:18: error: 'mongo::

      {anonymous}

      ::_theGlobalInitializer' defined but not used [-Werror=unused-variable]
      Initializer* _theGlobalInitializer = &getGlobalInitializer();
      ^
      -------------------------------------------------------------------
      and also

      -------------------------------------------------------------------
      src/mongo/db/commands/index_filter_commands.cpp: In member function 'virtual mongo::Status mongo::ClearFilters::runIndexFilterCommand(const string&, mongo::BSONObj&, mongo::BSONObjBuilder*)':
      src/mongo/db/commands/index_filter_commands.cpp:236:58: error: 'querySettings' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      return clear(querySettings, planCache, ns, cmdObj);
      ^
      src/mongo/db/commands/index_filter_commands.cpp:236:58: error: 'planCache' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      src/mongo/db/commands/index_filter_commands.cpp: In member function 'virtual mongo::Status mongo::SetFilter::runIndexFilterCommand(const string&, mongo::BSONObj&, mongo::BSONObjBuilder*)':
      src/mongo/db/commands/index_filter_commands.cpp:320:56: error: 'querySettings' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      return set(querySettings, planCache, ns, cmdObj);
      ^
      src/mongo/db/commands/index_filter_commands.cpp:320:56: error: 'planCache' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      src/mongo/db/commands/index_filter_commands.cpp: In member function 'virtual mongo::Status mongo::ListFilters::runIndexFilterCommand(const string&, mongo::BSONObj&, mongo::BSONObjBuilder*)':
      src/mongo/db/commands/index_filter_commands.cpp:179:40: error: 'querySettings' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      return list(*querySettings, bob);
      ^

      -------------------------------------------------------------------
      also with --disable-warnings-as-errors :

      -------------------------------------------------------------------
      src/mongo/db/commands/plan_cache_commands.cpp: In member function 'virtual mongo::Status mongo::PlanCacheListQueryShapes::runPlanCacheCommand(const string&, mongo::BSONObj&, mongo::BSONObjBuilder*)':
      src/mongo/db/commands/plan_cache_commands.cpp:223:36: warning: 'planCache' may be used uninitialized in this function [-Wmaybe-uninitialized]
      return list(*planCache, bob);
      ^
      src/mongo/db/commands/plan_cache_commands.cpp: In member function 'virtual mongo::Status mongo::PlanCacheClear::runPlanCacheCommand(const string&, mongo::BSONObj&, mongo::BSONObjBuilder*)':
      src/mongo/db/commands/plan_cache_commands.cpp:267:43: warning: 'planCache' may be used uninitialized in this function [-Wmaybe-uninitialized]
      return clear(planCache, ns, cmdObj);
      ^

      src/mongo/db/commands/plan_cache_commands.cpp:338:48: warning: 'planCache' may be used uninitialized in this function [-Wmaybe-uninitialized]
      return list(*planCache, ns, cmdObj, bob);
      ^
      -------------------------------------------------------------------

      I suggest this could be fixed by adding -Wno-unused-variable and -Wno-maybe-uninitialized into SConstruct.
      (same as -Wno-unused-function,...)

      I don't tried it, but guess this affects all mongoDB versions...

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: