aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2018-02-02 19:53:59 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2018-02-02 19:53:59 +0000
commit7c30b12aaab19731a659e8d1d1a287c2d21131bf (patch)
treee48d1877fab55b806ceb1df0cdf7f960c8e3fd96 /gcc
parentdacdc68f3bd5e7c4de0dd54f9dcb1465686ac01a (diff)
downloadgcc-7c30b12aaab19731a659e8d1d1a287c2d21131bf.zip
gcc-7c30b12aaab19731a659e8d1d1a287c2d21131bf.tar.gz
gcc-7c30b12aaab19731a659e8d1d1a287c2d21131bf.tar.bz2
c-common.h (DECL_UNNAMED_BIT_FIELD): New.
/c-family 2018-02-02 Paolo Carlini <paolo.carlini@oracle.com> * c-common.h (DECL_UNNAMED_BIT_FIELD): New. /c 2018-02-02 Paolo Carlini <paolo.carlini@oracle.com> * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init, output_init_element, process_init_element): Use DECL_UNNAMED_BIT_FIELD. /cp 2018-02-02 Paolo Carlini <paolo.carlini@oracle.com> * class.c (is_really_empty_class): Use DECL_UNNAMED_BIT_FIELD. * constexpr.c (cx_check_missing_mem_inits): Likewise. * decl.c (next_initializable_field, find_decomp_class_base, cp_finish_decomp): Likewise. * typeck2.c (process_init_constructor_record): Likewise. From-SVN: r257348
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog4
-rw-r--r--gcc/c-family/c-common.h4
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-typeck.c19
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/constexpr.c2
-rw-r--r--gcc/cp/decl.c8
-rw-r--r--gcc/cp/typeck2.c11
9 files changed, 41 insertions, 23 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 5bbdd36..02b2b1a 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * c-common.h (DECL_UNNAMED_BIT_FIELD): New.
+
2018-02-02 Julia Koval <julia.koval@intel.com>
* c-common.h (omp_clause_mask): Move to wide_int_bitmask.h.
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index aad01fa..775d468 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -940,6 +940,10 @@ extern void c_parse_final_cleanups (void);
#define CLEAR_DECL_C_BIT_FIELD(NODE) \
(DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 0)
+/* True if the decl was an unnamed bitfield. */
+#define DECL_UNNAMED_BIT_FIELD(NODE) \
+ (DECL_C_BIT_FIELD (NODE) && !DECL_NAME (NODE))
+
extern tree do_case (location_t, tree, tree);
extern tree build_stmt (location_t, enum tree_code, ...);
extern tree build_real_imag_expr (location_t, enum tree_code, tree);
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 561b58e..97ae43c 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2018-02-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * c-typeck.c (really_start_incremental_init, push_init_level,
+ set_nonincremental_init, output_init_element, process_init_element):
+ Use DECL_UNNAMED_BIT_FIELD.
+
2018-01-31 Marek Polacek <polacek@redhat.com>
PR c/81779
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index e22bc74..b35c2c0 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -7955,8 +7955,7 @@ really_start_incremental_init (tree type)
constructor_fields = TYPE_FIELDS (constructor_type);
/* Skip any nameless bit fields at the beginning. */
while (constructor_fields != NULL_TREE
- && DECL_C_BIT_FIELD (constructor_fields)
- && DECL_NAME (constructor_fields) == NULL_TREE)
+ && DECL_UNNAMED_BIT_FIELD (constructor_fields))
constructor_fields = DECL_CHAIN (constructor_fields);
constructor_unfilled_fields = constructor_fields;
@@ -8161,8 +8160,7 @@ push_init_level (location_t loc, int implicit,
constructor_fields = TYPE_FIELDS (constructor_type);
/* Skip any nameless bit fields at the beginning. */
while (constructor_fields != NULL_TREE
- && DECL_C_BIT_FIELD (constructor_fields)
- && DECL_NAME (constructor_fields) == NULL_TREE)
+ && DECL_UNNAMED_BIT_FIELD (constructor_fields))
constructor_fields = DECL_CHAIN (constructor_fields);
constructor_unfilled_fields = constructor_fields;
@@ -8930,8 +8928,7 @@ set_nonincremental_init (struct obstack * braced_init_obstack)
constructor_unfilled_fields = TYPE_FIELDS (constructor_type);
/* Skip any nameless bit fields at the beginning. */
while (constructor_unfilled_fields != NULL_TREE
- && DECL_C_BIT_FIELD (constructor_unfilled_fields)
- && DECL_NAME (constructor_unfilled_fields) == NULL_TREE)
+ && DECL_UNNAMED_BIT_FIELD (constructor_unfilled_fields))
constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields);
}
@@ -9300,8 +9297,7 @@ output_init_element (location_t loc, tree value, tree origtype,
/* Skip any nameless bit fields. */
while (constructor_unfilled_fields != NULL_TREE
- && DECL_C_BIT_FIELD (constructor_unfilled_fields)
- && DECL_NAME (constructor_unfilled_fields) == NULL_TREE)
+ && DECL_UNNAMED_BIT_FIELD (constructor_unfilled_fields))
constructor_unfilled_fields =
DECL_CHAIN (constructor_unfilled_fields);
}
@@ -9665,8 +9661,8 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
constructor_unfilled_fields = DECL_CHAIN (constructor_fields);
/* Skip any nameless bit fields. */
while (constructor_unfilled_fields != 0
- && DECL_C_BIT_FIELD (constructor_unfilled_fields)
- && DECL_NAME (constructor_unfilled_fields) == 0)
+ && (DECL_UNNAMED_BIT_FIELD
+ (constructor_unfilled_fields)))
constructor_unfilled_fields =
DECL_CHAIN (constructor_unfilled_fields);
}
@@ -9675,8 +9671,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
constructor_fields = DECL_CHAIN (constructor_fields);
/* Skip any nameless bit fields at the beginning. */
while (constructor_fields != NULL_TREE
- && DECL_C_BIT_FIELD (constructor_fields)
- && DECL_NAME (constructor_fields) == NULL_TREE)
+ && DECL_UNNAMED_BIT_FIELD (constructor_fields))
constructor_fields = DECL_CHAIN (constructor_fields);
}
else if (TREE_CODE (constructor_type) == UNION_TYPE)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9c76f8e..0681826 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2018-02-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * class.c (is_really_empty_class): Use DECL_UNNAMED_BIT_FIELD.
+ * constexpr.c (cx_check_missing_mem_inits): Likewise.
+ * decl.c (next_initializable_field, find_decomp_class_base,
+ cp_finish_decomp): Likewise.
+ * typeck2.c (process_init_constructor_record): Likewise.
+
2018-02-02 Jason Merrill <jason@redhat.com>
PR c++/84181 - ICE with lambda parm in template argument.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 4103630..a4098ac 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -8202,7 +8202,7 @@ is_really_empty_class (tree type)
if (TREE_CODE (field) == FIELD_DECL
&& !DECL_ARTIFICIAL (field)
/* An unnamed bit-field is not a data member. */
- && (DECL_NAME (field) || !DECL_C_BIT_FIELD (field))
+ && !DECL_UNNAMED_BIT_FIELD (field)
&& !is_really_empty_class (TREE_TYPE (field)))
return false;
return true;
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 171c389..93dd8ae 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -783,7 +783,7 @@ cx_check_missing_mem_inits (tree ctype, tree body, bool complain)
tree ftype;
if (TREE_CODE (field) != FIELD_DECL)
continue;
- if (DECL_C_BIT_FIELD (field) && !DECL_NAME (field))
+ if (DECL_UNNAMED_BIT_FIELD (field))
continue;
if (DECL_ARTIFICIAL (field))
continue;
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 244a3ef..01ce9fb 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5634,7 +5634,7 @@ next_initializable_field (tree field)
{
while (field
&& (TREE_CODE (field) != FIELD_DECL
- || (DECL_C_BIT_FIELD (field) && !DECL_NAME (field))
+ || DECL_UNNAMED_BIT_FIELD (field)
|| (DECL_ARTIFICIAL (field)
&& !(cxx_dialect >= cxx17 && DECL_FIELD_IS_BASE (field)))))
field = DECL_CHAIN (field);
@@ -7208,7 +7208,7 @@ find_decomp_class_base (location_t loc, tree type, tree ret)
for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
if (TREE_CODE (field) != FIELD_DECL
|| DECL_ARTIFICIAL (field)
- || (DECL_C_BIT_FIELD (field) && !DECL_NAME (field)))
+ || DECL_UNNAMED_BIT_FIELD (field))
continue;
else if (ret)
return type;
@@ -7646,7 +7646,7 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
for (tree field = TYPE_FIELDS (btype); field; field = TREE_CHAIN (field))
if (TREE_CODE (field) != FIELD_DECL
|| DECL_ARTIFICIAL (field)
- || (DECL_C_BIT_FIELD (field) && !DECL_NAME (field)))
+ || DECL_UNNAMED_BIT_FIELD (field))
continue;
else
eltscnt++;
@@ -7663,7 +7663,7 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
for (tree field = TYPE_FIELDS (btype); field; field = TREE_CHAIN (field))
if (TREE_CODE (field) != FIELD_DECL
|| DECL_ARTIFICIAL (field)
- || (DECL_C_BIT_FIELD (field) && !DECL_NAME (field)))
+ || DECL_UNNAMED_BIT_FIELD (field))
continue;
else
{
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 8cb0e88..899d60e 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1395,14 +1395,14 @@ process_init_constructor_record (tree type, tree init, int nested,
tree next;
tree type;
- if (!DECL_NAME (field) && DECL_C_BIT_FIELD (field))
- continue;
-
if (TREE_CODE (field) != FIELD_DECL
|| (DECL_ARTIFICIAL (field)
&& !(cxx_dialect >= cxx17 && DECL_FIELD_IS_BASE (field))))
continue;
+ if (DECL_UNNAMED_BIT_FIELD (field))
+ continue;
+
/* If this is a bitfield, first convert to the declared type. */
type = TREE_TYPE (field);
if (DECL_BIT_FIELD_TYPE (field))
@@ -1547,14 +1547,15 @@ process_init_constructor_record (tree type, tree init, int nested,
for (field = TYPE_FIELDS (type);
field; field = DECL_CHAIN (field))
{
- if (!DECL_NAME (field) && DECL_C_BIT_FIELD (field))
- continue;
if (TREE_CODE (field) != FIELD_DECL
|| (DECL_ARTIFICIAL (field)
&& !(cxx_dialect >= cxx17
&& DECL_FIELD_IS_BASE (field))))
continue;
+ if (DECL_UNNAMED_BIT_FIELD (field))
+ continue;
+
if (ce->index == field || ce->index == DECL_NAME (field))
break;
if (ANON_AGGR_TYPE_P (TREE_TYPE (field)))