VirtualBox

Changeset 105873 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 27, 2024 2:52:54 PM (3 months ago)
Author:
vboxsync
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).

Location:
trunk/src/VBox/Main
Files:
3 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        }
  • trunk/src/VBox/Main/src-server/GraphicsAdapterImpl.cpp

    r105865 r105873  
    3737
    3838#include <iprt/cpp/utils.h>
    39 
    40 
    41 /** @def MY_VECTOR_ASSIGN_ARRAY
    42  * Safe way to copy an array (static + const) into a vector w/ minimal typing.
    43  *
    44  * @param a_rVector     The destination vector reference.
    45  * @param a_aSrcArray   The source array to assign to the vector.
    46  */
    47 #if RT_GNUC_PREREQ(13, 0) && !RT_GNUC_PREREQ(14, 0) && defined(VBOX_WITH_GCC_SANITIZER)
    48 /* Workaround for g++ 13.2 incorrectly failing on arrays with a single entry in ASAN builds.
    49    This is restricted to [13.0, 14.0), assuming the issue was introduced in the 13 cycle
    50    and will be fixed by the time 14 is done.  If 14 doesn't fix it, extend the range
    51    version by version till it is fixed. */
    52 # define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
    53         _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wstringop-overread\""); \
    54         (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
    55         _Pragma("GCC diagnostic pop"); \
    56     } while (0)
    57 #else
    58 # define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
    59         (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
    60     } while (0)
    61 #endif
    6239
    6340
  • trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp

    r105864 r105873  
    5656#include <VBox/vd.h>
    5757#include <VBox/vmm/cpum.h>
    58 
    59 // defines
    60 /////////////////////////////////////////////////////////////////////////////
    61 
    62 /** @def MY_VECTOR_ASSIGN_ARRAY
    63  * Safe way to copy an array (static + const) into a vector w/ minimal typing.
    64  *
    65  * @param a_rVector     The destination vector reference.
    66  * @param a_aSrcArray   The source array to assign to the vector.
    67  */
    68 #if RT_GNUC_PREREQ(13, 0) && !RT_GNUC_PREREQ(14, 0) && defined(VBOX_WITH_GCC_SANITIZER)
    69 /* Workaround for g++ 13.2 incorrectly failing on arrays with a single entry in ASAN builds.
    70    This is restricted to [13.0, 14.0), assuming the issue was introduced in the 13 cycle
    71    and will be fixed by the time 14 is done.  If 14 doesn't fix it, extend the range
    72    version by version till it is fixed. */
    73 # define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
    74         _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wstringop-overread\""); \
    75         (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
    76         _Pragma("GCC diagnostic pop"); \
    77     } while (0)
    78 #else
    79 # define MY_VECTOR_ASSIGN_ARRAY(a_rVector, a_aSrcArray) do { \
    80         (a_rVector).assign(&a_aSrcArray[0], &a_aSrcArray[RT_ELEMENTS(a_aSrcArray)]); \
    81     } while (0)
    82 #endif
    8358
    8459
     
    10621037#endif
    10631038    };
    1064     MY_VECTOR_ASSIGN_ARRAY(aSupportedPlatformArchitectures, s_aPlatformArchitectures);
     1039    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedPlatformArchitectures, s_aPlatformArchitectures);
    10651040
    10661041#ifdef VBOX_WITH_VIRT_ARMV8
     
    10861061        ClipboardMode_Bidirectional,
    10871062    };
    1088     MY_VECTOR_ASSIGN_ARRAY(aSupportedClipboardModes, s_aClipboardModes);
     1063    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedClipboardModes, s_aClipboardModes);
    10891064    return S_OK;
    10901065}
     
    10991074        DnDMode_Bidirectional,
    11001075    };
    1101     MY_VECTOR_ASSIGN_ARRAY(aSupportedDnDModes, s_aDnDModes);
     1076    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedDnDModes, s_aDnDModes);
    11021077    return S_OK;
    11031078}
     
    11181093        PointingHIDType_USBMultiTouchScreenPlusPad,
    11191094    };
    1120     MY_VECTOR_ASSIGN_ARRAY(aSupportedPointingHIDTypes, s_aPointingHIDTypes);
     1095    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedPointingHIDTypes, s_aPointingHIDTypes);
    11211096    return S_OK;
    11221097}
     
    11321107#endif
    11331108    };
    1134     MY_VECTOR_ASSIGN_ARRAY(aSupportedKeyboardHIDTypes, s_aKeyboardHIDTypes);
     1109    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedKeyboardHIDTypes, s_aKeyboardHIDTypes);
    11351110    return S_OK;
    11361111}
     
    11471122#endif
    11481123    };
    1149     MY_VECTOR_ASSIGN_ARRAY(aSupportedVFSTypes, s_aVFSTypes);
     1124    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedVFSTypes, s_aVFSTypes);
    11501125    return S_OK;
    11511126}
     
    11591134        ImportOptions_ImportToVDI,
    11601135    };
    1161     MY_VECTOR_ASSIGN_ARRAY(aSupportedImportOptions, s_aImportOptions);
     1136    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedImportOptions, s_aImportOptions);
    11621137    return S_OK;
    11631138}
     
    11721147        ExportOptions_StripAllNonNATMACs,
    11731148    };
    1174     MY_VECTOR_ASSIGN_ARRAY(aSupportedExportOptions, s_aExportOptions);
     1149    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedExportOptions, s_aExportOptions);
    11751150    return S_OK;
    11761151}
     
    11871162#endif
    11881163    };
    1189     MY_VECTOR_ASSIGN_ARRAY(aSupportedGraphicsFeatures, s_aGraphicsFeatures);
     1164    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedGraphicsFeatures, s_aGraphicsFeatures);
    11901165
    11911166    return S_OK;
     
    12021177        RecordingFeature_Video,
    12031178    };
    1204     MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingFeatures, s_aRecordingFeatures);
     1179    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedRecordingFeatures, s_aRecordingFeatures);
    12051180#else  /* !VBOX_WITH_RECORDING */
    12061181    aSupportedRecordingFeatures.clear();
     
    12211196#endif
    12221197    };
    1223     MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingAudioCodecs, s_aRecordingAudioCodecs);
     1198    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedRecordingAudioCodecs, s_aRecordingAudioCodecs);
    12241199    return S_OK;
    12251200}
     
    12381213#endif
    12391214    };
    1240     MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoCodecs, s_aRecordingVideoCodecs);
     1215    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoCodecs, s_aRecordingVideoCodecs);
    12411216    return S_OK;
    12421217}
     
    12531228#endif
    12541229    };
    1255     MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoScalingModes, s_aRecordingVideoScalingModes);
     1230    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoScalingModes, s_aRecordingVideoScalingModes);
    12561231    return S_OK;
    12571232}
     
    12671242        RecordingRateControlMode_VBR
    12681243    };
    1269     MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingAudioRateControlModes, s_aRecordingAudioRateControlModes);
     1244    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedRecordingAudioRateControlModes, s_aRecordingAudioRateControlModes);
    12701245    return S_OK;
    12711246}
     
    12811256        RecordingRateControlMode_VBR
    12821257    };
    1283     MY_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoRateControlModes, s_aRecordingVideoRateControlModes);
     1258    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedRecordingVideoRateControlModes, s_aRecordingVideoRateControlModes);
    12841259    return S_OK;
    12851260}
     
    12951270        CloneOptions_KeepHwUUIDs,
    12961271    };
    1297     MY_VECTOR_ASSIGN_ARRAY(aSupportedCloneOptions, s_aCloneOptions);
     1272    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedCloneOptions, s_aCloneOptions);
    12981273    return S_OK;
    12991274}
     
    13081283        AutostopType_AcpiShutdown,
    13091284    };
    1310     MY_VECTOR_ASSIGN_ARRAY(aSupportedAutostopTypes, s_aAutostopTypes);
     1285    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedAutostopTypes, s_aAutostopTypes);
    13111286    return S_OK;
    13121287}
     
    13221297        VMProcPriority_High,
    13231298    };
    1324     MY_VECTOR_ASSIGN_ARRAY(aSupportedVMProcPriorities, s_aVMProcPriorities);
     1299    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedVMProcPriorities, s_aVMProcPriorities);
    13251300    return S_OK;
    13261301}
     
    13441319        NetworkAttachmentType_Null,
    13451320    };
    1346     MY_VECTOR_ASSIGN_ARRAY(aSupportedNetworkAttachmentTypes, s_aNetworkAttachmentTypes);
     1321    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedNetworkAttachmentTypes, s_aNetworkAttachmentTypes);
    13471322    return S_OK;
    13481323}
     
    13581333        PortMode_TCP,
    13591334    };
    1360     MY_VECTOR_ASSIGN_ARRAY(aSupportedPortModes, s_aPortModes);
     1335    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedPortModes, s_aPortModes);
    13611336    return S_OK;
    13621337}
     
    13961371        AudioDriverType_Null,
    13971372    };
    1398     MY_VECTOR_ASSIGN_ARRAY(aSupportedAudioDriverTypes, s_aAudioDriverTypes);
     1373    RT_CPP_VECTOR_ASSIGN_ARRAY(aSupportedAudioDriverTypes, s_aAudioDriverTypes);
    13991374    return S_OK;
    14001375}
     
    14241399#endif
    14251400            };
    1426             MY_VECTOR_ASSIGN_ARRAY(aExecutionEngines, s_aExecEngines);
     1401            RT_CPP_VECTOR_ASSIGN_ARRAY(aExecutionEngines, s_aExecEngines);
    14271402            break;
    14281403        }
     
    14421417# endif
    14431418            };
    1444             MY_VECTOR_ASSIGN_ARRAY(aExecutionEngines, s_aExecEngines);
     1419            RT_CPP_VECTOR_ASSIGN_ARRAY(aExecutionEngines, s_aExecEngines);
    14451420#else
    14461421            aExecutionEngines.clear();
Note: See TracChangeset for help on using the changeset viewer.

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