On Fri, 2023-11-24 19:20:00 +0000, Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote: > >How-To-Repeat: > $ cat ind.c > extern int foo(int n) > { > int i; > int s; > > if (n > 1) > { for (i=0,s=0;i<n;i++,s+=i) ; > if (s > 100) s = 100; > } > else > { s = 0; > } > return(s); > } > $ cc -c -o ind.o ind.c -Wmisleading-indentation > ind.c: In function 'foo': > ind.c:7:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation] > { for (i=0,s=0;i<n;i++,s+=i) ; > ^~~ > ind.c:8:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for' > if (s > 100) s = 100; > ^~ > $ As I happen to have recent GCC versions around: jbglaw@lili:/var/cache/laminar/x$ ./bin/gcc --version gcc (basepoints/gcc-14-5622-g4d7647edfd7, built at 1700496389) 14.0.0 20231120 (experimental) Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. jbglaw@lili:/var/cache/laminar/x$ ./bin/gcc -c -o /tmp/ind.o ind.c -Wmisleading-indentation ind.c: In function ‘foo’: ind.c:7:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 7 | { for (i=0,s=0;i<n;i++,s+=i) ; | ^~~ ind.c:8:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 8 | if (s > 100) s = 100; | ^~ So it's the same message generated by up-to-date GCC versions. (Though the source is really bad to read...) MfG, JBG
Attachment:
signature.asc
Description: PGP signature