Page MenuHomePhabricator

c/cxx: Fix warning from clang -Weverything.
Needs ReviewPublic

Authored by brunobelo on Sep 25 2019, 2:01 PM.

Details

Summary

some warning isn't gonna be fix like documentation-unknown-command,
reserved-id-macro, cast-qual, padded and others.
T8283

Test Plan

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
brunobelo created this revision.Sep 25 2019, 2:01 PM
brunobelo requested review of this revision.Sep 25 2019, 2:01 PM
lauromoura requested changes to this revision.Sep 25 2019, 2:13 PM

A couple initial comments

src/bin/elementary/perf.c
154

count_get is deprecated, good.

src/lib/eina/eina_accessor.h
161 ↗(On Diff #25627)

Doesn't this break Eina ABI?

src/lib/eina/eina_iterator.h
167 ↗(On Diff #25627)

ABI...

This revision now requires changes to proceed.Sep 25 2019, 2:13 PM
brunobelo edited the summary of this revision. (Show Details)Sep 27 2019, 1:04 PM
brunobelo planned changes to this revision.Sep 27 2019, 1:38 PM
brunobelo edited the summary of this revision. (Show Details)
brunobelo edited the summary of this revision. (Show Details)Sep 27 2019, 3:27 PM
brunobelo updated this revision to Diff 25852.Oct 1 2019, 3:25 PM

changing the abis breaks and change of cast-qual

bu5hm4n added inline comments.
src/lib/eina/eina_abi.c
29

Why is that needed ?

src/lib/eina/eina_accessor.c
57

Why is that needed ?

src/lib/eina/eina_binshare.c
76

Why is that needed ?

@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.