Closed Bug 230837 Opened 21 years ago Closed 21 years ago

_PR_MD_INIT_CONTEXT for w9x needs to set status, or pruthr.c needs to change its behavior

Categories

(NSPR :: NSPR, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: timeless, Assigned: wtc)

Details

Attachments

(2 files)

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.00.9466 for 80x86
Copyright (C) Microsoft Corporation 1984-2001. All rights reserved.

(mozilla trunk from today)
r:\mozilla\nsprpub\pr\src\threads\combined\pruthr.c(1339) : warning C4700: local
variable 'status' used without having been initialized

logic still exists on trunk today:
[head] pruthr.c
1337             _PR_MD_INIT_CONTEXT(thread, top, _PR_UserRunThread, &status);
[head] primpl.h
1040 #define    _PR_MD_INIT_CONTEXT _MD_INIT_CONTEXT
[head] _win95.h
439 #define _MD_INIT_CONTEXT
Thanks for the bug report.  It is indeed an
uninitialized variable.  Moreover, the
preprocessed _PR_CreateThread you provided
shows how broken the _MD_INIT_CONTEXT in
_win95.h is.  Fortunately the code in
question will never be executed in the "WIN95"
configuration of NSPR.

The _MD_INIT_CONTEXT macro in _os2.h, _solaris.h
(at line 361), and _win95.h should be defined to do
    *status = PR_TRUE;
to eliminate this (benign) compiler warning.

I think we could just say:

#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) *status = PR_TRUE

A better definition would be:

#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
    PR_BEGIN_MACRO \
    *status = PR_TRUE; \
    PR_END_MACRO
Attachment #139328 - Flags: review?(wchang0222)
Comment on attachment 139328 [details] [diff] [review]
per wtc. builds on wXP

r=wtc.	Thanks for the patch, timeless.
Attachment #139328 - Flags: review?(wchang0222) → review+
Patch checked into the NSPR tip (NSPR 4.5.1) and
NSPRPUB_PRE_4_2_CLIENT_BRANCH (Mozilla 1.7a).
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.5.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: