Closed Bug 230001 Opened 21 years ago Closed 13 years ago

<ptio.c>: Fix 2* ['start' might be used uninitialized in this function] from 'Blamed Build Warnings; Linux brad Clobber'; and code cleanup.

Categories

(NSPR :: NSPR, defect)

defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: sgautherie, Assigned: sgautherie)

References

(Blocks 1 open bug)

Details

(Whiteboard: [build_warning])

Attachments

(2 files, 1 obsolete file)

The two ("bogus") warnings are:

{ (unblamed)
3.	nsprpub/pr/src/pthreads/ptio.c:3748 (See build log excerpt)
	`start' might be used uninitialized in this function

3746 

4.	nsprpub/pr/src/pthreads/ptio.c:4816 (See build log excerpt)
	`start' might be used uninitialized in this function

4814 
}

The code is right, but the compiler does not track the |if| conditions.
Status: NEW → ASSIGNED
Summary: Fix 2* ['start' might be used uninitialized in this function] from 'Blamed Build Warnings; Linux brad Clobber'; and code cleanup. → <ptio.c>: Fix 2* ['start' might be used uninitialized in this function] from 'Blamed Build Warnings; Linux brad Clobber'; and code cleanup.
Attached patch (Av1) <ptio.c> warning fix (obsolete) — Splinter Review
Comment on attachment 138360 [details] [diff] [review]
(Av1) <ptio.c> warning fix


'r=?': (see comment 0)
I have no compiler: Could you compile/test/review it ? Thanks.
Attachment #138360 - Flags: review?(wchang0222)
Comment on attachment 138364 [details] [diff] [review]
(Bv1) <ptio.c> code cleanup


I have no compiler: Could you compile/test/review it ? Thanks.
Attachment #138364 - Flags: review?(wchang0222)
Blocks: 228448
Blocks: 230397
Blocks: 59652
No longer blocks: buildwarning, 230397
QA Contact: wtchang → nspr
Uncompiled, as this directory is not present in my Windows objdir.

I'll realign the code in a follow-up patch.

***

Bug still there:
http://office.smedbergs.us:8080/search?user=&path=%25pthreads%25&msg=%25uninitialized%25&id=1280
# nsprpub/pr/src/pthreads/ptio.c:3762 - 'start' may be used uninitialized in this function
# nsprpub/pr/src/pthreads/ptio.c:4916 - 'start' may be used uninitialized in this function
Attachment #138360 - Attachment is obsolete: true
Attachment #371851 - Flags: review?
Attachment #138360 - Flags: review?(wtc)
Attachment #371851 - Flags: review? → review?(wtc)
(In reply to comment #5)
> Uncompiled, as this directory is not present in my Windows objdir.

Tryserver is green with this as 'try-a6cb5e72ff8'.

Yet there are additional warnings:
{
Linux:
/builds/buildbot/sendchange-slave/sendchange-linux-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c: In function ‘pt_writev_cont’:
/builds/buildbot/sendchange-slave/sendchange-linux-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c:903: warning: dereferencing type-punned pointer will break strict-aliasing rules

Mac PPC:
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c: In function '_PR_InitIO':
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c:1174: warning: pointer targets in passing argument 5 of 'getsockopt' differ in signedness
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c: In function 'PR_Socket':
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c:3456: warning: unused variable 'tmp_domain'

Mac i386:
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c: In function '_PR_InitIO':
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c:1174: warning: pointer targets in passing argument 5 of 'getsockopt' differ in signedness
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c: In function 'PR_Socket':
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c:3456: warning: unused variable 'tmp_domain'
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c: In function 'pt_Available_f':
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c:1472: warning: 'end' may be used uninitialized in this function
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c: In function 'pt_Available64_f':
/builds/slave/sendchange-mac-hg/mozilla/nsprpub/pr/src/pthreads/ptio.c:1491: warning: 'end' may be used uninitialized in this function
}
Comment on attachment 371851 [details] [diff] [review]
(Av1a) ptio.c: warning fix and little code cleanup

The following change moves executable code up, so that it 
precedes an automatic variable definition.  That's OK in c++
and in some versions of c, but some of the c compilers on 
platforms supported by NSPR do not allow it.  So, r- for that.

> static PRInt32 _pr_poll_with_poll(
>     PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
> {
>+    if (pt_TestAbort())
>+        return -1;
>+
>+    if (0 == npds) {
>+        PR_Sleep(timeout);
>+        return 0;
>+    }
>+
>     PRInt32 ready = 0;
Whiteboard: [build_warning]
Blocks: buildwarning
We don't have uninitialized variable in ptio.c file. We do have "variable xx set but not used" warning but that will be tracked by different bug.
Hence Closing this bug.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: