Thread: Peter opens a can of worms

Peter opens a can of worms

From
Tom Lane
Date:
Peter E writes (in elog.h):

+ #ifndef __GNUC__ extern void elog(int lev, const char *fmt, ...);
+ #else
+ /* This extension allows gcc to check the format string for consistency with
+    the supplied arguments. */
+ extern void elog(int lev, const char *fmt, ...) __attribute__ ((format (printf
, 2, 3)));
+ #endif

Cool.  Now who's going to fix the cartload of warnings this has
produced?  I'm counting about 125 of them.  They should be fixed,
on grounds of portability, but the main problem right now is that
it's difficult to see the *real* warnings because of all these
guys...
        regards, tom lane


Re: Peter opens a can of worms

From
Tom Lane
Date:
I wrote:
> Cool.  Now who's going to fix the cartload of warnings this has
> produced?  I'm counting about 125 of them.

On further investigation, it seems that some of these warnings are
real portability issues (pointers being printed as ints, etc).
But a very considerable fraction are bogus.  gcc doesn't know about
elog's "%m" extension to the standard %-format set, and it seems to
be assuming that there should be a parameter to go with the %m.

I have a feeling we will have to revert this change...
        regards, tom lane


Re: [HACKERS] Re: Peter opens a can of worms

From
Peter Eisentraut
Date:
Boy, those worms were just waiting to come out ...

On 2000-01-13, Tom Lane mentioned:

> I wrote:
> > Cool.  Now who's going to fix the cartload of warnings this has
> > produced?  I'm counting about 125 of them.

All fixed. (good count by the way ;)

> 
> On further investigation, it seems that some of these warnings are
> real portability issues (pointers being printed as ints, etc).

Actually about a quarter of these were definitely problems, with a handful
of rather serious bugs (depends on how serious this can become, of
course).

> But a very considerable fraction are bogus.  gcc doesn't know about

Actually going through them there were certainly a few harmless ones (such
as too many arguments), but exactly zero were completely bogus. Especially
too many arguments might point out a typo.

> elog's "%m" extension to the standard %-format set, and it seems to
> be assuming that there should be a parameter to go with the %m.

%m is a GNU extension (so they claim). (And even if it weren't, there's a
way to "register" non-standard format conversions.)

> I have a feeling we will have to revert this change...

I'd ask you to reconsider. Especially with the multitude of typdefs we
have you never know for sure what format to use. As I said, a number of
these warnings actually had a good cause.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




Re: [HACKERS] Re: Peter opens a can of worms

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> writes:
> On 2000-01-13, Tom Lane mentioned:
>> I have a feeling we will have to revert this change...

> I'd ask you to reconsider.

If you found a solution to the %m issue, I'm a happy camper.  I thought
all the too-many-arguments gripes were because of %m, but evidently
I was mistaken.  Good work!
        regards, tom lane