Re: Raising our compiler requirements for 9.6

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Raising our compiler requirements for 9.6
Date: 2015-08-17 16:54:26
Message-ID: 20150817165426.GD10786@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-08-17 12:30:56 -0400, Robert Haas wrote:
> As far as I can see, the anticipated benefits of what we're doing here are:
>
> - Get a cleaner separation of frontend and backend headers (this could
> also be done independently of STATIC_IF_INLINE, but removing
> STATIC_IF_INLINE increases the urgency).
> - Eliminate multiple evaluations hazards.
> - Modest improvements to code generation.

Plus:
* Not having 7k long macros, that e.g. need extra flags to even be
supported. C.f. http://archives.postgresql.org/message-id/4407.1435763473%40sss.pgh.pa.us
* Easier development due to actual type checking and such. Compare the
errors from heap_getattr as a macro being passed a boolean with the
same from an inline function: Inline:

/home/andres/src/postgresql/src/backend/executor/spi.c: In function ‘SPI_getvalue’:
/home/andres/src/postgresql/src/backend/executor/spi.c:883:46: error: incompatible type for argument 4 of ‘heap_getattr’
val = heap_getattr(tuple, fnumber, tupdesc, isnull);
^
In file included from /home/andres/src/postgresql/src/backend/executor/spi.c:17:0:
/home/andres/src/postgresql/src/include/access/htup_details.h:765:1: note: expected ‘_Bool *’ but argument is of type ‘_Bool’
heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
^

Macro:

In file included from /home/andres/src/postgresql/src/backend/executor/spi.c:17:0:
/home/andres/src/postgresql/src/backend/executor/spi.c: In function ‘SPI_getvalue’:
/home/andres/src/postgresql/src/include/access/htup_details.h:750:6: error: invalid type argument of unary ‘*’ (have ‘int’)
(*(isnull) = true), \
^
/home/andres/src/postgresql/src/backend/executor/spi.c:883:8: note: in expansion of macro ‘heap_getattr’
val = heap_getattr(tuple, fnumber, tupdesc, isnull);
^
/home/andres/src/postgresql/src/include/access/htup_details.h:750:23: warning: left-hand operand of comma expression has no effect [-Wunused-value]
(*(isnull) = true), \
^
/home/andres/src/postgresql/src/backend/executor/spi.c:883:8: note: in expansion of macro ‘heap_getattr’
val = heap_getattr(tuple, fnumber, tupdesc, isnull);
^
/home/andres/src/postgresql/src/include/access/htup_details.h:697:3: error: invalid type argument of unary ‘*’ (have ‘int’)
(*(isnull) = false), \
^
/home/andres/src/postgresql/src/include/access/htup_details.h:754:5: note: in expansion of macro ‘fastgetattr’
fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
^
/home/andres/src/postgresql/src/backend/executor/spi.c:883:8: note: in expansion of macro ‘heap_getattr’
val = heap_getattr(tuple, fnumber, tupdesc, isnull);
^
/home/andres/src/postgresql/src/include/access/htup_details.h:713:5: error: invalid type argument of unary ‘*’ (have ‘int’)
(*(isnull) = true), \
^
/home/andres/src/postgresql/src/include/access/htup_details.h:754:5: note: in expansion of macro ‘fastgetattr’
fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
^
/home/andres/src/postgresql/src/backend/executor/spi.c:883:8: note: in expansion of macro ‘heap_getattr’
val = heap_getattr(tuple, fnumber, tupdesc, isnull);
^
/home/andres/src/postgresql/src/include/access/htup_details.h:713:22: warning: left-hand operand of comma expression has no effect [-Wunused-value]
(*(isnull) = true), \
^
/home/andres/src/postgresql/src/include/access/htup_details.h:754:5: note: in expansion of macro ‘fastgetattr’
fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
^
/home/andres/src/postgresql/src/backend/executor/spi.c:883:8: note: in expansion of macro ‘heap_getattr’
val = heap_getattr(tuple, fnumber, tupdesc, isnull);
^
/home/andres/src/postgresql/src/include/access/htup_details.h:697:21: warning: left-hand operand of comma expression has no effect [-Wunused-value]
(*(isnull) = false), \
^
/home/andres/src/postgresql/src/include/access/htup_details.h:754:5: note: in expansion of macro ‘fastgetattr’
fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
^
/home/andres/src/postgresql/src/backend/executor/spi.c:883:8: note: in expansion of macro ‘heap_getattr’
val = heap_getattr(tuple, fnumber, tupdesc, isnull);
^
/home/andres/src/postgresql/src/include/access/htup_details.h:757:50: warning: passing argument 4 of ‘heap_getsysattr’ makes pointer from integer without a cast [-Wint-conversion]
heap_getsysattr((tup), (attnum), (tupleDesc), (isnull)) \
^
/home/andres/src/postgresql/src/backend/executor/spi.c:883:8: note: in expansion of macro ‘heap_getattr’
val = heap_getattr(tuple, fnumber, tupdesc, isnull);
^
/home/andres/src/postgresql/src/include/access/htup_details.h:771:14: note: expected ‘bool * {aka char *}’ but argument is of type ‘bool {aka char}’
extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
^

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2015-08-17 17:18:33 More WITH
Previous Message Andres Freund 2015-08-17 16:36:43 Re: Raising our compiler requirements for 9.6