aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcov-tool.cc
diff options
context:
space:
mode:
authorJoffrey Huguet <huguet@adacore.com>2022-05-03 14:46:35 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2022-06-02 09:06:36 +0000
commitf0b7fddbefbe7af7c14ed5f2def49bbdb4a6c919 (patch)
treee97796c37cad383a3a00e8cc54b29b209c1229a3 /gcc/gcov-tool.cc
parentdcfdd2851b297e0005a8490b7f867ca45d1ad340 (diff)
downloadgcc-f0b7fddbefbe7af7c14ed5f2def49bbdb4a6c919.zip
gcc-f0b7fddbefbe7af7c14ed5f2def49bbdb4a6c919.tar.gz
gcc-f0b7fddbefbe7af7c14ed5f2def49bbdb4a6c919.tar.bz2
[Ada] Add contracts to Interfaces.C.Strings
This patch adds Global contracts and preconditions to subprograms of Interfaces.C.Strings. Effects on allocated memory are modelled through an abstract state, C_Memory. The preconditions protect against Dereference_Error, but not Storage_Error (which is not handled by SPARK). This patch also disables the use of To_Chars_Ptr, which creates an alias between an ownership pointer and the abstract state, and the use of Free, in SPARK code. Thus, memory leaks will happen if the user creates the Chars_Ptr using New_Char_Array and New_String. gcc/ada/ * libgnat/i-cstrin.ads (To_Chars_Ptr): Add SPARK_Mode => Off. (Free): Likewise. (New_Char_Array): Add global contracts and Volatile attribute. (New_String): Likewise. (Value, Strlen, Update): Add global contracts and preconditions. * libgnat/i-cstrin.adb: Add SPARK_Mode => Off to the package body.
Diffstat (limited to 'gcc/gcov-tool.cc')
0 files changed, 0 insertions, 0 deletions