some warning isn't gonna be fix like documentation-unknown-command,
reserved-id-macro, cast-qual, padded and others.
T8283
Details
- Reviewers
lauromoura felipealmeida - Maniphest Tasks
- T8283: clang warnings
compile with clang and -Weverything, fixing the warnings.
Diff Detail
- Repository
- rEFL core/efl
- Branch
- arcpatch-D10172
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 13819 Build 9601: arc lint + arc unit
@bu5hm4n A practical example is because of this https://godbolt.org/z/hGcc4m .
(on the left, there isn't a declaration, on the right, there is it).
C compiler only see names declared above from the current name, so, for example,
in eina_accessor.c, we have
Eina_Bool eina_accessor_init(void) { return eina_magic_string_set(EINA_MAGIC_ACCESSOR, EINA_MAGIC_ACCESSOR_STR); } Eina_Bool eina_accessor_shutdown(void) { return EINA_TRUE; }
so, inside eina_accessor_init, it could be possible to do things like
(highly dependable of c and std version)
Eina_Bool eina_accessor_init(void) { eina_accessor_shutdown(1,2,3,4,5); return eina_magic_string_set(EINA_MAGIC_ACCESSOR, EINA_MAGIC_ACCESSOR_STR); }
But this is positional, with definition in the beginning of a file, it's possible not have the declaration,
for safety, it's good to have declarations.
Could you please post the compiler warnings? Because just casting a return value like the following will solve compiler warnings, but sadly may just solve those, but - worse - may not resolve any bugs, but even hide them in the future. Especially this strlen call doesn't seem right:
ret.len = (size_t)eina_stringshare_strlen(str);
And if I remember correctly the following will first use wathever type itr and str is and than cast the result to size_t. I don't think this would be helpful, but you may correct me as I'm not a fan of the c language.
return (size_t)(itr - str);