-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[style] Clean up warnings in code compilation #2383
Conversation
cicheck |
5 similar comments
cicheck |
cicheck |
cicheck |
cicheck |
cicheck |
69b3273
to
8faca0e
Compare
Maybe you can use |
@ilixiaocui Sorry, could you please tell me how to merge these commits into one? I tried using |
|
8faca0e
to
9947434
Compare
I tried it and the commits made by others between my commits are also in the changed files. Is that correct? |
Then you need to use Now, you can excute |
9947434
to
bfab210
Compare
It works. Thanks! |
Hi, @MizukiCry, Thanks for you contribution. Fixing compile warnings is troublesome things. You'd better divided into multiple modules and slowly repaired. One fix pull request per module is fine, otherwise I'm afraid you'll have a good battle with our CI. |
Thanks for your advice! I'll try that in future coding. |
cicheck |
@ilixiaocui Please help review this PR:). |
@ilixiaocui take it |
Hey, @MizukiCry ! Maybe it's a good way to divide the PR by the binary target? so that you can check whether the binary under chunkserver folder produces warnings by e.g. # curvebs
bazel query '//src/...'
# curvefs
bazel query '//curvefs/src/...' |
Thank you for your contribution!
|
Thanks, I got it! I'll try that next. |
I'm sorry that I just randomly correct some warnings. If it's necessary, I can retry cleaning warnings by modules. |
Have you tried using Clang? the simplest way is |
I'm currently using docker for development, when I use clang I'll get some compile errors that seem caused by the environment, and I have no idea deal with it. So I only tried to compile directly. |
What are the main mistakes? You can post it. |
I created a new container and compile it with clang, then got:
|
It seems this problem is related to clang-3.8 I have tried clang-11 in development docker, it works, you can install clang-11 and retry. apt install clang-11
CC=clang-11 CXX=clang++-11 bazel build //... and, @Cyber-SiKu will update the default clang from 3.8 to 11 in soon |
OK, I tried it and it compiled successfully, but there comes many new warnings. If we have to fix them too, I think it's better to create another PR. |
I think so, it's better to fix it in another PR, I will look through this PR ASAP. |
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't format unrelated code in future PR as it will add additional burden to code review.
src/snapshotcloneserver/common/snapshotclone_meta_store_etcd.cpp
Outdated
Show resolved
Hide resolved
Sorry for troubling you. I didn't notice that when I format the whole file. I'll avoid that next time. |
f2ff073
to
d2f5e7f
Compare
cicheck |
d2f5e7f
to
a7925e2
Compare
cicheck |
a7925e2
to
906d79b
Compare
cicheck |
src/snapshotcloneserver/common/snapshotclone_meta_store_etcd.cpp
Outdated
Show resolved
Hide resolved
906d79b
to
4459438
Compare
cicheck |
Signed-off-by: MizukiCry <[email protected]>
4459438
to
c0b3d97
Compare
cicheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -88,7 +88,7 @@ std::string DiskCacheBase::GetCacheIoFullDir() { | |||
int DiskCacheBase::CreateDir(const std::string dir) { | |||
size_t p = dir.find_last_of('/'); | |||
std::string dirPath = dir; | |||
if (p != -1) { | |||
if (p != -1ULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (p != -1ULL) { | |
if (p != std::string::npos) { |
You can fix this in the next PR if you want.
And we should finish this PR quickly, otherwise, when someone else merges PRs, they may introduce new warnings. 💢
@ilixiaocui This PR is finished. Please help review it:) |
LGTM! |
What problem does this PR solve?
Fix some warnings in code compilation.
This PR is a subtask of #1264. Due to the number of warnings, this task will be divided into several PRs.
OS:
Debian GNU/Linux 9 (stretch) x86_64
GCC:
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
Fixed modules:
//curvefs/...
//test/...
//src/...
//proto/...
//nebd/...
//include/...
//tools/...
Fixed warnings:
[-Wunused-parameter]
[-Wsign-compare]
[-Wnarrowing]
[-Wreorder]
[-Wunused-variable]
[-Wvla]
[-Wmissing-field-initializers]
[-Wwrite-strings]
[-Wunused-but-set-variable]
[-Wdeprecated-declarations]
[-Wformat=]
[-Wmaybe-uninitialized]
Build result (Ignored submodule and external warnings):
Issue Number: #1264
Problem Summary:
What is changed and how it works?
What's Changed: Relevant codes that cause warnings.
How it Works: By correcting corresponding codes.
Side effects(Breaking backward compatibility? Performance regression?): This may cause unknown bugs.
Check List