Opened 8 years ago

Closed 8 years ago

#746 closed Bug / Defect (fixed)

replace WIN32 with _WIN32

Reported by: Gert Döring Owned by:
Priority: major Milestone: beta 2.4
Component: Generic / unclassified Version: OpenVPN git master branch (Community Ed)
Severity: Not set (select this one, unless your'e a OpenVPN developer) Keywords:


the discussion around the c99 WIN32 breakage and patch brought up this URL regarding "how to reliably detect operating systems"

which recommends to use _WIN32, since that is always defined by the C compiler and not by some header file (windefs.h) which might or might not be included.

Basically this is just a big find and replace orgy, but the result wants to be tested.

Change History (4)

comment:1 Changed 8 years ago by Selva Nair

Alternatively have WIN32 defined in config.h or in $CPPFLAGS during configure. Easy to do as already adds some Windows specific defines when mingw is in use. Then folks need not change their habit(?) of using #ifdef WIN32.

comment:2 Changed 8 years ago by Gert Döring

config.h / configure would work, but then we're back to "if a file does not include config.h, it will not see the define" (plus, MSVC).

So _WIN32 sounds more failsave.

comment:3 Changed 8 years ago by Gert Döring

Patch sent to list.

perl -pi -e 's/ WIN32/ _WIN32/; s/\(WIN32/(_WIN32/';" *.[ch]

auto-changed most of them easily...

Date: Thu, 10 Nov 2016 09:21:52 +0100
From: Gert Doering <gert@…>
To: openvpn-devel@…
Subject: [Openvpn-devel] [PATCH] Replace WIN32 by _WIN32

comment:4 Changed 8 years ago by Gert Döring

Resolution: fixed
Status: newclosed

commit 445b192a7c31187c7b5c66c8250a1886b04a2b2c
Author: Gert Doering
Date: Sun Nov 13 20:52:28 2016 +0100

Replace WIN32 by _WIN32

Note: See TracTickets for help on using tickets.