Every once in a while I recompile harvey just to see if it still
recompiles with newer compilers

Gcc choked on this bit of ACPI:

void
AcpiUtInitStackPtrTrace (
    void)
{
    ACPI_SIZE               CurrentSp;


    AcpiGbl_EntryStackPointer = &CurrentSp;
}

which I can understand it being unhappy about.

*this* is the kind of code that is being pushed as the future for x86,
ARM, risc-v.

It's also the code that is in billions of systems around the world.

clang had other opinions about other files, but did not complain about
that ACPI code.
olsneracpi.c:103:6: error: variable 'n' set but not used
[-Werror,-Wunused-but-set-variable]
  103 |         int n = 0;

so, OK, just declare is
int n;
and clang says
olsneracpi.c:103:6: error: variable 'n' set but not used
[-Werror,-Wunused-but-set-variable]
  103 |         int n;
      |             ^
olsneracpi.c:107:3: error: variable 'n' is uninitialized when used
here [-Werror,-Wuninitialized]
  107 |                 n++;
      |                 ^
olsneracpi.c:103:7: note: initialize the variable 'n' to silence this warning
  103 |         int n;
      |              ^

sheesh. spin up the "what do you want!" meme.

The real problem being that n was never used, anywhere.

newer clang flagged a few other code issues, including an unused
variable in liboventi and port/dsaprimes.c (j). nchunk is never used
in libventi/mem.c, rcount in cmd/cp.c has no use. And, as I'm
watching, all kinds of unused variables show all over the place. They
did not used to. Some of this same code remains in 9front and, I
assume, 9k.

In our experience on harvey, where we compiled at any time with 3
different versions of clang and gcc, we kept finding issues, including
possible buffer overflows. In a few cases, old compilers found things
that new compilers did not.  gcc and clang complained about different
thigns. It's still valuable, in my view, to be able to compile with
more than one compiler.

Note that many kernels are tightly locked in to a particular compiler
and version of that compiler. Both coreboot and u-boot use gcc-isms (I
lost that battle on coreboot). Plan 9 is a bit better, mainly because
our toolchain is so stable.

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T50fca46e5db29793-Mc10f7d8f56db9c818b704c2c
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to