diff options
author | nijtmans <nijtmans> | 2010-11-19 20:12:23 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-11-19 20:12:23 (GMT) |
commit | f467ab59161c0d4f3ff72bdcbc456d2a12af3878 (patch) | |
tree | 502d5823b79f5d2bffe0f8ea4a240236320efd8f | |
parent | b97e5b84bc31ca86df37e2a5cff45dd94e310c99 (diff) | |
download | tcl-f467ab59161c0d4f3ff72bdcbc456d2a12af3878.zip tcl-f467ab59161c0d4f3ff72bdcbc456d2a12af3878.tar.gz tcl-f467ab59161c0d4f3ff72bdcbc456d2a12af3878.tar.bz2 |
fix gcc warning: dereferencing pointer 'oemId' does break strict-aliasing rules
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | win/tclWinInit.c | 15 |
2 files changed, 10 insertions, 7 deletions
@@ -2,6 +2,8 @@ * generic/tclInterp.c: fix gcc warning: passing argument 3 of 'Tcl_GetIndexFromObj' discards qualifiers from pointer target type + * generic/tclWinInit.c: fix gcc warning: dereferencing pointer + 'oemId' does break strict-aliasing rules 2010-11-18 Donal K. Fellows <dkf@users.sf.net> diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 2d923c1..59e034a 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinInit.c,v 1.75.2.1 2009/07/01 14:05:19 patthoyts Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.75.2.2 2010/11/19 20:12:24 nijtmans Exp $ */ #include "tclWinInt.h" @@ -499,8 +499,10 @@ TclpSetVariables( { CONST char *ptr; char buffer[TCL_INTEGER_SPACE * 2]; - SYSTEM_INFO sysInfo, *sysInfoPtr = &sysInfo; - OemId *oemId; + union { + SYSTEM_INFO info; + OemId oemId; + } sys; OSVERSIONINFOA osInfo; Tcl_DString ds; WCHAR szUserName[UNLEN+1]; @@ -512,8 +514,7 @@ TclpSetVariables( osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); GetVersionExA(&osInfo); - oemId = (OemId *) sysInfoPtr; - GetSystemInfo(&sysInfo); + GetSystemInfo(&sys.info); /* * Define the tcl_platform array. @@ -527,9 +528,9 @@ TclpSetVariables( } wsprintfA(buffer, "%d.%d", osInfo.dwMajorVersion, osInfo.dwMinorVersion); Tcl_SetVar2(interp, "tcl_platform", "osVersion", buffer, TCL_GLOBAL_ONLY); - if (oemId->wProcessorArchitecture < NUMPROCESSORS) { + if (sys.oemId.wProcessorArchitecture < NUMPROCESSORS) { Tcl_SetVar2(interp, "tcl_platform", "machine", - processors[oemId->wProcessorArchitecture], + processors[sys.oemId.wProcessorArchitecture], TCL_GLOBAL_ONLY); } |