Skip to content
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

compiling error with gcc 6.3.1 on fedora #17

Closed
liwei opened this issue May 25, 2017 · 2 comments
Closed

compiling error with gcc 6.3.1 on fedora #17

liwei opened this issue May 25, 2017 · 2 comments

Comments

@liwei
Copy link
Contributor

liwei commented May 25, 2017

# cd f-stack/lib
# make
cc -c -O2 -fno-strict-aliasing -frename-registers -pipe -Wno-maybe-uninitialized   -std=c99  -Wall -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-inline -Wcast-qual -Wno-pointer-sign -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unused-but-set-variable -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000  -DFSTACK  -fstack-protector -D__FreeBSD__ -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-builtin -I/home/liwei/src/f-stack/lib/include -undef -imacros filtered_predefined_macros.h -nostdinc  -I. -I/home/liwei/src/f-stack/lib/../freebsd -I./machine_include -I./opt -Werror -Wno-unused-variable  /home/liwei/src/f-stack/lib/../freebsd/netinet/cc/cc_cubic.c
/home/liwei/src/f-stack/lib/../freebsd/netinet/cc/cc_cubic.c: In function ‘cubic_cong_signal’:
/home/liwei/src/f-stack/lib/../freebsd/netinet/cc/cc_cubic.c:264:3: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
   if (CCV(ccv, t_rxtshift) >= 2)
   ^~
/home/liwei/src/f-stack/lib/../freebsd/netinet/cc/cc_cubic.c:266:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
    cubic_data->t_last_cong = ticks;
    ^~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:382: recipe for target 'cc_cubic.o' failed
make: *** [cc_cubic.o] Error 1

It seems newer version gcc added [-Werror=misleading-indentation] error checking,
I can fix this with following patch:

diff --git a/freebsd/netinet/cc/cc_cubic.c b/freebsd/netinet/cc/cc_cubic.c
index a447345..89e35f8 100644
--- a/freebsd/netinet/cc/cc_cubic.c
+++ b/freebsd/netinet/cc/cc_cubic.c
@@ -261,9 +261,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
                 * chance the first one is a false alarm and may not indicate
                 * congestion.
                 */
-               if (CCV(ccv, t_rxtshift) >= 2)
+               if (CCV(ccv, t_rxtshift) >= 2) {
                        cubic_data->num_cong_events++;
                        cubic_data->t_last_cong = ticks;
+               }
                break;
        }
 }
@whl739
Copy link
Member

whl739 commented May 25, 2017

This code is from FreeBSD Release 11.0, i think it's a typo, because in the latest version of FreeBSD, they are wrapped by "{}" , see https://github.com/freebsd/freebsd/blob/master/sys/netinet/cc/cc_cubic.c#L270.
You can just submit this patch with a pull request . Thank you.

@liwei
Copy link
Contributor Author

liwei commented May 25, 2017

PR sent, please consider to merge, thanks.
#18

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

No branches or pull requests

2 participants