Ticket #3463 (closed defect: fixed)
[patch] cleanup -Wbad-function-cast warnings
Reported by: | and | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 4.8.15 |
Component: | mc-core | Version: | master |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Branch state: | merged | Votes for changeset: |
Description
fix -Wbad-function-cast warnings and add to mc cflags
file.c: In function 'do_compute_dir_size':
file.c:584:23: error: cast from function call of type 'int' to non-matching type 'enum <anonymous>' [-Wbad-function-cast]
file.c: In function 'real_query_recursive':
file.c:717:13: error: cast from function call of type 'int' to non-matching type 'enum <anonymous>' [-Wbad-function-cast]
Signed-off-by: Andreas Mohr <and@…>
Attachments
Change History
comment:2 Changed 10 years ago by andrew_b
- Status changed from new to closed
- Resolution set to fixed
- Branch state changed from no branch to merged
- Milestone changed from Future Releases to 4.8.15
Thanks!
Applied as [d2713adbc6d9b1c1b9c5ed96cabb345a777ed423].
comment:4 Changed 9 years ago by mooffie
Hi, folks!
I have a question:
Can anybody here demonstrate the usefulness of this warning? Is there any existing shady, or inelegant, code in MC that this warning helped to get rid of?
In a discussion on some mailing list (resulting from my having to work around this warning while rebasing mc2) I tried to figure out the rationale behind this warning:
http://thread.gmane.org/gmane.comp.lang.lua.general/122134/focus=122160
but, as you can read there, couldn't quite manage it. But then again I'm not a C ninja. Could anybody please elucidate me? Specifically, what's the points in a warning that signals (EnumType) some_function_returning_int() but allows (EnumType) some_int ?
comment:5 follow-up: ↓ 6 Changed 8 years ago by and
Hi mooffie
because of bad_FUNCTION_cast it is for function return casting checks only and will not apply to
value conversions.
try
off_t a = (off_t)(lua_tonumber(L, -1));
to get rid of warning and might loosing information. :)
comment:6 in reply to: ↑ 5 Changed 8 years ago by mooffie
Replying to and:
Hi mooffie
because of bad_FUNCTION_cast it is for function return casting checks only and will not apply to
value conversions.
Alas, this isn't an answer to any question that I asked. I didn't ask *what* the warning does. I asked *why* use it. What is its *usefulness*, especially in MC's codebase. *How* could it make MC's code better. Could you please explain?
Note that I'm not against using this warning. I can't be against something whose usefulness I don't understand.