Skip to content

Solaris: Fix shadowed declaration warning

Craig Scott requested to merge craig.scott/cmake:solaris_warning_single into master

"single" is a type declared in /usr/include/floatingpoint.h on Solaris, so the local variable of the same name in cmParseArgumentsCommand.cxx was triggering a compiler warning about the local variable shadowing the type:

/export/home/XXXXXX/Projects/cmake/Source/cmParseArgumentsCommand.cxx: In member function 'virtual bool cmParseArgumentsCommand::InitialPass(const std::vector<std::basic_string<char> >&, cmExecutionStatus&)':
/export/home/XXXXXX/Projects/cmake/Source/cmParseArgumentsCommand.cxx:74:14: warning: declaration of 'single' shadows a global declaration [-Wshadow]
   single_map single;
              ^
In file included from /opt/csw/lib/gcc/sparc-sun-solaris2.10/4.9.2/include-fixed/math.h:333:0,
                 from /opt/csw/include/c++/4.9.2/cmath:44,
                 from /opt/csw/include/c++/4.9.2/random:38,
                 from /opt/csw/include/c++/4.9.2/bits/stl_algo.h:66,
                 from /opt/csw/include/c++/4.9.2/algorithm:62,
                 from /export/home/XXXXXX/Projects/cmake/Source/cmAlgorithms.h:9,
                 from /export/home/XXXXXX/Projects/cmake/Source/cmParseArgumentsCommand.cxx:10:
/usr/include/floatingpoint.h:68:15: note: shadowed declaration is here
 typedef float single;
               ^

Merge request reports