Re: Enable -Wstrict-prototypes and -Wold-style-definition by default - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Enable -Wstrict-prototypes and -Wold-style-definition by default
Date
Msg-id 784253.1773853383@sss.pgh.pa.us
Whole thread Raw
In response to Re: Enable -Wstrict-prototypes and -Wold-style-definition by default  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
Responses Re: Enable -Wstrict-prototypes and -Wold-style-definition by default
Re: Enable -Wstrict-prototypes and -Wold-style-definition by default
List pgsql-hackers
Nazir Bilal Yavuz <byavuz81@gmail.com> writes:
> I got this warning while running headerscheck after this commit:

> ~/Desktop/projects/postgres/src/interfaces/ecpg/ecpglib/ecpglib_extern.h:221:40:
> warning: function declaration isn’t a prototype [-Wstrict-prototypes]
>   221 | void            ecpg_init_sqlca(struct sqlca_t *sqlca)

Yeah, I see that too.  I believe the problem is that headerscheck
doesn't cause POSTGRES_ECPG_INTERNAL to become defined, so that
what the compiler is seeing is (from sqlca.h):

    #ifndef POSTGRES_ECPG_INTERNAL
    #define sqlca (*ECPGget_sqlca())
    #endif

and then

    void        ecpg_init_sqlca(struct sqlca_t *sqlca);

Kinda surprising that that's not a syntax error.  We could plausibly
fix this either by

(1) renaming ecpg_init_sqlca's parameter to something else;

(2) ensuring that POSTGRES_ECPG_INTERNAL is defined.  I'd be inclined
to make ecpglib_extern.h do that rather than expecting headerscheck
to know about it.

Neither of these options are beautiful, but perhaps #1 is slightly
less ugly.  Any preferences?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: Don't synchronously wait for already-in-progress IO in read stream
Next
From: Robert Haas
Date:
Subject: Re: pg_plan_advice