pg_ctl: Error out on Windows-only options on other platforms

Several pg_ctl command-line options are used only on Windows, but
pg_ctl accepted them anyway on all platforms but didn't do anything
with them.

This commit changes it to report an error if an option is specified
but the platform doesn't make use of it.  The affected options are -e,
-N, -P, -U.  The option -S already errored out on non-Windows
platforms; the new behavior of the other options is aligned with that.

The --help output already didn't list these options on non-Windows
builds, so the fact that they were accepted silently was already
inconsistent.  The man page already lists them as "Options for
Windows".

Several global variables that were set but then only read on Windows,
are now in #ifdef WIN32 blocks.  This avoids -Wunused-but-set-global
warnings that the new clang 23 enables via -Wall.

Reviewed-by: Andreas Karlsson <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/eb013f9d-2247-444e-8815-9d17b4ce78e7%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6a1c1102c4a36c4b80bba4a46f1ad8c125f8dd4e

Modified Files
--------------
src/bin/pg_ctl/pg_ctl.c | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)

Reply via email to