[C++ PATCH] Fix pretty-print of enumerator ids (PR c++/87364)

2018-10-08 Thread will wray
Hi, A PR to fix Bug 87364 - Pretty print of enumerator never prints the id, always falls back to C-style cast output The fix is tested with the code attached to the bug report and additional usage over the past few weeks. Bootstrap and regtested on x86_64-linux. OK for trunk? 2018-10-08 Will

Re: [C++ PATCH] Fix pretty-print of enumerator ids (PR c++/87364)

2018-10-12 Thread will wray
Lyon > wrote: > > > > On Fri, 12 Oct 2018 at 05:37, Jeff Law wrote: > > > > > > On 10/8/18 11:12 AM, will wray wrote: > > > > Hi, > > > > > > > > A PR to fix Bug 87364 - Pretty print of enumerator never prints the > id, > > &

Re: [C++ PATCH] preview: Fix braces around scalar initializer (C++/88572) Inbox x

2019-02-20 Thread will wray
please review for inclusion on trunk and possible backports. I've stressed the patch with my own code which does SFINAE on these errors; all is working as expected, portable with Clang trunk. It bootstraps and regtests for me on x86_64-linux. On Fri, Feb 15, 2019 at 11:15 PM Jason Merrill

[C++ PATCH] preview: Fix braces around scalar initializer (C++/88572) Inbox x

2019-02-12 Thread will wray
A proposed patch for Bug 88572 is attached to the bug report along with a short description and Change Log (a link there gives a pretty diff of the patch): https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88572#c15 I'd appreciate any review of this patch, as well as testing on more platforms. The pat

Re: [PATCH] c++: designated init of char array by string constant [PR55227]

2021-11-17 Thread will wray via Gcc-patches
Thanks for the review Marek; I'll post the updated patch in a follow-on message and on bugzilla. On Mon, Nov 15, 2021 at 8:03 PM Marek Polacek wrote: > I also noticed the C++ FE rejects > > struct A { char x[4]; }; > struct B { struct A a; }; > struct B b = { .a.x = "abc" }; > but the C FE

Re: [PATCH] c++: designated init of char array by string constant [PR55227]

2021-11-17 Thread will wray via Gcc-patches
V2 Patch https://gcc.gnu.org/bugzilla/attachment.cgi?id=51828 On Wed, Nov 17, 2021 at 10:06 PM will wray wrote: > > Thanks for the review Marek; > I'll post the updated patch in a follow-on message and on bugzilla. > > On Mon, Nov 15, 2021 at 8:03 PM Marek Polacek wrote:

[PATCH v2] c++: designated init of char array by string constant [PR55227]

2021-11-18 Thread Will Wray via Gcc-patches
Also address "FIXME: this code is duplicated from reshape_init" in cp_complete_array_type by always calling reshape_init on init-list. PR c++/55227 gcc/cp/ChangeLog: * decl.c (reshape_init_r): Only call has_designator_check when first_initializer_p or for the inner constru

Re: [PATCH] c++: designated init of char array by string constant [PR55227]

2021-11-18 Thread will wray via Gcc-patches
V2 Patch mailing list post https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584897.html On Thu, Nov 18, 2021 at 10:36 AM Marek Polacek wrote: > > On Wed, Nov 17, 2021 at 10:23:58PM -0500, will wray wrote: > > V2 Patch > > https://gcc.gnu.org/bugzilla/attachment.cgi?id

[PATCH 0/3] P1997 'array-copy' patchset [PR103238]

2021-11-21 Thread Will Wray via Gcc-patches
'what the code does', and then to go ahead with ABI work. Will Wray (3): c++: designated init of char array by string constant [PR55227] c++: P1997 array-copy extensions: Initialization [PR103238] c++: P1997 array-copy extensions: Assignment, return, etc. [PR103238] gcc/c-family/c-c

[PATCH 1/3] c++: designated init of char array by string constant [PR55227]

2021-11-21 Thread Will Wray via Gcc-patches
Also address "FIXME: this code is duplicated from reshape_init" in cp_complete_array_type by always calling reshape_init on init-list. PR c++/55227 gcc/cp/ChangeLog: * decl.c (reshape_init_r): Only call has_designator_check when first_initializer_p or for the inner constru

[PATCH 2/3] c++: P1997 array-copy extensions: Initialization [PR103238]

2021-11-21 Thread Will Wray via Gcc-patches
This patch implements initializations of arrays from array values. The first of two 'array-copy' patches, it adds the option -farray-copy (flag_array_copy) to enable all features of P1997 (copy related or not), documented as experimental extensions. It deals with initialization of array variables

[PATCH 3/3] c++: P1997 array-copy extensions: Assignment, return, etc. [PR103238]

2021-11-21 Thread Will Wray via Gcc-patches
This second patch completes the work of the first 'array-copy' patch to provide first-cut implementations of all P1997 features. It adds: * Assignments to arrays from array values,a = b; * Placeholder auto in array declarations, auto cp[] = a; * Array as a return type from functions WIP

Re: [PATCH] c++: __builtin_bit_cast To C array target type [PR103140]

2021-11-22 Thread will wray via Gcc-patches
Ping. Another use case; casting arrays of char to arrays of unsigned char (useful in some crypto APIs). On Mon, Nov 15, 2021 at 6:32 PM will wray wrote: > > Yes - direct use of any builtin is not to be encouraged, in user code. > > This __builtin_bit_cast patch is intended

Re: [PATCH 3/3] c++: P1997 array-copy extensions: Assignment, return, etc. [PR103238]

2021-11-22 Thread will wray via Gcc-patches
On Mon, Nov 22, 2021 at 3:42 PM Joseph Myers wrote: > > On Sun, 21 Nov 2021, Will Wray via Gcc-patches wrote: > > > gcc/c/ChangeLog: > > > > * c-decl.c (grokdeclarator): Don't complain of array returns. > > A C front-end change like this doesn'

[PATCH] c++ PR 55227: designated init of char array by string constant

2021-11-04 Thread will wray via Gcc-patches
This patch aims to fix PR 55227; two underlying bugs that have caused: (1) Rejection of valid designated initialization of char array fields by string literals (a) when enclosed in optional braces or (b) unbraced when the string literal is shorter than the target char array field. (2) Acceptance

[PATCH] c++: designated init of char array by string constant [PR55227]

2021-11-06 Thread Will Wray via Gcc-patches
This patch aims to fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55227. There are two underlying bugs in the designated initialization of char array fields by string literals that cause: (1) Rejection of valid cases with: (a) brace-enclosed string literal initializer (of any valid size), or

[PATCH] c++: __builtin_bit_cast To C array target type [PR103140]

2021-11-08 Thread Will Wray via Gcc-patches
This patch allows __builtin_bit_cast to materialize a C array as its To type. It was developed as part of an implementation of P1997, array copy-semantics, but is independent, so makes sense to submit, review and merge ahead of it. gcc/cp/ChangeLog: * constexpr.c (check_bit_cast_type): h

Re: [PATCH] c++: __builtin_bit_cast To C array target type [PR103140]

2021-11-15 Thread will wray via Gcc-patches
s same sizeof" ); using bytes = unsigned char[sizeof(A)]; return __builtin_memcmp( __builtin_bit_cast(bytes,a), __builtin_bit_cast(bytes,b), sizeof(A)) == 0; } On Mon, Nov 8, 2021 at 3:03 PM Will Wray wrote: > > This patch allo

PING: [PATCH] c++: designated init of char array by string constant [PR55227]

2021-11-15 Thread will wray via Gcc-patches
The fixes test out, as does the FIXME that's fixed based on the fixes... Note that the bug causes bogus rejection of any designated initialization of char array from a string literal, except for the singular case where the string literal initializer size exactly matches the target char array size

Re: [PATCH] c++: __builtin_bit_cast To C array target type [PR103140]

2021-11-15 Thread will wray via Gcc-patches
2021 at 12:21 PM Jakub Jelinek wrote: > > On Mon, Nov 15, 2021 at 12:12:22PM -0500, will wray via Gcc-patches wrote: > > One motivation for allowing builtin bit_cast to builtin array is that > > it enables direct bitwise constexpr comparisons via memcmp: > > > >

[PATCH v3] c++: designated init of char array by string constant [PR55227]

2022-01-17 Thread will wray via Gcc-patches
V3 addresses Jason's review point - it.undoes unnecessary variable renames (back from arr_init to str_init) Also address "FIXME: this code is duplicated from reshape_init" in cp_complete_array_type by always calling reshape_init on init-list. PR c++/55227 gcc/cp/ChangeLog: * decl.c (reshape_in

Re: [PATCH v3] c++: designated init of char array by string constant [PR55227]

2022-01-17 Thread will wray via Gcc-patches
Attached (the cut n paste looks like it removed some whitespace formatting) 0001-c-designated-init-of-char-array-by-string-constant-P.patch Description: Binary data