[PATCH v2 2/2] Cygwin: uname: add host machine tag to sysname.
Jeremy Drake
cygwin@jdrake.com
Tue Nov 26 22:27:27 GMT 2024
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.
More information about the Cygwin-patches
mailing list