Re: Difficulty in implementing a GCC plugin for [[invariant]] contract functions in classes/structs without prior experience?

2022-12-30 Thread Gavin Ray via Gcc
Hey all, I've continued to work on this and have it mostly finished The implementation is here GCC [[invariant]] plugin for Design by Contract (WIP) (github.com) I have posted the final remaining question to StackOverflow in ca

Re: Difficulty in implementing a GCC plugin for [[invariant]] contract functions in classes/structs without prior experience?

2022-12-29 Thread Gavin Ray via Gcc
So I have prototyped the code here, there are two places where I am confused: GCC [[invariant]] plugin for Design by Contract (WIP) (github.com) 1. Is it proper to cast like this? tree args = NULL_TRE

Re: Bug with GCC's handling of lifetimes of implicit-lifetime types

2022-12-11 Thread Gavin Ray via Gcc
t;> On Sun, Dec 11, 2022 at 1:02 PM Jonathan Wakely >> wrote: >> > >> > >> > >> > On Sun, 11 Dec 2022, 09:12 Richard Biener, >> wrote: >> >> >> >> On Sat, Dec 10, 2022 at 7:45 PM Andrew Pinski via Gcc

Re: Bug with GCC's handling of lifetimes of implicit-lifetime types

2022-12-11 Thread Gavin Ray via Gcc
i via Gcc > wrote: > >> > > >> > On Sat, Dec 10, 2022 at 10:36 AM Jonathan Wakely via Gcc > >> > wrote: > >> > > > >> > > On Sat, 10 Dec 2022 at 17:42, Gavin Ray via Gcc > wrote: > >> > > > > >> > >

Re: Bug with GCC's handling of lifetimes of implicit-lifetime types

2022-12-10 Thread Gavin Ray via Gcc
t I don't have the technical background/context to understand the full discussion happening there. On Sat, Dec 10, 2022 at 1:44 PM Andrew Pinski wrote: > On Sat, Dec 10, 2022 at 10:36 AM Jonathan Wakely via Gcc > wrote: > > > > On Sat, 10 Dec 2022 at 17:42, Gavin Ray

Bug with GCC's handling of lifetimes of implicit-lifetime types

2022-12-10 Thread Gavin Ray via Gcc
This came up when I was asking around about what the proper way was to: - Allocate aligned storage for a buffer pool/page cache - Then create pointers to "Page" structs inside of the storage memory area I thought something like this might do: struct buffer_pool { alignas(PAGE_SIZE) std::byte s

Re: Using [[may_alias]] in C23/C++23 on a union works in neither post-"union" position, or at the end of the definition

2022-12-06 Thread Gavin Ray via Gcc
Ah got it, didn't know that (handy, will save me duplicating a bunch of attributes). Thanks Jonathan! On Tue, Dec 6, 2022 at 2:23 PM Jonathan Wakely wrote: > > > On Tue, 6 Dec 2022, 18:36 Gavin Ray via Gcc, wrote: > >> Oh, D'oh! Thanks Joseph, apologies for th

Re: Using [[may_alias]] in C23/C++23 on a union works in neither post-"union" position, or at the end of the definition

2022-12-06 Thread Gavin Ray via Gcc
On Tue, Dec 6, 2022 at 11:54 AM Joseph Myers wrote: > On Mon, 5 Dec 2022, Gavin Ray via Gcc wrote: > > > union [[may_alias]] broken2 {}; > > With [[]] syntax it's [[gnu::may_alias]], since it's not a standard > attribute. > > -- > Joseph S. Myers > jos...@codesourcery.com >

Using [[may_alias]] in C23/C++23 on a union works in neither post-"union" position, or at the end of the definition

2022-12-05 Thread Gavin Ray via Gcc
The reproduction is below. Not sure if this is intended or a bug, sorry to clutter up the mailing list if it's intended! union __attribute__((may_alias)) works {}; // :3:18: note: attribute for 'union broken2' must follow the 'union' keyword union broken1 {} [[may_alias]]; // Okay, so let's move

Re: -fanalyzer: Questions on C vs CPP + use of GCC attr's like malloc()/access()

2022-11-26 Thread Gavin Ray via Gcc
Something like this, or thereabouts: "fd may not be valid (expecting fd >= 0)" On Sat, Nov 26, 2022 at 9:09 AM Jonathan Wakely wrote: > > > > On Fri, 25 Nov 2022, 18:55 Gavin Ray via Gcc, wrote: >> >> >> On a related note, the "fd" analyzers war

Re: -fanalyzer: Questions on C vs CPP + use of GCC attr's like malloc()/access()

2022-11-25 Thread Gavin Ray via Gcc
> Unfortunately not: even fairly simple-looking C++ code can generate extra CFG edges relating to exception-handling ... making the output essentially useless. Ahh, I had figured the answer might be something like this. Thanks for confirming. At least from the small codebase I have, swapping from

-fanalyzer: Questions on C vs CPP + use of GCC attr's like malloc()/access()

2022-11-23 Thread Gavin Ray via Gcc
Hey all, just a few questions about the fantastic GCC Static Analyzer: - It's stated that support for C++ vs C is very limited. Does this apply if you're writing C++ that is very similar-looking to C and uses few of C++'s advanced features? - I noticed that in C++, the "gnu::malloc" attribute