aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-01-06 18:53:01 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-01-06 18:53:01 +0000
commit96066ce19be4b8187ac2c1a45a55986bf2655697 (patch)
treed1e15bd8204f3a756aa9a12600b3781957a80f71 /gcc
parentaaa15a0d0823654d69cb9d4d751a0ecf3ed6ee49 (diff)
downloadgcc-96066ce19be4b8187ac2c1a45a55986bf2655697.zip
gcc-96066ce19be4b8187ac2c1a45a55986bf2655697.tar.gz
gcc-96066ce19be4b8187ac2c1a45a55986bf2655697.tar.bz2
re PR c/57773 (-Wpedantic incorrect warning for enum bit-field)
PR c/57773 * doc/implement-c.texi: Mention that other integer types are permitted as bit-field types in strictly conforming mode. c/ * c-decl.c (check_bitfield_type_and_width): Warn for implementation defined bit-field types only in ISO C. testsuite/ * gcc.dg/pr57773.c: New test. From-SVN: r206373
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-decl.c3
-rw-r--r--gcc/doc/implement-c.texi5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr57773.c13
6 files changed, 34 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5a3e25d..2a9dafa 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-01-06 Marek Polacek <polacek@redhat.com>
+
+ PR c/57773
+ * doc/implement-c.texi: Mention that other integer types are
+ permitted as bit-field types in strictly conforming mode.
+
2014-01-02 Felix Yang <fei.yang0953@gmail.com>
* modulo-sched.c (schedule_reg_moves): Clear distance1_uses if it
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 6cb79c0..917453b 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2014-01-06 Marek Polacek <polacek@redhat.com>
+
+ PR c/57773
+ * c-decl.c (check_bitfield_type_and_width): Warn for implementation
+ defined bit-field types only in ISO C.
+
2014-01-02 Richard Sandiford <rdsandiford@googlemail.com>
Update copyright years
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 21a07e2..6d4e6a3 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -4840,7 +4840,8 @@ check_bitfield_type_and_width (tree *type, tree *width, tree orig_name)
if (!in_system_header_at (input_location)
&& type_mv != integer_type_node
&& type_mv != unsigned_type_node
- && type_mv != boolean_type_node)
+ && type_mv != boolean_type_node
+ && !flag_isoc99)
pedwarn (input_location, OPT_Wpedantic,
"type of bit-field %qs is a GCC extension", name);
diff --git a/gcc/doc/implement-c.texi b/gcc/doc/implement-c.texi
index 2ddae63..762ffe0 100644
--- a/gcc/doc/implement-c.texi
+++ b/gcc/doc/implement-c.texi
@@ -479,9 +479,8 @@ by the @option{-funsigned-bitfields} option.
@cite{Allowable bit-field types other than @code{_Bool}, @code{signed int},
and @code{unsigned int} (C99 and C11 6.7.2.1).}
-No other types are permitted in strictly conforming mode.
-@c Would it be better to restrict the pedwarn for other types to C90
-@c mode and document the other types for C99/C11 mode?
+Other integer types, such as @code{long int}, and enumerated types are
+permitted even in strictly conforming mode.
@item
@cite{Whether atomic types are permitted for bit-fields (C11 6.7.2.1).}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 80113ab..075e83e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-06 Marek Polacek <polacek@redhat.com>
+
+ PR c/57773
+ * gcc.dg/pr57773.c: New test.
+
2014-01-06 Adam Butcher <adam@jessamine.co.uk>
PR c++/59635
diff --git a/gcc/testsuite/gcc.dg/pr57773.c b/gcc/testsuite/gcc.dg/pr57773.c
new file mode 100644
index 0000000..1c30950
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr57773.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -Wpedantic" } */
+
+enum e { A };
+struct { enum e b: 2; } s1;
+struct { signed char b: 2; } s2;
+struct { unsigned char b: 2; } s3;
+struct { short b: 2; } s4;
+struct { unsigned short b: 2; } s5;
+struct { long int b: 2; } s6;
+struct { unsigned long int b: 2; } s7;
+struct { long long int b: 2; } s8;
+struct { unsigned long long int b: 2; } s9;