From: Daniel Gustafsson =0A= Date: Wed, 30 Aug 2017 13:13:21 +0200=0A= Subject: [PATCH] Defualt to post-8.1 coding convention for PG_MODULE_MAGIC= =0A= =0A= PG_MODULE_MAGIC has been around since 8.2, with 8.1 long since in=0A= EOL. Default to avoiding the #ifdef test for the macro and instead=0A= turn the documentation around that it may be needed, instead of=0A= saying it can be omitted. Also remove the last remaining #ifdef=0A= tests in the code.=0A= ---=0A= contrib/citext/citext.c | 2 --=0A= doc/src/sgml/plhandler.sgml | 2 --=0A= doc/src/sgml/spi.sgml | 2 --=0A= doc/src/sgml/xfunc.sgml | 17 ++++++++---------=0A= src/test/regress/regress.c | 2 --=0A= 5 files changed, 8 insertions(+), 17 deletions(-)=0A= =0A= diff --git a/contrib/citext/citext.c b/contrib/citext/citext.c=0A= index 04f604b15f..0ba47828ba 100644=0A= --- a/contrib/citext/citext.c=0A= +++ b/contrib/citext/citext.c=0A= @@ -9,9 +9,7 @@=0A= #include "utils/formatting.h"=0A= #include "utils/varlena.h"=0A= =20=0A= -#ifdef PG_MODULE_MAGIC=0A= PG_MODULE_MAGIC;=0A= -#endif=0A= =20=0A= /*=0A= * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= diff --git a/doc/src/sgml/plhandler.sgml b/doc/src/sgml/plhandler.sgml=0A= index 57a2a05ed2..2573e67743 100644=0A= --- a/doc/src/sgml/plhandler.sgml=0A= +++ b/doc/src/sgml/plhandler.sgml=0A= @@ -108,9 +108,7 @@=0A= #include "catalog/pg_proc.h"=0A= #include "catalog/pg_type.h"=0A= =20=0A= -#ifdef PG_MODULE_MAGIC=0A= PG_MODULE_MAGIC;=0A= -#endif=0A= =20=0A= PG_FUNCTION_INFO_V1(plsample_call_handler);=0A= =20=0A= diff --git a/doc/src/sgml/spi.sgml b/doc/src/sgml/spi.sgml=0A= index 86be87c0fd..d04b5a2125 100644=0A= --- a/doc/src/sgml/spi.sgml=0A= +++ b/doc/src/sgml/spi.sgml=0A= @@ -4352,9 +4352,7 @@ INSERT INTO a SELECT * FROM a;=0A= #include "executor/spi.h"=0A= #include "utils/builtins.h"=0A= =20=0A= -#ifdef PG_MODULE_MAGIC=0A= PG_MODULE_MAGIC;=0A= -#endif=0A= =20=0A= int64 execq(text *sql, int cnt);=0A= =20=0A= diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml=0A= index cd6dd840ba..3ee3924acc 100644=0A= --- a/doc/src/sgml/xfunc.sgml=0A= +++ b/doc/src/sgml/xfunc.sgml=0A= @@ -1762,17 +1762,20 @@ CREATE FUNCTION square_root(double precision) RETUR= NS double precision=0A= write this in one (and only one) of the module source files, after hav= ing=0A= included the header fmgr.h:=0A= =20=0A= +=0A= +PG_MODULE_MAGIC;=0A= +=0A= +=0A= + If the code needs to compile against pre-8.2=0A= + PostgreSQL releases, test for the magic blo= ck=0A= + with #ifdef before including:=0A= +=0A= =0A= #ifdef PG_MODULE_MAGIC=0A= PG_MODULE_MAGIC;=0A= #endif=0A= =0A= =20=0A= - The #ifdef test can be omitted if the code doesn't=0A= - need to compile against pre-8.2 PostgreSQL= =0A= - releases.=0A= - =0A= -=0A= =0A= After it is used for the first time, a dynamically loaded object=0A= file is retained in memory. Future calls in the same session to=0A= @@ -2214,9 +2217,7 @@ PG_FUNCTION_INFO_V1(funcname);=0A= #include "fmgr.h"=0A= #include "utils/geo_decls.h"=0A= =20=0A= -#ifdef PG_MODULE_MAGIC=0A= PG_MODULE_MAGIC;=0A= -#endif=0A= =20=0A= /* by value */=0A= =20=0A= @@ -2554,9 +2555,7 @@ SELECT name, c_overpaid(emp, 1500) AS overpaid=0A= #include "postgres.h"=0A= #include "executor/executor.h" /* for GetAttributeByName() */=0A= =20=0A= -#ifdef PG_MODULE_MAGIC=0A= PG_MODULE_MAGIC;=0A= -#endif=0A= =20=0A= PG_FUNCTION_INFO_V1(c_overpaid);=0A= =20=0A= diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c=0A= index 3d33b36e66..734947cc98 100644=0A= --- a/src/test/regress/regress.c=0A= +++ b/src/test/regress/regress.c=0A= @@ -46,9 +46,7 @@=0A= extern PATH *poly2path(POLYGON *poly);=0A= extern void regress_lseg_construct(LSEG *lseg, Point *pt1, Point *pt2);=0A= =20=0A= -#ifdef PG_MODULE_MAGIC=0A= PG_MODULE_MAGIC;=0A= -#endif=0A= =20=0A= =20=0A= /*=0A= --=20=0A= 2.14.1.145.gb3622a4ee=0A= =0A= --Apple-Mail=_2320D1B6-6DDF-42F7-8535-E4B7E875BF5E Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --Apple-Mail=_2320D1B6-6DDF-42F7-8535-E4B7E875BF5E--