Re: [PATCH/RFC 3/3] ci: run a pedantic build as part of the GitHub workflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 9, 2021 at 3:50 AM Bagas Sanjaya <bagasdotme@xxxxxxxxx> wrote:
>
> On 09/08/21 08.38, Carlo Marcelo Arenas Belón wrote:
> > add a dockerized build using fedora (that usually has the latest gcc)
> > to be ahead of the curve and avoid older ISO C issues at the same time.
>
> But from GCC manual [1], the default C dialect used is `-std=gnu17`,
> while `-pedantic` is only relevant for ISO C (such as `-std=c17`).

sorry about that, my comment was confusing

I only meant to imply that newer compilers were not throwing any more
warnings than the ones that were fixed unlike what you would get if
using older compilers or targeting an older standard.  This implies that
it will likely not have many false positives and the few breaks that would
come with newer compiled might be worth investigating or adding to the
ignore list.

a strict C89 compiler won't even build (ex: inline is a gnu extension
and the codebase has
been adding those officially since fe9dc6b08c (Merge branch
'jc/post-c89-rules-doc', 2019-07-25))

and so the pedantic check implied you would target at least gnu89 and
generate lots of warnings (so don't expect to build with DEVELOPER=1
that adds -Werror)

are you suggesting we need a more aggresive target like strict C99? at
least gcc 11.2.0
seems to be able to still build next without warnings.

> And why not using `-pedantic-errors`, so that non-ISO features are
> treated as errors?

warnings are already treated as errors, if you want to see all
warnings need DEVOPTS="no-error pedantic"

> Newcomers contributing to Git may think that based on what our CI do,
> they can submit patches with C17 features (perhaps with GNU extensions).
> Then at some time there is casual users that complain that Git doesn't
> compile with their default older compiler (maybe they run LTS
> distributions or pre-C17 compiler). Thus we want Git to be compiled
> successfully using wide variety of compilers (maybe as old as GCC 4.8).

the codebase was meant to be C89 compatible (as described in
Documentation/CodingGuidelines).

gcc-4 is a good target because AFAIK was the last one that defaulted
to gnu89 mode
and was also used as the system compiler for several really old
systems that still have support.

I tested with 4.9.4, which was the oldest I could get a hold off from
gcc's docker hub, but I suspect
will work the same in that old gcc from centos or debian as well.

Carlo




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux