Re: [RFC] Clang plugin for catching suspicious typedef casting

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: Tristan Partin <tristan(at)neon(dot)tech>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [RFC] Clang plugin for catching suspicious typedef casting
Date: 2023-12-03 14:27:47
Message-ID: 20231203142747.ihghenhq36pihlnx@erthalion.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Fri, Dec 01, 2023 at 04:01:05PM -0600, Tristan Partin wrote:
> On Fri Aug 4, 2023 at 5:47 AM CDT, Dmitry Dolgov wrote:
> > > On Thu, Aug 03, 2023 at 12:23:52PM -0500, Tristan Partin wrote:
> > >
> > > This is the first I am learning about clang plugins. Interesting concept.
> > > Did you give any thought to using libclang instead of a compiler plugin? I
> > > am kind of doing similar work, but I went with libclang instead of a plugin.
> >
> > Nope, never thought about trying libclang. From the clang documentation
> > it seems a plugin is a suitable interface if one wants to:
> >
> > special lint-style warnings or errors for your project
> >
> > Which is what I was trying to achieve. Are there any advantages of
> > libclang that you see?
>
> Only advantage I see to using libclang is that you can run programs built
> with libclang regardless of what your C compiler is. I typically use GCC.
>
> I think your idea of automating this kind of thing is great no matter how it
> is implemented.

Yeah, absolutely.

Sorry, haven't had a chance to follow up on the patch, but I'm planing
to do so. I guess the important part, as Peter mentioned above in the
thread, is to figure out more use cases which could be usefully
augmented with such compile time checks. At the moment I don't have any
other except BlockNumber vs Buffer, so I'm going to search through the
hackers looking for more potential targets. If anyone got a great idea
right away about where compile-time checks could be useful, feel free to
share!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2023-12-03 14:41:47 Re: Refactoring backend fork+exec code
Previous Message Dmitry Dolgov 2023-12-03 14:14:44 Re: Schema variables - new implementation for Postgres 15