VirtualBox

Changeset 105873 in vbox for trunk/src/VBox/Main/src-all


Ignore:
Timestamp:
Aug 27, 2024 2:52:54 PM (8 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164593
Message:

IPRT/cpp/utils: Moved MY_VECTOR_ASSIGN_ARRAY into IPRT and renamed it to RT_CPP_VECTOR_ASSIGN_ARRAY. Macro was needed in several modules (to avoid code duplication).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-all/PlatformPropertiesImpl.cpp

    r105872 r105873  
    4545
    4646
    47 // defines
    48 /////////////////////////////////////////////////////////////////////////////
    49 
    50 /** @def MY_VECTOR_ASSIGN_ARRAY
    51  * Safe way to copy an array (static + const) into a vector w/ minimal typing.
    52  *
    53  * @param a_rVector     The destination vector reference.
    54  * @param a_aSrcArray   The source array to assign to the vector.
    55  */
    56 #if RT_GNUC_PREREQ(13, 0) && !RT_GNUC_PREREQ(14, 0) && defined(VBOX_WITH_GCC_SANITIZER)
    57 /* Workaround for g++ 13.2 incorrectly failing on arrays with a single entry in ASAN builds.
    58    This is restricted to [13.0, 14.0), assuming the issue was introduced in the 13 cycle
    59    and will be fixed by the time 14 is done.  If 14 doesn't fix it, extend the range
    60    version by version till it is fixed. */
    61 # define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
    62         _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wstringop-overread\""); \
    63         (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
    64         _Pragma("GCC diagnostic pop"); \
    65     } while (0)
    66 #else
    67 # define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
    68         (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
    69     } while (0)
    70 #endif
    71 
    72 
    7347/*
    7448 * PlatformProperties implementation.
     
    877851# endif
    878852            };
    879             MY_VECTOR_ASSIGN_ARRAY(vecSupportedGraphicsFeatures, s_aGraphicsFeatures);
     853            RT_CPP_VECTOR_ASSIGN_ARRAY(vecSupportedGraphicsFeatures, s_aGraphicsFeatures);
    880854            break;
    881855        }
     
    889863                GraphicsFeature_None
    890864            };
    891             MY_VECTOR_ASSIGN_ARRAY(vecSupportedGraphicsFeatures, s_aGraphicsFeatures);
     865            RT_CPP_VECTOR_ASSIGN_ARRAY(vecSupportedGraphicsFeatures, s_aGraphicsFeatures);
    892866            break;
    893867        }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette