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

RESOLVED WORKSFORME

Status

NSPR
NSPR
--
trivial
RESOLVED WORKSFORME
14 years ago
6 years ago

People

(Reporter: sgautherie, Assigned: sgautherie)

Tracking

(Blocks: 2 bugs)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [build_warning])

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

14 years ago
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.
(Assignee)

Updated

14 years ago
Status: NEW → ASSIGNED
(Assignee)

Updated

14 years ago
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.
(Assignee)

Comment 1

14 years ago
Created attachment 138360 [details] [diff] [review]
(Av1) <ptio.c> warning fix
(Assignee)

Comment 2

14 years ago
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)
(Assignee)

Comment 3

14 years ago
Created attachment 138364 [details] [diff] [review]
(Bv1) <ptio.c> code cleanup
(Assignee)

Comment 4

14 years ago
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)
(Assignee)

Updated

14 years ago
Blocks: 228448
(Assignee)

Updated

14 years ago
Blocks: 230397
(Assignee)

Updated

14 years ago
Blocks: 59652
No longer blocks: 187528, 230397
QA Contact: wtchang → nspr
(Assignee)

Comment 5

9 years ago
Created attachment 371851 [details] [diff] [review]
(Av1a) ptio.c: warning fix and little code cleanup

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)
(Assignee)

Updated

9 years ago
Attachment #371851 - Flags: review? → review?(wtc)
(Assignee)

Comment 6

9 years ago
(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
}
Attachment #371851 - Flags: review-
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;

Updated

6 years ago
Whiteboard: [build_warning]

Updated

6 years ago
Blocks: 187528

Comment 8

6 years ago
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
Last Resolved: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.