From 24dc245931b8bfb74c4c4cdc3e1c63dccac0a8fd Mon Sep 17 00:00:00 2001 From: Saket Dumbre Date: Wed, 26 Apr 2023 10:51:08 -0700 Subject: Revert "Fixes for ACPI_FLEX_ARRAY, to eliminate warnings on MSVC" This reverts commit f98909b7928cac8c5328e4852ad5a7ea671204fb. --- source/common/dmtbinfo1.c | 2 +- source/compiler/aslrestype2.c | 6 +++--- source/components/disassembler/dmresrcl.c | 2 +- source/components/resources/rsaddr.c | 4 ++-- source/components/resources/rscreate.c | 8 ++++---- source/components/resources/rsdumpinfo.c | 8 ++++---- source/components/resources/rsirq.c | 12 ++++++------ source/include/acrestyp.h | 8 ++++---- source/include/actbl1.h | 2 +- source/include/amlresrc.h | 2 +- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/source/common/dmtbinfo1.c b/source/common/dmtbinfo1.c index e4632085d..11cf67151 100644 --- a/source/common/dmtbinfo1.c +++ b/source/common/dmtbinfo1.c @@ -947,7 +947,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar4[] = { {ACPI_DMT_UINT24, ACPI_DMAR4_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_UINT8, ACPI_DMAR4_OFFSET (DeviceNumber), "Device Number", 0}, - {ACPI_DMT_STRING, ACPI_DMAR4_OFFSET (u.DeviceName[0]), "Device Name", 0}, + {ACPI_DMT_STRING, ACPI_DMAR4_OFFSET (DeviceName[0]), "Device Name", 0}, ACPI_DMT_TERMINATOR }; diff --git a/source/compiler/aslrestype2.c b/source/compiler/aslrestype2.c index bf6f77ed7..6a1c1cbed 100644 --- a/source/compiler/aslrestype2.c +++ b/source/compiler/aslrestype2.c @@ -337,7 +337,7 @@ RsDoInterruptDescriptor ( Descriptor->ExtendedIrq.InterruptCount = 0; Rover = ACPI_CAST_PTR (AML_RESOURCE, - (&(Descriptor->ExtendedIrq.u.Interrupts[0]))); + (&(Descriptor->ExtendedIrq.Interrupts[0]))); /* Process all child initialization nodes */ @@ -466,7 +466,7 @@ RsDoInterruptDescriptor ( RsCreateDwordField (InitializerOp, ACPI_RESTAG_INTERRUPT, CurrentByteOffset + - ASL_RESDESC_OFFSET (ExtendedIrq.u.Interrupts[0])); + ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0])); } } @@ -494,7 +494,7 @@ RsDoInterruptDescriptor ( } Rnode->BufferLength = - (ASL_RESDESC_OFFSET (ExtendedIrq.u.Interrupts[0]) - + (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) - ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType)) + OptionIndex + StringLength; return (Rnode); diff --git a/source/components/disassembler/dmresrcl.c b/source/components/disassembler/dmresrcl.c index 88d19036a..75cafe5da 100644 --- a/source/components/disassembler/dmresrcl.c +++ b/source/components/disassembler/dmresrcl.c @@ -1112,7 +1112,7 @@ AcpiDmInterruptDescriptor ( { AcpiDmIndent (Level + 1); AcpiOsPrintf ("0x%8.8X,\n", - (UINT32) Resource->ExtendedIrq.u.Interrupts[i]); + (UINT32) Resource->ExtendedIrq.Interrupts[i]); } AcpiDmIndent (Level); diff --git a/source/components/resources/rsaddr.c b/source/components/resources/rsaddr.c index beee83803..46f38bc7b 100644 --- a/source/components/resources/rsaddr.c +++ b/source/components/resources/rsaddr.c @@ -431,13 +431,13 @@ AcpiRsGetAddressCommon ( ACPI_RESOURCE *Resource, AML_RESOURCE *Aml) { + ACPI_FUNCTION_ENTRY (); + /* Avoid undefined behavior: member access within misaligned address */ AML_RESOURCE_ADDRESS Address; memcpy(&Address, Aml, sizeof(Address)); - ACPI_FUNCTION_ENTRY(); - /* Validate the Resource Type */ if ((Address.ResourceType > 2) && diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index 583abe1a7..da0967ee8 100644 --- a/source/components/resources/rscreate.c +++ b/source/components/resources/rscreate.c @@ -475,9 +475,9 @@ AcpiRsCreatePciRoutingTable ( /* Use *remaining* length of the buffer as max for pathname */ PathBuffer.Length = OutputBuffer->Length - - (UINT32) ((UINT8 *) UserPrt->u.Source - + (UINT32) ((UINT8 *) UserPrt->Source - (UINT8 *) OutputBuffer->Pointer); - PathBuffer.Pointer = UserPrt->u.Source; + PathBuffer.Pointer = UserPrt->Source; Status = AcpiNsHandleToPathname ( (ACPI_HANDLE) Node, &PathBuffer, FALSE); @@ -488,12 +488,12 @@ AcpiRsCreatePciRoutingTable ( /* +1 to include null terminator */ - UserPrt->Length += (UINT32) strlen (UserPrt->u.Source) + 1; + UserPrt->Length += (UINT32) strlen (UserPrt->Source) + 1; break; case ACPI_TYPE_STRING: - strcpy (UserPrt->u.Source, ObjDesc->String.Pointer); + strcpy (UserPrt->Source, ObjDesc->String.Pointer); /* * Add to the Length field the length of the string diff --git a/source/components/resources/rsdumpinfo.c b/source/components/resources/rsdumpinfo.c index 2801e0d77..f15b7b981 100644 --- a/source/components/resources/rsdumpinfo.c +++ b/source/components/resources/rsdumpinfo.c @@ -182,7 +182,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpIrq[7] = {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Irq.Shareable), "Sharing", AcpiGbl_ShrDecode}, {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL}, - {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.u.Interrupts[0]), "Interrupt List", NULL} + {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpDma[6] = @@ -192,7 +192,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpDma[6] = {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BmDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SizDecode}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Dma.ChannelCount), "Channel Count", NULL}, - {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.u.Channels[0]), "Channel List", NULL} + {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[4] = @@ -327,7 +327,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] = {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Shareable), "Sharing", AcpiGbl_ShrDecode}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL}, - {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.u.Interrupts[0]), "Interrupt List", NULL} + {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[6] = @@ -555,7 +555,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpPrt[5] = {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPrt), NULL, NULL}, {ACPI_RSD_UINT64, ACPI_PRT_OFFSET (Address), "Address", NULL}, {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (Pin), "Pin", NULL}, - {ACPI_RSD_STRING, ACPI_PRT_OFFSET (u.Source[0]), "Source", NULL}, + {ACPI_RSD_STRING, ACPI_PRT_OFFSET (Source[0]), "Source", NULL}, {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (SourceIndex), "Source Index", NULL} }; diff --git a/source/components/resources/rsirq.c b/source/components/resources/rsirq.c index 10256c50b..c2d306aa2 100644 --- a/source/components/resources/rsirq.c +++ b/source/components/resources/rsirq.c @@ -171,7 +171,7 @@ ACPI_RSCONVERT_INFO AcpiRsGetIrq[9] = /* Get the IRQ mask (bytes 1:2) */ - {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.u.Interrupts[0]), + {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]), AML_OFFSET (Irq.IrqMask), ACPI_RS_OFFSET (Data.Irq.InterruptCount)}, @@ -227,7 +227,7 @@ ACPI_RSCONVERT_INFO AcpiRsSetIrq[14] = /* Convert interrupt list to 16-bit IRQ bitmask */ - {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.u.Interrupts[0]), + {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]), AML_OFFSET (Irq.IrqMask), ACPI_RS_OFFSET (Data.Irq.InterruptCount)}, @@ -345,14 +345,14 @@ ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[10] = /* Copy every IRQ in the table, each is 32 bits */ - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.ExtendedIrq.u.Interrupts[0]), - AML_OFFSET (ExtendedIrq.u.Interrupts[0]), + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]), + AML_OFFSET (ExtendedIrq.Interrupts[0]), 0}, /* Optional ResourceSource (Index and String) */ {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET (Data.ExtendedIrq.ResourceSource), - ACPI_RS_OFFSET (Data.ExtendedIrq.u.Interrupts[0]), + ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]), sizeof (AML_RESOURCE_EXTENDED_IRQ)} }; @@ -389,7 +389,7 @@ ACPI_RSCONVERT_INFO AcpiRsConvertDma[6] = /* DMA channel mask bits */ - {ACPI_RSC_BITMASK, ACPI_RS_OFFSET (Data.Dma.u.Channels[0]), + {ACPI_RSC_BITMASK, ACPI_RS_OFFSET (Data.Dma.Channels[0]), AML_OFFSET (Dma.DmaChannelMask), ACPI_RS_OFFSET (Data.Dma.ChannelCount)} }; diff --git a/source/include/acrestyp.h b/source/include/acrestyp.h index 3065bdcee..0dab6ec7b 100644 --- a/source/include/acrestyp.h +++ b/source/include/acrestyp.h @@ -293,7 +293,7 @@ typedef struct acpi_resource_irq union { UINT8 Interrupt; ACPI_FLEX_ARRAY(UINT8, Interrupts); - } u; + }; } ACPI_RESOURCE_IRQ; @@ -306,7 +306,7 @@ typedef struct acpi_resource_dma union { UINT8 Channel; ACPI_FLEX_ARRAY(UINT8, Channels); - } u; + }; } ACPI_RESOURCE_DMA; @@ -547,7 +547,7 @@ typedef struct acpi_resource_extended_irq union { UINT32 Interrupt; ACPI_FLEX_ARRAY(UINT32, Interrupts); - } u; + }; } ACPI_RESOURCE_EXTENDED_IRQ; @@ -951,7 +951,7 @@ typedef struct acpi_pci_routing_table union { char Pad[4]; /* pad to 64 bits so sizeof() works in all cases */ ACPI_FLEX_ARRAY(char, Source); - } u; + }; } ACPI_PCI_ROUTING_TABLE; #endif /* __ACRESTYP_H__ */ diff --git a/source/include/actbl1.h b/source/include/actbl1.h index 1b115ae35..cecd7edbe 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -1222,7 +1222,7 @@ typedef struct acpi_dmar_andd union { char __pad; ACPI_FLEX_ARRAY(char, DeviceName); - } u; + }; } ACPI_DMAR_ANDD; diff --git a/source/include/amlresrc.h b/source/include/amlresrc.h index a8e288add..05fa1505d 100644 --- a/source/include/amlresrc.h +++ b/source/include/amlresrc.h @@ -506,7 +506,7 @@ typedef struct aml_resource_extended_irq union { UINT32 Interrupt; ACPI_FLEX_ARRAY(UINT32, Interrupts); - } u; + }; /* ResSourceIndex, ResSource optional fields follow */ } AML_RESOURCE_EXTENDED_IRQ; -- cgit v1.2.1