Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Silence all compiler warnings when build #17708

Open
sl1pkn07 opened this issue Feb 27, 2020 · 5 comments
Open

Silence all compiler warnings when build #17708

sl1pkn07 opened this issue Feb 27, 2020 · 5 comments

Comments

@sl1pkn07
Copy link
Contributor

sl1pkn07 commented Feb 27, 2020

Description

silence all warnings when build the project

References

when build the project, a tons of warnings like

tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./runtime/ffi_helper.h(41): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./runtime/ffi_helper.h(41): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./runtime/ffi_helper.h(57): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./runtime/ffi_helper.h(57): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./runtime/ffi_helper.h(77): warning: extra ";" ignored

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./runtime/ffi_helper.h(89): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./runtime/ffi_helper.h(89): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./runtime/ffi_helper.h(99): warning: extra ";" ignored

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./node/container.h(45): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./node/container.h(45): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./ir/expr.h(43): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./ir/expr.h(43): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./ir/expr.h(94): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./ir/expr.h(94): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./ir/expr.h(144): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./ir/expr.h(144): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./ir/expr.h(189): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/./ir/expr.h(189): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/runtime/container.h(176): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/runtime/container.h(176): warning: type qualifier on return type is meaningless

/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mxnet/runtime/container.h(276): warning: extra ";" ignored

(Done in #17718)

and others like

[ 64%] Building CUDA object CMakeFiles/mxnet_static.dir/src/common/utils.cu.o
/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/include/mshadow/./base.h(842): warning: integer conversion resulted in a change of sign

In file included from /tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/../profiler/storage_profiler.h:25,
                 from /tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/storage.cc:32:
In member function 'void mxnet::profiler::static_string<string_size>::set(const char*) [with long unsigned int string_size = 128]',
    inlined from 'mxnet::profiler::ProfileCounter::ProfileCounterStat::ProfileCounterStat(const char*, uint64_t)' at /tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/../profiler/./profiler.h:636:16,
    inlined from 'static std::unique_ptr<typename std::enable_if<std::is_base_of<mxnet::profiler::ProfileStat, StatType>::value, StatType>::type> mxnet::profiler::Profiler::CreateProfileStat(Args ...) [with StatType = mxnet::profiler::ProfileCounter::ProfileCounterStat; Args = {const char*, long unsigned int}]' at /tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/../profiler/./profiler.h:419:38,
    inlined from 'void mxnet::profiler::Profiler::AddNewProfileStat(SetExtraInfoFunction, Args ...) [with StatType = mxnet::profiler::ProfileCounter::ProfileCounterStat; SetExtraInfoFunction = mxnet::profiler::ProfileCounter::SendStat(uint64_t)::<lambda(mxnet::profiler::ProfileCounter::ProfileCounterStat*)>; Args = {const char*, long unsigned int}]' at /tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/../profiler/./profiler.h:320:33,
    inlined from 'void mxnet::profiler::ProfileCounter::SendStat(uint64_t)' at /tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/../profiler/./profiler.h:673:59:
/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/../profiler/./profiler.h:57:12: warning: 'char* strncpy(char*, const char*, size_t)' output may be truncated copying 127 bytes from a string of length 127 [-Wstringop-truncation]
     strncpy(&string_[0], s, string_size - 1);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In member function 'void mxnet::profiler::static_string<string_size>::set(const char*) [with long unsigned int string_size = 128]',
    inlined from 'mxnet::profiler::ProfileCounter::SendStat(uint64_t)::<lambda(mxnet::profiler::ProfileCounter::ProfileCounterStat*)>' at /tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/../profiler/./profiler.h:674:83,
    inlined from 'void mxnet::profiler::Profiler::AddNewProfileStat(SetExtraInfoFunction, Args ...) [with StatType = mxnet::profiler::ProfileCounter::ProfileCounterStat; SetExtraInfoFunction = mxnet::profiler::ProfileCounter::SendStat(uint64_t)::<lambda(mxnet::profiler::ProfileCounter::ProfileCounterStat*)>; Args = {const char*, long unsigned int}]' at /tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/../profiler/./profiler.h:321:30,
    inlined from 'void mxnet::profiler::ProfileCounter::SendStat(uint64_t)' at /tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/../profiler/./profiler.h:673:59:
/tmp/makepkg/sl1-mxnet-git/src/incubator-mxnet/src/storage/../profiler/./profiler.h:57:12: warning: 'char* strncpy(char*, const char*, size_t)' output may be truncated copying 127 bytes from a string of length 127 [-Wstringop-truncation]
     strncpy(&string_[0], s, string_size - 1);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

the full log:
full_log.txt

this is not considered a bug, because at the moment, the build process finished OK. but is good silence this warnings wich fill with spam the output

greetings

@leezu
Copy link
Contributor

leezu commented Feb 27, 2020

@hzfan could you fix the warnings in ffi that you introduced.

CI already tests with -WError to prevent introducing more problems, but that test needs to be changed to run with a newer compiler toolchain.

@hzfan hzfan mentioned this issue Feb 28, 2020
7 tasks
@hzfan
Copy link
Contributor

hzfan commented Feb 28, 2020

I created a pr #17718 to fix the warnings introduced by FFI.

Any ways to detect these warnings as errors? I tried to build with -DCMAKE_BUILD_TYPE=Debug, which I think implies -WError (not verified), but they remain warnings. I think it would be great to have such tools, which allow developers to check warnings before PR gets merged.

@leezu
Copy link
Contributor

leezu commented Feb 28, 2020

As of #17645, -DCMAKE_BUILD_TYPE="RelWithDebInfo" will run with -WError (and be tested on CI).
-DCMAKE_BUILD_TYPE="RelWithDebInfo" is thus similar to make DEV=1.

CI may have used an older compiler without the respective warnings for the pipeline running with -WError and thus passed. I'll look into that after #17645 is merged.

@sl1pkn07
Copy link
Contributor Author

sl1pkn07 commented Mar 1, 2020

build_log_20200301_10a12d59f6.txt

fixed ones, introduce others

greetings

@leezu
Copy link
Contributor

leezu commented Mar 3, 2020

See #17752 for fixing the CPU build.
There are still remaining warnings affecting the cuda build

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants