[llvm-commits] [llvm] r161205 - in /llvm/trunk: CMakeLists.txt docs/yaml2obj.rst include/llvm/Support/COFF.h test/Object/COFF/ test/Object/COFF/i386.yaml test/Object/COFF/x86-64.yaml test/Object/Inputs/trivial-object-test.coff-i386 test/Object/nm
Dmitri Gribenko
gribozavr at gmail.com
Thu Aug 2 17:40:58 PDT 2012
On Thu, Aug 2, 2012 at 12:16 PM, Michael J. Spencer
<bigcheesegs at gmail.com> wrote:
> + .Default(COFF::MT_Invalid);
> + if (Machine == COFF::MT_Invalid) {
> + YS.printError(Value, "Invalid value for Machine");
> + return false;
> + }
GCC gives a bunch of warnings:
/home/grib/clang-clean/llvm/utils/yaml2obj/yaml2obj.cpp: In member
function ‘bool COFFParser::parseHeader(llvm::yaml::Node*)’:
/home/grib/clang-clean/llvm/utils/yaml2obj/yaml2obj.cpp:199:34:
warning: comparison is always false due to limited range of data type
[-Wtype-limits]
/home/grib/clang-clean/llvm/utils/yaml2obj/yaml2obj.cpp: In member
function ‘bool COFFParser::parseSections(llvm::yaml::Node*)’:
/home/grib/clang-clean/llvm/utils/yaml2obj/yaml2obj.cpp:485:43:
warning: comparison is always false due to limited range of data type
[-Wtype-limits]
/home/grib/clang-clean/llvm/utils/yaml2obj/yaml2obj.cpp: In member
function ‘bool COFFParser::parseSymbols(llvm::yaml::Node*)’:
/home/grib/clang-clean/llvm/utils/yaml2obj/yaml2obj.cpp:644:48:
warning: comparison is always false due to limited range of data type
[-Wtype-limits]
/home/grib/clang-clean/llvm/utils/yaml2obj/yaml2obj.cpp: In member
function ‘bool COFFParser::parseHeader(llvm::yaml::Node*)’:
/home/grib/clang-clean/llvm/utils/yaml2obj/yaml2obj.cpp:204:35:
warning: ‘Machine’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
Seems like you are storing -1 (MT_Invalid) to an uint16_t as
StringSwitch default, -1 gets converted to 0xffff. Then 0xffff is
compared to -1 (MT_Invalid), and the comparison can never succeed.
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the llvm-commits
mailing list