Re: Patch: Remove gcc dependency in definition of inline functions - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Patch: Remove gcc dependency in definition of inline functions
Date
Msg-id 1263916887.27134.8.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: Patch: Remove gcc dependency in definition of inline functions  (Kurt Harriman <harriman@acm.org>)
Responses Re: Patch: Remove gcc dependency in definition of inline functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Patch: Remove gcc dependency in definition of inline functions  (Kurt Harriman <harriman@acm.org>)
List pgsql-hackers
On tis, 2010-01-19 at 01:29 -0800, Kurt Harriman wrote:
> On 1/18/2010 11:48 PM, Peter Eisentraut wrote:
> We have some existing inline functions in .c files.  These can be
> more complicated, so it might be ok if the compiler decides to
> leave them out-of-line.  And they are never unreferenced, so
> suppression of unused-function warnings is not necessary and
> perhaps not wanted.  To leave these functions undisturbed, my patch
> doesn't redefine the "inline" keyword; instead it adds a new #define
> PG_INLINE for use in header files where unused-function warnings
> need to be suppressed.

One principle that I suppose should have been made more explicit is that
-- in my mind -- we should avoid littering our code with nonstandard
constructs in place of standard constructs.  Because the next generation
of developers won't know what PG_INLINE is and why we're not using plain
inline, even if we document it somewhere.

That said, ...

> > Is there not a setting to disable this particular warning.  I read that
> > MSVC has various ways to set that sort of thing.
> 
> Yes, warnings can be turned off by a #pragma specifying the
> warning number.

> Or compiler switches could be set to disable all such warnings
> globally.  Warning 4514 is specific to inline functions; so
> maybe it would be alright to keep it turned off globally.

... I think that would exactly be the right solution.

Then just replace in those two locations __GNUC__ by __GNUC__ ||
__MSVC__ (or whatever the symbol is).  Or if you want to make it extra
nice, create a symbol somewhere like in c.h that reads

#define USE_INLINE __GNUC__ || __MSVC__



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Git out of sync vs. CVS
Next
From: Magnus Hagander
Date:
Subject: Re: Git out of sync vs. CVS