diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-03-04 11:58:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-04 11:58:45 +0000 |
commit | d89c8ccf3237e66029125c0fe007297bb86eca74 (patch) | |
tree | 24926ddec8217cdba774a50eaa06383c8a72d13e /gcc/rust/backend/rust-constexpr.cc | |
parent | b4bd389c66a3e3bf0489626a1a70c2500d415ef8 (diff) | |
parent | d6e1771291c792f665f5b9ed7d065bf292051e6a (diff) | |
download | gcc-d89c8ccf3237e66029125c0fe007297bb86eca74.zip gcc-d89c8ccf3237e66029125c0fe007297bb86eca74.tar.gz gcc-d89c8ccf3237e66029125c0fe007297bb86eca74.tar.bz2 |
Merge #990
990: Add must use attribute support r=philberty a=philberty
This is a port of the CPP front-end nodiscard attribute to be used for
must_use. It contains a patch to clean up how we handle expressions vs
statements and removes more of the GCC abstraction. Its my hope that we
can leverage more and more existing code to get the static analysis where
we want it.
Fixes #856
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/backend/rust-constexpr.cc')
-rw-r--r-- | gcc/rust/backend/rust-constexpr.cc | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/gcc/rust/backend/rust-constexpr.cc b/gcc/rust/backend/rust-constexpr.cc index f1f969c..1b0515e 100644 --- a/gcc/rust/backend/rust-constexpr.cc +++ b/gcc/rust/backend/rust-constexpr.cc @@ -17,6 +17,7 @@ #include "rust-constexpr.h" #include "rust-location.h" #include "rust-diagnostics.h" +#include "rust-tree.h" #include "fold-const.h" #include "realmpfr.h" @@ -25,52 +26,6 @@ #include "gimplify.h" #include "tree-iterator.h" -/* Returns true if NODE is a pointer. */ -#define TYPE_PTR_P(NODE) (TREE_CODE (NODE) == POINTER_TYPE) - -/* Returns true if NODE is a reference. */ -#define TYPE_REF_P(NODE) (TREE_CODE (NODE) == REFERENCE_TYPE) - -/* Returns true if NODE is a pointer or a reference. */ -#define INDIRECT_TYPE_P(NODE) (TYPE_PTR_P (NODE) || TYPE_REF_P (NODE)) - -/* [basic.fundamental] - - Types bool, char, wchar_t, and the signed and unsigned integer types - are collectively called integral types. - - Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration - types as well, which is incorrect in C++. Keep these checks in - ascending code order. */ -#define RS_INTEGRAL_TYPE_P(TYPE) \ - (TREE_CODE (TYPE) == BOOLEAN_TYPE || TREE_CODE (TYPE) == INTEGER_TYPE) - -/* [basic.fundamental] - - Integral and floating types are collectively called arithmetic - types. - - As a GNU extension, we also accept complex types. - - Keep these checks in ascending code order. */ -#define ARITHMETIC_TYPE_P(TYPE) \ - (RS_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE \ - || TREE_CODE (TYPE) == COMPLEX_TYPE) - -/* True iff TYPE is cv decltype(nullptr). */ -#define NULLPTR_TYPE_P(TYPE) (TREE_CODE (TYPE) == NULLPTR_TYPE) - -/* [basic.types] - - Arithmetic types, enumeration types, pointer types, - pointer-to-member types, and std::nullptr_t are collectively called - scalar types. - - Keep these checks in ascending code order. */ -#define SCALAR_TYPE_P(TYPE) \ - (TREE_CODE (TYPE) == ENUMERAL_TYPE || ARITHMETIC_TYPE_P (TYPE) \ - || TYPE_PTR_P (TYPE) || NULLPTR_TYPE_P (TYPE)) - namespace Rust { namespace Compile { |