aboutsummaryrefslogtreecommitdiff
path: root/maintainer-scripts
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2023-11-29 04:00:45 -0300
committerAlexandre Oliva <oliva@gnu.org>2023-11-29 04:00:45 -0300
commit862867eab78d7731f725cf7fa4ba02ed5e503db1 (patch)
tree8cb72282d503631c52973cc05290aec00fe3a19e /maintainer-scripts
parent0d24289d129639efdc79338a64188d6d404375e8 (diff)
downloadgcc-862867eab78d7731f725cf7fa4ba02ed5e503db1.zip
gcc-862867eab78d7731f725cf7fa4ba02ed5e503db1.tar.gz
gcc-862867eab78d7731f725cf7fa4ba02ed5e503db1.tar.bz2
Introduce hardbool attribute for C
This patch introduces hardened booleans in C. The hardbool attribute, when attached to an integral type, turns it into an enumerate type with boolean semantics, using the named or implied constants as representations for false and true. Expressions of such types decay to _Bool, trapping if the value is neither true nor false, and _Bool can convert implicitly back to them. Other conversions go through _Bool first. for gcc/c-family/ChangeLog * c-attribs.cc (c_common_attribute_table): Add hardbool. (handle_hardbool_attribute): New. (type_valid_for_vector_size): Reject hardbool. * c-common.cc (convert_and_check): Skip warnings for convert and check for hardbool. (c_hardbool_type_attr_1): New. * c-common.h (c_hardbool_type_attr): New. for gcc/c/ChangeLog * c-typeck.cc (convert_lvalue_to_rvalue): Decay hardbools. * c-convert.cc (convert): Convert to hardbool through truthvalue. * c-decl.cc (check_bitfield_type_and_width): Skip enumeral truncation warnings for hardbool. (finish_struct): Propagate hardbool attribute to bitfield types. (digest_init): Convert to hardbool. for gcc/ChangeLog * doc/extend.texi (hardbool): New type attribute. * doc/invoke.texi (-ftrivial-auto-var-init): Document representation vs values. for gcc/testsuite/ChangeLog * gcc.dg/hardbool-err.c: New. * gcc.dg/hardbool-trap.c: New. * gcc.dg/torture/hardbool.c: New. * gcc.dg/torture/hardbool-s.c: New. * gcc.dg/torture/hardbool-us.c: New. * gcc.dg/torture/hardbool-i.c: New. * gcc.dg/torture/hardbool-ul.c: New. * gcc.dg/torture/hardbool-ll.c: New. * gcc.dg/torture/hardbool-5a.c: New. * gcc.dg/torture/hardbool-s-5a.c: New. * gcc.dg/torture/hardbool-us-5a.c: New. * gcc.dg/torture/hardbool-i-5a.c: New. * gcc.dg/torture/hardbool-ul-5a.c: New. * gcc.dg/torture/hardbool-ll-5a.c: New.
Diffstat (limited to 'maintainer-scripts')
0 files changed, 0 insertions, 0 deletions