postgresql/src/backend
Peter Eisentraut a5abacecb4 Fix -Wcast-function-type warnings
Three groups of issues needed to be addressed:

load_external_function() and related functions returned PGFunction,
even though not necessarily all callers are looking for a function of
type PGFunction.  Since these functions are really just wrappers
around dlsym(), change to return void * just like dlsym().

In dynahash.c, we are using strlcpy() where a function with a
signature like memcpy() is expected.  This should be safe, as the new
comment there explains, but the cast needs to be augmented to avoid
the warning.

In PL/Python, methods all need to be cast to PyCFunction, per Python
API, but this now runs afoul of these warnings.  (This issue also
exists in core CPython.)

To fix the second and third case, we add a new type pg_funcptr_t that
is defined specifically so that gcc accepts it as a special function
pointer that can be cast to any other function pointer without the
warning.

Also add -Wcast-function-type to the standard warning flags, subject
to configure check.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/1e97628e-6447-b4fd-e230-d109cec2d584%402ndquadrant.com
(cherry picked from commit de8feb1f3a)

Author: Peter Eisentraut <peter@eisentraut.org>
Author: Alexandra Wang <alexandra.wang.oss@gmail.com>
2024-11-08 09:42:21 +10:30
..
access Revert "For inplace update, send nontransactional invalidations." 2024-11-02 09:05:07 -07:00
bootstrap Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
catalog Suppress new "may be used uninitialized" warning. 2024-11-02 19:42:57 -07:00
commands Restructure foreign key handling code for ATTACH/DETACH 2024-10-22 16:01:18 +02:00
executor Remove unnecessary word in a comment 2024-10-23 17:55:35 +09:00
foreign Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:20 -07:00
jit Monkey-patch LLVM code to fix ARM relocation bug. 2024-11-06 23:10:05 +13:00
lib Fix lock assertions in dshash.c. 2022-07-11 15:48:54 +12:00
libpq Fix regression in TLS session ticket disabling 2024-08-19 12:55:11 +02:00
main Fix outdated --help message for postgres -f 2022-08-15 13:37:40 +09:00
nodes Further fixes for MULTIEXPR_SUBLINK fix. 2022-09-06 16:38:18 -04:00
optimizer Correctly identify which EC members are computable at a plan node. 2024-10-12 14:56:08 -04:00
parser Remove incorrect Assert. 2024-09-11 11:42:19 -04:00
partitioning Fix creation of partition descriptor during concurrent detach+drop 2024-08-12 18:17:56 -04:00
po Translation updates 2024-08-05 12:23:51 +02:00
port Close socket in case of errors in setting non-blocking 2024-01-17 11:24:11 +01:00
postmaster Avoid deadlock during orphan temp table removal. 2024-04-02 14:59:04 -04:00
regex Avoid character classification in regex escape parsing. 2023-04-21 08:20:47 -07:00
replication Revert "For inplace update, send nontransactional invalidations." 2024-11-02 09:05:07 -07:00
rewrite Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:20 -07:00
snowball In the Snowball dictionary, don't try to stem excessively-long words. 2022-08-31 10:42:05 -04:00
statistics Fix incorrectly reported stats kind in "can't happen" ERROR 2024-03-05 16:19:05 +13:00
storage At end of recovery, reset all sinval-managed caches. 2024-10-25 06:51:08 -07:00
tcop Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:20 -07:00
tsearch Limit to_tsvector_byid's initial array allocation to something sane. 2023-09-25 11:50:28 -04:00
utils Fix -Wcast-function-type warnings 2024-11-08 09:42:21 +10:30
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nls.mk Translation updates 2020-09-14 13:14:53 +02:00