This patch adds pragma Assert to help CodePeer static analysis and
pragma Annotate to ignore Intentional or False_Positive warning.
Furthermore, some minor changes were added to take into account CodePeer
finding.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * libgnat/s-carsi8.adb (Compare_Array_S8): Add pragma Assert to
        avoid warning concerning Left_Len and RighLen value regarding
        Bytes_Compared_As_Words.
        * libgnat/s-carun8.adb (Compare_Array_U8): Likewise.
        * libgnat/s-geveop.adb (Binary_Operation, Unary_Operation): Add
        pragma Assert concerning divide by 0 warning.
        * libgnat/s-imgcha.adb (Image_Character): Code update to prevent
        constant operation warning.
        (Image_Character): Add pragma Assert concerning the unchecked
        String size.
        * libgnat/s-imgdec.adb
        (Round): Upate loop code to prevent warning concerning
        Digs'First access.
        (Round): Add pragma assert.
        (Set): Add pragma Assert for the unchecked string size.
        (Set_Digits): Add pragma Assert for the input range.
        (Set_Decimal_Digits): Add pragma Assert.
        (Set_Blank_And_Sign): Add pragma Assert for the input range.
        * libgnat/s-arit64.adb (DoubleDivide): Add pragma Assert
        concerning Du /= 0.
        (Multiply_With_Ovflo_Check): Add pragma Annotate to avoid
        warning concerning unsigned -> signed conversion.
        * libgnat/s-imguns.adb (Set_Image_Unsigned): Add pragma Assert
        to prevent overflow check warning.  Add pragma Assert for
        controlling S'First = 1.
        * libgnat/s-imgrea.adb (Image_Floating_Point, Set, Set_Digs,
        Set_Special_Fill, Convert_Integer): Add pragma Annotate to
        prevent overflow check warning.
        (Set_Image_Real): Add pragma Annotate to avoid dead code warning
        on float check. Add pragma Assert to prevent overflow check
        warning.
        * libgnat/s-imgwiu.adb (Set_Digits, Set_Image_Width_Unsigned):
        Add pragma assert to prevent overflow check warning.
        * libgnat/s-imgllu.adb (Set_Image_Long_Long_Unsigned): Add
        pragma assert to prevent overflow check warning.
        * libgnat/s-imgint.adb (Set_Digits): Add Assert for input
        constraint and to prevent overflow check warning, create
        Non_Positive subtype, and change the T parameter as Non_Positive
        instead Integer.
        (Set_Image_Integer): Add pragma assert to prevent overflow check
        warning.
        * libgnat/s-imglli.adb (Set_Digits): Add Assert for input
        constraint and to prevent overflow check warning, create
        Non_Positive subtype, and change the T parameter as Non_Positive
        instead Integer.
        (Set_Image_Long_Long_Integer): Add pragma assert to prevent
        overflow check warning.
        * libgnat/s-fatgen.adb (Decompose, Pred, Succ): Add pragma
        Annotate to prevent dead code due to invalid float check.
        * libgnat/s-imenne.adb (Image_Enumeration_8,
        Image_Enumeration_16, Image_Enumeration_32): Add pragma Assert
        to prevent overflow check warning.  Add Names_Index subtype for
        restricting Index_table content.

Attachment: patch.diff.gz
Description: application/gzip

Reply via email to