On Nov 26 14:27, Jeremy Drake via Cygwin-patches wrote: > On Tue, 26 Nov 2024, Corinna Vinschen wrote: > > > On Nov 25 11:24, Jeremy Drake via Cygwin-patches wrote: > > > + switch (wincap.host_machine ()) > > > + { > > > + case IMAGE_FILE_MACHINE_AMD64: > > > + n = stpcpy (buf, "-x64") - buf; > > > + break; > > > + case IMAGE_FILE_MACHINE_ARM64: > > > + n = stpcpy (buf, "-ARM64") - buf; > > > + break; > > > + default: > > > + n = __small_sprintf (buf, "-%04y", (int) wincap.host_machine ()); > > > + break; > > > + } > > > > > You can greatly simplify this switch. We don't support 32 bit systems > > and we will never again support 32 bit systems. Any combination > > including a 32 bit system can just go away. Theoretically, only > > the IMAGE_FILE_MACHINE_ARM64 case should be left. > > Is the above edit enough, or do I need to remove the x64 case entirely as > well? If you truly just want to handle ARM64, this whole function could > be inlined into just an > > if (wincap.host_machine () != wincap.cygwin_machine () > && wincap.host_machine () == IMAGE_FILE_MACHINE_ARM64) > strcat (name->sysname, "-ARM64"); > > For a little more future-proofing, nested if/else so non-ARM64 gets the > hex fallback from the default case above.
I'm not opposed to a switch statement consisting of an IMAGE_FILE_MACHINE_ARM64 case and a default case adding "-???" or something. Chances are so extremly slim that we'll ever see another CPU emulated on x86_64, we can always add a case for that if it turns out that I'm totally wrong, right? Thanks, Corinna