[pacman-dev] [RFC, PATCHES]: Very preliminary work towards clean build with clang -Weverything

Allan McRae allan at archlinux.org
Sat Sep 3 10:21:59 UTC 2016


On 03/09/16 12:08, ivy.foster at gmail.com wrote:
> First of all, don't worry; I'm under no illusion that the
> pie-in-the-sky Subject line is anything that will happen in the near
> future, nor even necessarily a goal for the project (given just how
> finicky -Weverything is).
> 
> Basically, I'm wondering whether sporadic patches addressing the sorts
> of things "clang -Weverything" gripes about would be considered
> welcome contributions, or nitpicking. By "sporadic patches", I mean
> that any of this sort from me would come when I felt like working on a
> coding project but didn't have anything particularly in mind.
> 
> As a sample, I've made two patches addressing some of its earliest
> warnings. The first changes several headers to (say) #define
> IDENTIFIERS rather than _IDENTIFIERS. The second adds ALPM_ERR_OK = 0
> to the _alpm_err_t enum. Some functions which return an _alpm_err_t
> return value were returning 0 on success, but there was no 0 value
> enumerated--not actively harmful, but still an oddity.
> 
> If this sort of thing isn't of interest, I definitely get it. I just
> figured that an RFC with patches attached would provide something more
> concrete to discuss than one without.

I am happy to accept these.  When you fix a specific set of warnings
from clang/gcc, you can add that specific warning flag (i.e. not
-Weverything...) to our configure.ac at this section:

# Enable or disable compiler warning flags
AC_MSG_CHECKING(for excessive compiler warning flags)
if test "x$warningflags" = "xyes" ; then
	AC_MSG_RESULT(yes)
	CFLAGS_ADD([-Wcast-align], [WARNING_CFLAGS])
	CFLAGS_ADD([-Wclobbered], [WARNING_CFLAGS])
...

That way we will not regress in the future.

Thanks,
Allan


More information about the pacman-dev mailing list