Suppress some unused variable build warnings

RESOLVED FIXED in 4.15

Status

NSPR
NSPR
RESOLVED FIXED
a year ago
9 months ago

People

(Reporter: mt, Assigned: mt)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

a year ago
NSPR builds (on my machine at least) warn about unused variables in a few places.

The first set is in ptio.c where the interaction of various #ifdef statements is a little off.

The second is in xxvrsion.c where we use a dummy variable to pull in string symbols.
(Assignee)

Comment 1

a year ago
Created attachment 8812632 [details] [diff] [review]
nspr-2.patch
Assignee: nobody → martin.thomson
Attachment #8812632 - Flags: review?(ted)
(Assignee)

Comment 2

a year ago
Created attachment 8812633 [details] [diff] [review]
nspr-3.patch
Attachment #8812633 - Flags: review?(ted)
(Assignee)

Comment 3

a year ago
Comment on attachment 8812633 [details] [diff] [review]
nspr-3.patch

Review of attachment 8812633 [details] [diff] [review]:
-----------------------------------------------------------------

::: lib/ds/plvrsion.c
@@ +98,2 @@
>  
>  /* plvrsion.c */

Oh, this is sad.  plvrsion.c only differs by the name that it uses: prVersionDescription_libplds vs. prVersionDescription_libprstrms vs. prVersionDescription_libplc.  It seems like we could use a #include and save some typing.

prvrsion.c is ever so slightly different again, but not enough to justify an entire .c file.

Updated

9 months ago
Attachment #8812632 - Flags: review?(ted) → review?(kaie)

Updated

9 months ago
Attachment #8812633 - Flags: review?(ted) → review?(kaie)

Comment 4

9 months ago
I'm surprised how long I had to stare at these patches to conclude they make sense.

Comment 5

9 months ago
Comment on attachment 8812632 [details] [diff] [review]
nspr-2.patch

r=kaie

The existing code only uses md_af ifdef _PR_HAVE_SOCKADDR_LEN,
so it makes sense to only define the variable in that case.
Attachment #8812632 - Flags: review?(kaie) → review+

Comment 6

9 months ago
Comment on attachment 8812633 [details] [diff] [review]
nspr-3.patch

r=kaie

You check if the warning triggers a failure, and if it does, you check if the failure can be suppressed by using a pragma to ignore the parameter, and if yes, you define _PR_HAS_PRAGMA_DIAGNOSTIC=1. Clever.
Attachment #8812633 - Flags: review?(kaie) → review+

Comment 7

9 months ago
Please let me know if you don't want to checkin yourself.
Keywords: checkin-needed
(Assignee)

Comment 8

9 months ago
I did all the usual things for checkin, I hope that the rules are the same for NSPR as NSS.

remote:   https://hg.mozilla.org/projects/nspr/rev/8319f7a459dc64fd6d62e24381d114b460e9fb9d
remote:   https://hg.mozilla.org/projects/nspr/rev/0835554ac65ebbf1875c37454f34f315fbb514a6
Status: NEW → RESOLVED
Last Resolved: 9 months ago
Resolution: --- → FIXED
Version: other → 4.14

Updated

9 months ago
Keywords: checkin-needed
Target Milestone: --- → 4.15
You need to log in before you can comment on or make changes to this bug.