Re: Raising our compiler requirements for 9.6 - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Raising our compiler requirements for 9.6
Date
Msg-id 20150817165426.GD10786@awork2.anarazel.de
Whole thread Raw
In response to Re: Raising our compiler requirements for 9.6  (Robert Haas <robertmhaas@gmail.com>)
List 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
aboolean 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(HeapTupletup, 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
hasno 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
hasno 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
hasno 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’
makespointer 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
isof type ‘bool {aka char}’extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,             ^
 



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Raising our compiler requirements for 9.6
Next
From: David Fetter
Date:
Subject: More WITH