[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2020-02-16 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #30 from Eric Gallager  ---
(In reply to Jakub Jelinek from comment #29)
> Fixed for 8.4+ and 9.3+ too.

As far as I can tell, the commits in question just silenced the main false
positives from that warning that people were complaining about, they didn't
actually create a separate warning flag controlling the warning in question...
I still think that's worth doing anyways.

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2020-02-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |8.4

--- Comment #29 from Jakub Jelinek  ---
Fixed for 8.4+ and 9.3+ too.

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2020-02-14 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #28 from CVS Commits  ---
The releases/gcc-8 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:53073523bca574251d45bded65b2b0c183b01e5d

commit r8-10022-g53073523bca574251d45bded65b2b0c183b01e5d
Author: Jakub Jelinek 
Date:   Fri Feb 14 17:36:00 2020 +0100

c++: Fix thinko in enum_min_precision [PR61414]

When backporting the PR61414 fix to 8.4, I've noticed that the caching
of prec is actually broken, as it would fail to actually store the computed
precision into the hash_map's value and so next time we'd think the enum
needs
0 bits.

2020-02-14  Jakub Jelinek  

PR c++/61414
* class.c (enum_min_precision): Change prec type from int to int &.

* g++.dg/cpp0x/enum39.C: New test.

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2020-02-14 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #27 from CVS Commits  ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:f0a72494ea3747d1f66a0cda3e67a7611779030d

commit r9-8238-gf0a72494ea3747d1f66a0cda3e67a7611779030d
Author: Jakub Jelinek 
Date:   Fri Feb 14 17:36:00 2020 +0100

c++: Fix thinko in enum_min_precision [PR61414]

When backporting the PR61414 fix to 8.4, I've noticed that the caching
of prec is actually broken, as it would fail to actually store the computed
precision into the hash_map's value and so next time we'd think the enum
needs
0 bits.

2020-02-14  Jakub Jelinek  

PR c++/61414
* class.c (enum_min_precision): Change prec type from int to int &.

* g++.dg/cpp0x/enum39.C: New test.

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2020-02-14 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #26 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:519a33f954fd71cb8b74053e168e23a1cb00d30b

commit r10-6637-g519a33f954fd71cb8b74053e168e23a1cb00d30b
Author: Jakub Jelinek 
Date:   Fri Feb 14 17:36:00 2020 +0100

c++: Fix thinko in enum_min_precision [PR61414]

When backporting the PR61414 fix to 8.4, I've noticed that the caching
of prec is actually broken, as it would fail to actually store the computed
precision into the hash_map's value and so next time we'd think the enum
needs
0 bits.

2020-02-14  Jakub Jelinek  

PR c++/61414
* class.c (enum_min_precision): Change prec type from int to int &.

* g++.dg/cpp0x/enum39.C: New test.

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2020-02-14 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #25 from CVS Commits  ---
The releases/gcc-8 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:22a7fa8517063c76b069d2b08dca5a9d270798f8

commit r8-9985-g22a7fa8517063c76b069d2b08dca5a9d270798f8
Author: Jakub Jelinek 
Date:   Fri Feb 14 12:45:30 2020 +0100

backport: re PR c++/61414 (enum class bitfield size-checking needs a
separate warning flag controlling it)

Backported from mainline
2019-11-26  Jakub Jelinek  

PR c++/61414
* c-attribs.c (handle_mode_attribute): Add mode attribute to
ENUMERAL_TYPEs.

* class.c (enum_to_min_precision): New hash_map.
(enum_min_precision): New function.
(check_bitfield_decl): Use it.

* g++.dg/cpp0x/enum23.C: Remove xfail.
* g++.dg/cpp0x/enum28.C: New test.

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2019-12-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #24 from Jakub Jelinek  ---
Author: jakub
Date: Fri Dec 20 17:00:02 2019
New Revision: 279654

URL: https://gcc.gnu.org/viewcvs?rev=279654=gcc=rev
Log:
Backported from mainline
2019-11-26  Jakub Jelinek  

PR c++/61414
* c-attribs.c (handle_mode_attribute): Add mode attribute to
ENUMERAL_TYPEs.

* class.c (enum_to_min_precision): New hash_map.
(enum_min_precision): New function.
(check_bitfield_decl): Use it.

* g++.dg/cpp0x/enum23.C: Remove xfail.
* g++.dg/cpp0x/enum28.C: New test.

Added:
branches/gcc-9-branch/gcc/testsuite/g++.dg/cpp0x/enum38.C
Modified:
branches/gcc-9-branch/gcc/c-family/ChangeLog
branches/gcc-9-branch/gcc/c-family/c-attribs.c
branches/gcc-9-branch/gcc/cp/ChangeLog
branches/gcc-9-branch/gcc/cp/class.c
branches/gcc-9-branch/gcc/testsuite/ChangeLog
branches/gcc-9-branch/gcc/testsuite/g++.dg/cpp0x/enum23.C

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2019-11-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #23 from Jakub Jelinek  ---
Author: jakub
Date: Tue Nov 26 21:57:27 2019
New Revision: 278736

URL: https://gcc.gnu.org/viewcvs?rev=278736=gcc=rev
Log:
PR c++/61414
* c-attribs.c (handle_mode_attribute): Add mode attribute to
ENUMERAL_TYPEs.

* class.c (enum_to_min_precision): New hash_map.
(enum_min_precision): New function.
(check_bitfield_decl): Use it.

* g++.dg/cpp0x/enum23.C: Remove xfail.
* g++.dg/cpp0x/enum28.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/enum38.C
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-attribs.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/class.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/enum23.C

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2019-11-25 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

Eric Gallager  changed:

   What|Removed |Added

URL||https://gcc.gnu.org/ml/gcc-
   ||patches/2019-11/msg02329.ht
   ||ml

--- Comment #22 from Eric Gallager  ---
Patch discussion on the gcc-patches mailing list starts here for this month:
https://gcc.gnu.org/ml/gcc-patches/2019-11/msg02329.html

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2019-11-25 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #21 from Jakub Jelinek  ---
Created attachment 47352
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47352=edit
gcc10-pr61414.patch

Untested fix.

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2019-11-23 Thread kokuam at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

Alexander Kokushkin  changed:

   What|Removed |Added

 CC||kokuam at hotmail dot com

--- Comment #20 from Alexander Kokushkin  ---
Unfortunately, it's still present in 9.2.0 and quite painful.

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2019-11-04 Thread david.bolvansky at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #19 from Dávid Bolvanský  ---
5 years...
Can anybody fix it? It is real issue on real world code:


https://reviews.llvm.org/D69792

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2019-10-29 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

Eric Gallager  changed:

   What|Removed |Added

 CC||david.bolvansky at gmail dot 
com

--- Comment #18 from Eric Gallager  ---
*** Bug 92182 has been marked as a duplicate of this bug. ***

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2019-04-25 Thread barry.revzin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

Barry Revzin  changed:

   What|Removed |Added

 CC||barry.revzin at gmail dot com

--- Comment #17 from Barry Revzin  ---
Hi, it's me, another programmer who would love to use enum classes in bitfields
instead of having to static_cast back and forth :-) Can anybody fixup Sam's
patch?

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2018-10-18 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #16 from Jonathan Wakely  ---
Sam, did you get a chance to implement the changes requested on the mailing
list?

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2018-10-18 Thread xavierb at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #15 from Xavier B  ---
hi,

Just a ping for this issue.

Since it's about declarations and it is not possible to disable it,
as soon as you have headers files using the feature you get flooded with
thousands of warnings making it impossible to see the other actually useful
warnings...

[Bug c++/61414] enum class bitfield size-checking needs a separate warning flag controlling it

2017-10-16 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=39170
 Blocks||44209
Summary|enum class bitfield |enum class bitfield
   |size-checking failure   |size-checking needs a
   ||separate warning flag
   ||controlling it

--- Comment #14 from Eric Gallager  ---
(In reply to Jonathan Wakely from comment #7)
> At the very least there should be a -Wxxx switch controlling this option so
> it can be disabled.

Agreed, that falls under bug 44209; retitling this one accordingly.

(In reply to Sam van Kampen from comment #13)
> I've sent a patch that adds the warning flag -Wbitfield-enum-conversion to
> gcc-patches, and the gcc mailing list now also has a thread on the bug, and
> I thought I might share them on the bug tracker:
> 
> The patch:
> https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00989.html
> 
> The thread on the bug:
> https://gcc.gnu.org/ml/gcc/2017-10/msg00121.html

The name chosen for the flag makes it sound kinda related to bug 39170 but I
guess the "enum" in the middle is enough of a differentiator.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44209
[Bug 44209] [meta-bug] Some warnings are not linked to diagnostics options