On Sun, Jun 29, 2025 at 5:18 AM Pádraig Brady <p...@draigbrady.com> wrote: > On 29/06/2025 05:25, Paul Eggert wrote: > > > od: omit some duplicate code > > On x86-64 (for example) print_long, print_long_long, and > > print_intmax all behave identically, so give GCC enough info so > > that it generates code for just one of these functions. > > * src/od.c (enum size_spec): Arrange for enum values to > > be the same if they represent types that behave the same. > > (width_bytes, ISPEC_TO_FORMAT, decode_one_format): > > Match the enum size_spec changes. > > The patch above causes a warning on some systems: > > src/od.c: In function 'decode_one_format': > src/od.c:900:28: error: duplicated 'if' condition [-Werror=duplicated-cond] > 900 | else if (size_spec == FLOAT_HALF) > | ~~~~~~~~~~^~~~~~~~~~~~~ > src/od.c:895:28: note: previously used here > 895 | else if (size_spec == FLOAT_SINGLE) > | ~~~~~~~~~~^~~~~~~~~~~~~~~ > > If we want the compiler to just apply Dead Code Elimination here, > then it may be best to push/pop ignoring that warning ?
Thanks. I agree.