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/hgGene/altSplice.c src/hg/hgGene/altSplice.c
index 85b3de57e03..d2776d1738b 100644
--- src/hg/hgGene/altSplice.c
+++ src/hg/hgGene/altSplice.c
@@ -53,31 +53,33 @@
 	bestIntersect = intersect;
 	bestBed = bed;
 	}
     else
         bedFree(&bed);
     }
 if (bestBed != NULL)
     {
     ret = cloneString(bestBed->name);
     bedFree(&bestBed);
     }
 return ret;
 }
 
 void makeGrayShades(struct hvGfx *hvg, int maxShade, Color shadesOfGray[])
-/* 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.  The array passed
+ * in must therefore have room for maxShade+2 entries. */
 {
 int i;
 for (i=0; i<=maxShade; ++i)
     {
     int level = 255 - (255*i/maxShade);
     if (level < 0) level = 0;
     shadesOfGray[i] = hvGfxFindColorIx(hvg, level, level, level);
     }
 shadesOfGray[maxShade+1] = MG_RED;
 }
 
 char *altGraphXMakeImage(struct altGraphX *ag)
 /* create a drawing of splicing pattern */
 {
 MgFont *font = mgSmallFont();