This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [GOLD] PowerPC64 TOC indirect to TOC relative code editing


> +  if (start == 0)
> +    start = 1;
> +  if (start >= shnum)
> +    return;

Isn't (start >= shnum) a "can't happen" case? Why not just
gold_assert(start < shnum)?

> +  unsigned int i = start;
> +  do
>      {
> +      const unsigned char* p = pshdrs + i * This::shdr_size;
> ...
> +    } while ((i = i + 1 == shnum ? 1 : i + 1) != start);
>  }

Not a fan of that do...while loop. (Hmmm, what happens if shnum == 1?)
At the least, the condition could use an extra pair of parens to make
it more readable. I think I'd prefer the original for loop, running
from 1..shnum, but add the bias and calculate p at the top of the
loop.

-cary


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]