postgresql/src/backend
Peter Eisentraut a3ea5330fc Fix "inconsistent DLL linkage" warning on Windows MSVC
This warning was disabled in meson.build (warning 4273).  If you
enable it, it looks like this:

../src/backend/utils/misc/ps_status.c(27): warning C4273: '__p__environ': inconsistent dll linkage
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdlib.h(1158): note: see previous definition of '__p__environ'

The declaration in ps_status.c was:

    #if !defined(WIN32) || defined(_MSC_VER)
    extern char **environ;
    #endif

The declaration in the OS header file is:

    _DCRTIMP char***    __cdecl __p__environ (void);
    #define _environ  (*__p__environ())

So it is evident that this could be problematic.

The old declaration was required by the old MSVCRT library, but we
don't support that anymore with MSVC.

To fix, disable the re-declaration in ps_status.c, and also in some
other places that use the same code pattern but didn't trigger the
warning.

Then we can also re-enable the warning (delete the disablement in
meson.build).

Reviewed-by: Bryan Green <dbryan.green@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/bf060644-47ff-441b-97cf-c685d0827757@eisentraut.org
2025-11-07 10:14:25 +01:00
..
access Use XLogRecPtrIsValid() in various places 2025-11-06 20:33:57 +01:00
archive Update copyright for 2025 2025-01-01 11:21:55 -05:00
backup Use XLogRecPtrIsValid() in various places 2025-11-06 20:33:57 +01:00
bootstrap Add new OID alias type regdatabase. 2025-06-30 15:38:54 -05:00
catalog Add seq_sync_error_count to subscription statistics. 2025-11-07 08:05:08 +00:00
commands Tidyup WARNING ereports in subscriptioncmds.c 2025-11-07 09:50:02 +13:00
executor Update obsolete comment in ExecScanReScan(). 2025-11-06 12:25:00 +09:00
foreign Track the number of presorted outer pathkeys in MergePath 2025-05-08 18:21:32 +09:00
jit jit: Fix accidentally-harmless type confusion 2025-11-04 20:03:53 -05:00
lib Add pairingheap_initialize() for shared memory usage 2025-11-05 11:44:13 +02:00
libpq Remove hbaPort type 2025-09-15 11:04:10 +02:00
main Avoid possible crash within libsanitizer. 2025-11-05 11:09:45 -05:00
nodes Fix some confusing uses of const 2025-10-30 11:20:04 +01:00
optimizer Fix UNION planner estimate_num_groups with varno==0 2025-11-06 16:34:55 +13:00
parser Implement WAIT FOR command 2025-11-05 11:44:13 +02:00
partitioning Mark function arguments of type "Datum *" as "const Datum *" where possible 2025-10-31 10:47:25 +01:00
po Translation updates 2025-05-05 12:04:49 +02:00
port Refactor shared memory allocation for semaphores 2025-11-06 14:45:00 +02:00
postmaster Fix "inconsistent DLL linkage" warning on Windows MSVC 2025-11-07 10:14:25 +01:00
regex Special case C_COLLATION_OID in pg_newlocale_from_collation(). 2025-11-04 16:48:16 -08:00
replication Add seq_sync_error_count to subscription statistics. 2025-11-07 08:05:08 +00:00
rewrite Fix comments for ChangeVarNodes() and related functions 2025-11-05 12:29:31 +09:00
snowball Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
statistics Document some structures in attribute_stats.c 2025-11-06 16:22:12 +09:00
storage bufmgr: Use atomic sub for unpinning buffers 2025-11-06 16:43:16 -05:00
tcop Implement WAIT FOR command 2025-11-05 11:44:13 +02:00
tsearch Mark function arguments of type "Datum *" as "const Datum *" where possible 2025-10-31 10:47:25 +01:00
utils Fix "inconsistent DLL linkage" warning on Windows MSVC 2025-11-07 10:14:25 +01:00
.gitignore
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile aio: Add liburing dependency 2025-03-26 19:45:32 -04:00
meson.build meson: add and use stamp files for generated headers 2025-08-11 15:18:23 -04:00
nls.mk Create a separate file listing backend types 2025-09-26 15:21:49 +02:00