3e922f07e4d8c51a3b989e3dc6748e33f8516e3b
braney
  Mon Jun 22 09:10:05 2026 -0700
Document two -O3 cleanup details raised in v500 code review

Follow-up to code review #37767, addressing two points on commit f57fc11d951:

- The else guards in sanger22gtf.c and bottleneck.c looked like leftovers from
before errAbort was marked noreturn, but they are still required: removing
either one reintroduces -Werror=format-overflow at -O3, because that warning
runs before the noreturn-based dead-path pruning.  Added a comment at each
else saying so.

- makeGrayShades (hgGene/altSplice.c and hgTracks/simpleTracks.c) writes
shadesOfGray[maxShade+1] = MG_RED as an overflow sentinel.  Spelled this out
in both function descriptions so the maxShade+2 array sizing is documented at
the function, not just at the caller.

Comment-only; no behavior change.

refs #37767 refs #37761

diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index 6cfd1da99a2..b0bcc4872cf 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -3708,31 +3708,33 @@
 
 Color lightGrayIndex()
 /* Return index of light gray. */
 {
 return shadesOfGray[3];
 }
 
 Color veryLightGrayIndex()
 /* Return index of very light gray. */
 {
 return shadesOfGray[2];
 }
 
 
 void makeGrayShades(struct hvGfx *hvg)
-/* Make eight shades of gray in display. */
+/* Fill shadesOfGray[0..maxShade] with a white-to-black gradient, then set
+ * shadesOfGray[maxShade+1] to red as an overflow sentinel (shadesOfGray is
+ * declared with maxShade+2 entries to leave room for it). */
 {
 hMakeGrayShades(hvg, shadesOfGray, maxShade);
 shadesOfGray[maxShade+1] = MG_RED;
 }
 
 void makeBrownShades(struct hvGfx *hvg)
 /* Make some shades of brown in display. */
 {
 hvGfxMakeColorGradient(hvg, &tanColor, &brownColor, maxShade+1, shadesOfBrown);
 }
 
 void makeSeaShades(struct hvGfx *hvg)
 /* Make some shades of blue in display. */
 {
 hvGfxMakeColorGradient(hvg, &lightSeaColor, &darkSeaColor, maxShade+1, shadesOfSea);