aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.h
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-05-25 09:03:29 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-25 09:03:29 +0000
commit0d0cd28165d05981eadc966224dca77b87111b62 (patch)
treeb393260c4976c48845d0913b4bfd2057209f9bfb /gcc/optabs.h
parent28e3372094a60b1d7fb9d076a29b050761e5692a (diff)
downloadgcc-0d0cd28165d05981eadc966224dca77b87111b62.zip
gcc-0d0cd28165d05981eadc966224dca77b87111b62.tar.gz
gcc-0d0cd28165d05981eadc966224dca77b87111b62.tar.bz2
[Ada] Support for C99 and C++ standard boolean types
This change the type Interfaces.C.Extensions.bool to be fully compatible with the C99 and C++ standard boolean types by making it a fully-fledged boolean type with convention C. The following C+Ada program must compile quietly in LTO mode: bool b; struct S {}; bool foo (struct S *s) { return true; } pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Extensions; package t_c is b : aliased Extensions.bool; -- t.c:3 pragma Import (C, b, "b"); type S is record null; end record; pragma Convention (C_Pass_By_Copy, S); -- t.c:5 function foo (the_s : access S) return Extensions.bool; -- t.c:7 pragma Import (C, foo, "foo"); end t_c; with t_c; use t_c; procedure P_C is Dummy : aliased S; begin b := foo (Dummy'Access); end; 2018-05-25 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * freeze.adb (Freeze_Enumeration_Type): Do not give integer size to a boolean type with convention C. * libgnat/i-cexten.ads (bool): Change to boolean with convention C. * gcc-interface/decl.c (gnat_to_gnu_entity): Add new local variable FOREIGN and use it throughout the function. <E_Enumeration_Type>: Set precision 1 on boolean types with foreign convention. <E_Enumeration_Subtype>: Likewise for subtypes. <E_Record_Type>: Force the size of a storage unit on empty classes. * gcc-interface/utils.c (make_type_from_size) <BOOLEAN_TYPE>: Skip boolean types with precision 1 if the size is the expected one. From-SVN: r260721
Diffstat (limited to 'gcc/optabs.h')
0 files changed, 0 insertions, 0 deletions