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

Fixing -Wmisleading-indentation #31

Closed
uyjulian opened this issue Jan 7, 2017 · 5 comments
Closed

Fixing -Wmisleading-indentation #31

uyjulian opened this issue Jan 7, 2017 · 5 comments

Comments

@uyjulian
Copy link
Member

uyjulian commented Jan 7, 2017

src/stdtrf.c:155:1: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
 if( t < 0 )
 ^~
src/stdtrf.c:158:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
  p = 0.5 + 0.5 * p;
  ^

(from GCC 6.2.0)
Clang-format could be a solution to this warning...
Any other suggestions? If not, I'll create a PR later.

@sp193
Copy link
Member

sp193 commented Jan 8, 2017

Why not just fix it, if it is only one line? The thing about clang-format is that it also changes the structure of a lot of files. And of everything, I just can't accept the fact that spaces are used instead of tabs - it's grounds for messy files, IMO. For example, the number of times to press the TAB key equals to the level of identation, but that is not the same as using spaces; you may have to press the space key 8 times, just for one level. But you can accidentally miss one or two spaces, and it could still look correct (but is misaligned).

Unless, you can change those settings to fit the current coding standard that is roughly used by the existing developers? I don't use OSX, so I don't know about this clang-format tool.

The other way, is that someone else agrees that it's okay - then it probably is...
(otherwise, I wouldn't want to change the coding standard, which has been around for years).

@uyjulian
Copy link
Member Author

uyjulian commented Jan 8, 2017

There isn't really any coding standard... currently.

I can change the UseTab setting in .clang-format to ForIndentation, so that tabs will be used for indentation.

You can learn more about clang-format at http://clang.llvm.org/docs/ClangFormat.html

@sp193
Copy link
Member

sp193 commented Jan 8, 2017

If you could, that would be great.

@uyjulian
Copy link
Member Author

Fixed by 0cce798 and cf941c4

@AKuHAK
Copy link
Contributor

AKuHAK commented Jan 18, 2019

Exactly this file I left not changed cause I was not completely sure if it is indentation or real error (missing brackets)

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

3 participants