Put -Wunused in Xcode project alongside -Wextra

RESOLVED FIXED

Status

--
trivial
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: pnkfelix, Assigned: pnkfelix)

Tracking

Details

Attachments

(1 attachment, 1 obsolete attachment)

During investigation of Bug 654996, I discovered that Xcode is hiding all the unused parameter warnings, even though they are explicitly enabled according its UI (and one can confirm that the generated command lines to gcc include the options to enable the warnings).

It looks like there is a bug in gcc (at least gcc 4.0 on Mac OS X) where e.g. if you do:
  gcc -Wunused-parameter -Wextra
it behaves like
  gcc -Wextra

but passing 
  gcc -Wextra -Wunused-parameter
behaves like you would expect.

I'm guessing there's a logic bug in the guts of -Wextra; the notes for -Wextra actually say that it will *enable* -Wunused-parameter if you also pass -Wunused, as illustrated here:

% cat /tmp/foo.cpp 
int f(int x) { return 0; }
% g++ -c /tmp/foo.cpp -Wextra
% g++ -c /tmp/foo.cpp -Wextra -Wunused
/tmp/foo.cpp:1: warning: unused parameter ‘x’
% g++ -c /tmp/foo.cpp -Wunused -Wextra
/tmp/foo.cpp:1: warning: unused parameter ‘x’
% g++ -c /tmp/foo.cpp -Wextra -Wunused-parameter
/tmp/foo.cpp:1: warning: unused parameter ‘x’
% g++ -c /tmp/foo.cpp -Wunused-parameter -Wextra
% 

Anyway, we can trivially work around this by just passing -Wunused in the same place we pass -Wextra; that should fix this problem.
(Assignee)

Updated

8 years ago
Blocks: 654996
Created attachment 530334 [details] [diff] [review]
Add -Wunused alongside -Wextra
Assignee: nobody → fklockii
Status: NEW → ASSIGNED
Attachment #530334 - Flags: review?(jsudduth)
Comment on attachment 530334 [details] [diff] [review]
Add -Wunused alongside -Wextra

(patch accidentally included warnings-as-errors stuff, hold on)
Attachment #530334 - Flags: review?(jsudduth)
Created attachment 530336 [details] [diff] [review]
Add -Wunused alongside -Wextra
Attachment #530334 - Attachment is obsolete: true
Attachment #530336 - Flags: review?(jsudduth)
(Assignee)

Updated

8 years ago
No longer blocks: 654996

Updated

8 years ago
Attachment #530336 - Flags: review?(jsudduth) → review+

Comment 4

8 years ago
changeset: 6274:0483b56d8af5
user:      Felix S Klock II <fklockii@adobe.com>
summary:   Bug 655035: Add -Wunused alongside -Wextra in Xcode project.

http://hg.mozilla.org/tamarin-redux/rev/0483b56d8af5
(Assignee)

Updated

8 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.